From f013e1afd1e68af5e3b868c26a653bbfb39538f8 Mon Sep 17 00:00:00 2001 From: The Android Open Source Project Date: Wed, 17 Dec 2008 18:05:43 -0800 Subject: [PATCH] Code drop from //branches/cupcake/...@124589 --- Android.mk | 106 +- api/1.xml | 311265 ++++++++++++++ api/2.xml | 311400 ++++++++++++++ api/3.xml | 311400 ++++++++++++++ api/current.xml | 325107 +++++++++++++++ awt/java/awt/AWTEvent.java | 637 +- awt/java/awt/AWTException.java | 18 +- awt/java/awt/AWTKeyStroke.java | 502 +- awt/java/awt/AWTPermission.java | 23 +- awt/java/awt/ActiveEvent.java | 13 +- awt/java/awt/Adjustable.java | 54 +- awt/java/awt/AlphaComposite.java | 277 +- awt/java/awt/BasicStroke.java | 1499 +- awt/java/awt/BufferCapabilities.java | 88 +- awt/java/awt/Color.java | 647 +- awt/java/awt/Component.java | 3896 +- awt/java/awt/ComponentBehavior.java | 2 +- awt/java/awt/ComponentOrientation.java | 74 +- awt/java/awt/Composite.java | 30 +- awt/java/awt/CompositeContext.java | 23 +- awt/java/awt/Cursor.java | 217 +- awt/java/awt/Dimension.java | 76 +- awt/java/awt/DisplayMode.java | 88 +- awt/java/awt/Event.java | 421 +- awt/java/awt/EventQueue.java | 178 +- awt/java/awt/Font.java | 879 +- awt/java/awt/FontFormatException.java | 16 +- awt/java/awt/FontMetrics.java | 382 +- awt/java/awt/GradientPaint.java | 180 +- awt/java/awt/Graphics.java | 923 +- awt/java/awt/Graphics2D.java | 385 +- awt/java/awt/GraphicsConfiguration.java | 163 +- awt/java/awt/GraphicsDevice.java | 165 +- awt/java/awt/GraphicsEnvironment.java | 109 +- awt/java/awt/HeadlessException.java | 18 +- awt/java/awt/HeadlessGraphicsEnvironment.java | 31 +- awt/java/awt/HeadlessToolkit.java | 249 +- .../awt/IllegalComponentStateException.java | 24 +- awt/java/awt/Image.java | 144 +- awt/java/awt/ImageCapabilities.java | 32 +- awt/java/awt/Insets.java | 98 +- awt/java/awt/ItemSelectable.java | 20 +- awt/java/awt/MenuComponent.java | 854 +- awt/java/awt/MenuContainer.java | 15 +- awt/java/awt/Paint.java | 41 +- awt/java/awt/PaintContext.java | 41 +- awt/java/awt/Point.java | 92 +- awt/java/awt/Polygon.java | 337 +- awt/java/awt/Rectangle.java | 469 +- awt/java/awt/RenderingHints.java | 359 +- awt/java/awt/Shape.java | 156 +- awt/java/awt/Stroke.java | 31 +- awt/java/awt/Toolkit.java | 834 +- awt/java/awt/Transparency.java | 24 +- awt/java/awt/color/CMMException.java | 12 +- awt/java/awt/color/ColorSpace.java | 242 +- awt/java/awt/color/ICC_ColorSpace.java | 165 +- awt/java/awt/color/ICC_Profile.java | 892 +- awt/java/awt/color/ICC_ProfileGray.java | 24 +- awt/java/awt/color/ICC_ProfileRGB.java | 58 +- awt/java/awt/color/ProfileDataException.java | 13 +- awt/java/awt/color/package.html | 8 + awt/java/awt/event/AWTEventListener.java | 6 + awt/java/awt/event/AWTEventListenerProxy.java | 6 + awt/java/awt/event/ActionEvent.java | 6 + awt/java/awt/event/ActionListener.java | 6 + awt/java/awt/event/AdjustmentEvent.java | 6 + awt/java/awt/event/AdjustmentListener.java | 6 + awt/java/awt/event/ComponentAdapter.java | 6 + awt/java/awt/event/ComponentEvent.java | 6 + awt/java/awt/event/ComponentListener.java | 6 + awt/java/awt/event/ContainerAdapter.java | 6 + awt/java/awt/event/ContainerEvent.java | 6 + awt/java/awt/event/ContainerListener.java | 6 + awt/java/awt/event/FocusAdapter.java | 6 + awt/java/awt/event/FocusEvent.java | 6 + awt/java/awt/event/FocusListener.java | 6 + .../awt/event/HierarchyBoundsAdapter.java | 6 + .../awt/event/HierarchyBoundsListener.java | 6 + awt/java/awt/event/HierarchyEvent.java | 6 + awt/java/awt/event/HierarchyListener.java | 6 + awt/java/awt/event/InputEvent.java | 6 + awt/java/awt/event/InputMethodEvent.java | 6 + awt/java/awt/event/InputMethodListener.java | 6 + awt/java/awt/event/InvocationEvent.java | 6 + awt/java/awt/event/ItemEvent.java | 6 + awt/java/awt/event/ItemListener.java | 6 + awt/java/awt/event/KeyAdapter.java | 6 + awt/java/awt/event/KeyEvent.java | 6 + awt/java/awt/event/KeyListener.java | 6 + awt/java/awt/event/MouseAdapter.java | 6 + awt/java/awt/event/MouseEvent.java | 6 + awt/java/awt/event/MouseListener.java | 6 + awt/java/awt/event/MouseMotionAdapter.java | 6 + awt/java/awt/event/MouseMotionListener.java | 6 + awt/java/awt/event/MouseWheelEvent.java | 6 + awt/java/awt/event/MouseWheelListener.java | 6 + awt/java/awt/event/PaintEvent.java | 6 + awt/java/awt/event/TextEvent.java | 6 + awt/java/awt/event/TextListener.java | 6 + awt/java/awt/event/WindowAdapter.java | 6 + awt/java/awt/event/WindowEvent.java | 6 + awt/java/awt/event/WindowFocusListener.java | 6 + awt/java/awt/event/WindowListener.java | 6 + awt/java/awt/event/WindowStateListener.java | 6 + awt/java/awt/font/FontRenderContext.java | 66 +- awt/java/awt/font/GlyphJustificationInfo.java | 142 +- awt/java/awt/font/GlyphMetrics.java | 116 +- awt/java/awt/font/GlyphVector.java | 297 +- awt/java/awt/font/GraphicAttribute.java | 131 +- awt/java/awt/font/ImageGraphicAttribute.java | 80 +- awt/java/awt/font/LineBreakMeasurer.java | 175 +- awt/java/awt/font/LineMetrics.java | 33 +- awt/java/awt/font/MultipleMaster.java | 47 +- awt/java/awt/font/OpenType.java | 390 +- awt/java/awt/font/ShapeGraphicAttribute.java | 103 +- awt/java/awt/font/TextHitInfo.java | 153 +- awt/java/awt/font/TextLayout.java | 583 +- awt/java/awt/font/TextMeasurer.java | 117 +- awt/java/awt/font/TransformAttribute.java | 28 +- awt/java/awt/font/package.html | 8 + awt/java/awt/geom/AffineTransform.java | 987 +- awt/java/awt/geom/Arc2D.java | 653 +- awt/java/awt/geom/Area.java | 123 +- awt/java/awt/geom/CubicCurve2D.java | 704 +- awt/java/awt/geom/Dimension2D.java | 29 +- awt/java/awt/geom/Ellipse2D.java | 201 +- awt/java/awt/geom/FlatteningPathIterator.java | 348 +- awt/java/awt/geom/GeneralPath.java | 384 +- .../awt/geom/IllegalPathStateException.java | 21 +- awt/java/awt/geom/Line2D.java | 629 +- .../geom/NoninvertibleTransformException.java | 19 +- awt/java/awt/geom/PathIterator.java | 156 +- awt/java/awt/geom/Point2D.java | 153 +- awt/java/awt/geom/QuadCurve2D.java | 630 +- awt/java/awt/geom/Rectangle2D.java | 527 +- awt/java/awt/geom/RectangularShape.java | 111 +- awt/java/awt/geom/RoundRectangle2D.java | 365 +- awt/java/awt/geom/package.html | 8 + awt/java/awt/im/InputContext.java | 6 + awt/java/awt/im/InputMethodHighlight.java | 6 + awt/java/awt/im/InputMethodRequests.java | 6 + awt/java/awt/im/InputSubset.java | 6 + awt/java/awt/im/spi/InputMethod.java | 6 + awt/java/awt/im/spi/InputMethodContext.java | 6 + .../awt/im/spi/InputMethodDescriptor.java | 6 + awt/java/awt/image/AffineTransformOp.java | 321 +- .../awt/image/AreaAveragingScaleFilter.java | 191 +- .../image/AwtImageBackdoorAccessorImpl.java | 35 +- awt/java/awt/image/BandCombineOp.java | 466 +- awt/java/awt/image/BandedSampleModel.java | 327 +- awt/java/awt/image/BufferStrategy.java | 28 +- awt/java/awt/image/BufferedImage.java | 787 +- awt/java/awt/image/BufferedImageFilter.java | 164 +- awt/java/awt/image/BufferedImageOp.java | 50 +- awt/java/awt/image/ByteLookupTable.java | 70 +- awt/java/awt/image/ColorConvertOp.java | 543 +- awt/java/awt/image/ColorModel.java | 649 +- awt/java/awt/image/ComponentColorModel.java | 1597 +- awt/java/awt/image/ComponentSampleModel.java | 433 +- awt/java/awt/image/ConvolveOp.java | 348 +- awt/java/awt/image/CropImageFilter.java | 111 +- awt/java/awt/image/DataBuffer.java | 371 +- awt/java/awt/image/DataBufferByte.java | 88 +- awt/java/awt/image/DataBufferDouble.java | 94 +- awt/java/awt/image/DataBufferFloat.java | 92 +- awt/java/awt/image/DataBufferInt.java | 88 +- awt/java/awt/image/DataBufferShort.java | 89 +- awt/java/awt/image/DataBufferUShort.java | 99 +- awt/java/awt/image/DirectColorModel.java | 701 +- awt/java/awt/image/FilteredImageSource.java | 42 +- awt/java/awt/image/ImageConsumer.java | 160 +- awt/java/awt/image/ImageFilter.java | 37 +- awt/java/awt/image/ImageObserver.java | 82 +- awt/java/awt/image/ImageProducer.java | 43 +- awt/java/awt/image/ImagingOpException.java | 17 +- awt/java/awt/image/IndexColorModel.java | 596 +- awt/java/awt/image/Kernel.java | 63 +- awt/java/awt/image/LookupOp.java | 418 +- awt/java/awt/image/LookupTable.java | 48 +- awt/java/awt/image/MemoryImageSource.java | 557 +- .../image/MultiPixelPackedSampleModel.java | 299 +- awt/java/awt/image/PackedColorModel.java | 201 +- .../image/PixelInterleavedSampleModel.java | 50 +- awt/java/awt/image/RGBImageFilter.java | 159 +- awt/java/awt/image/Raster.java | 1243 +- awt/java/awt/image/RasterFormatException.java | 21 +- awt/java/awt/image/RasterOp.java | 45 +- awt/java/awt/image/RenderedImage.java | 54 +- awt/java/awt/image/ReplicateScaleFilter.java | 124 +- awt/java/awt/image/RescaleOp.java | 346 +- awt/java/awt/image/SampleModel.java | 1055 +- awt/java/awt/image/ShortLookupTable.java | 69 +- .../image/SinglePixelPackedSampleModel.java | 251 +- awt/java/awt/image/TileObserver.java | 31 +- awt/java/awt/image/VolatileImage.java | 58 +- awt/java/awt/image/WritableRaster.java | 566 +- awt/java/awt/image/WritableRenderedImage.java | 62 +- awt/java/awt/image/package.html | 8 + .../ContextualRenderedImageFactory.java | 58 +- .../awt/image/renderable/ParameterBlock.java | 376 +- .../awt/image/renderable/RenderContext.java | 110 +- .../awt/image/renderable/RenderableImage.java | 78 +- .../image/renderable/RenderableImageOp.java | 79 +- .../renderable/RenderableImageProducer.java | 56 +- .../renderable/RenderedImageFactory.java | 17 +- awt/java/awt/image/renderable/package.html | 8 + awt/java/awt/package.html | 8 + .../beans/IndexedPropertyChangeEvent.java | 66 - awt/java/beans/PropertyChangeEvent.java | 62 - awt/java/beans/PropertyChangeListener.java | 25 - .../beans/PropertyChangeListenerProxy.java | 41 - awt/java/beans/PropertyChangeSupport.java | 351 - awt/javax/imageio/IIOException.java | 16 +- awt/javax/imageio/IIOImage.java | 99 +- awt/javax/imageio/IIOParam.java | 170 +- awt/javax/imageio/IIOParamController.java | 14 +- awt/javax/imageio/ImageIO.java | 419 +- awt/javax/imageio/ImageReadParam.java | 106 +- awt/javax/imageio/ImageReader.java | 910 +- awt/javax/imageio/ImageTranscoder.java | 43 +- awt/javax/imageio/ImageTypeSpecifier.java | 254 +- awt/javax/imageio/ImageWriteParam.java | 291 +- awt/javax/imageio/ImageWriter.java | 640 +- .../event/IIOReadProgressListener.java | 84 +- .../imageio/event/IIOReadUpdateListener.java | 200 +- .../imageio/event/IIOReadWarningListener.java | 17 +- .../event/IIOWriteProgressListener.java | 67 +- .../event/IIOWriteWarningListener.java | 20 +- awt/javax/imageio/event/package.html | 8 + .../metadata/IIOInvalidTreeException.java | 37 +- awt/javax/imageio/metadata/IIOMetadata.java | 174 +- .../metadata/IIOMetadataController.java | 17 +- .../imageio/metadata/IIOMetadataFormat.java | 391 +- .../metadata/IIOMetadataFormatImpl.java | 661 +- .../imageio/metadata/IIOMetadataNode.java | 523 +- .../metadata/IIOStandardMetadataFormat.java | 85 +- awt/javax/imageio/metadata/package.html | 8 + awt/javax/imageio/package.html | 8 + .../plugins/bmp/BMPImageWriteParam.java | 34 +- awt/javax/imageio/plugins/bmp/package.html | 8 + .../plugins/jpeg/JPEGHuffmanTable.java | 171 +- .../plugins/jpeg/JPEGImageReadParam.java | 49 +- .../plugins/jpeg/JPEGImageWriteParam.java | 96 +- .../imageio/plugins/jpeg/JPEGQTable.java | 121 +- awt/javax/imageio/plugins/jpeg/package.html | 8 + awt/javax/imageio/spi/IIORegistry.java | 47 +- awt/javax/imageio/spi/IIOServiceProvider.java | 32 +- .../imageio/spi/ImageInputStreamSpi.java | 93 +- .../imageio/spi/ImageOutputStreamSpi.java | 92 +- awt/javax/imageio/spi/ImageReaderSpi.java | 186 +- .../imageio/spi/ImageReaderWriterSpi.java | 317 +- awt/javax/imageio/spi/ImageTranscoderSpi.java | 34 +- awt/javax/imageio/spi/ImageWriterSpi.java | 200 +- .../imageio/spi/RegisterableService.java | 36 +- awt/javax/imageio/spi/ServiceRegistry.java | 320 +- awt/javax/imageio/spi/package.html | 8 + .../stream/FileCacheImageInputStream.java | 46 +- .../stream/FileCacheImageOutputStream.java | 56 +- .../imageio/stream/FileImageInputStream.java | 35 +- .../imageio/stream/FileImageOutputStream.java | 35 +- awt/javax/imageio/stream/IIOByteBuffer.java | 53 +- .../imageio/stream/ImageInputStream.java | 427 +- .../imageio/stream/ImageInputStreamImpl.java | 130 +- .../imageio/stream/ImageOutputStream.java | 289 +- .../imageio/stream/ImageOutputStreamImpl.java | 49 +- .../stream/MemoryCacheImageInputStream.java | 28 +- .../stream/MemoryCacheImageOutputStream.java | 29 +- awt/javax/imageio/stream/package.html | 8 + .../harmony/awt/internal/nls/Messages.java | 8 + .../harmony/beans/internal/nls/Messages.java | 31 +- .../harmony/beans/internal/nls/MsgHelp.java | 86 + .../beans/internals}/nls/messages.properties | 0 build/jarjar-rules.txt | 2 + camera/libcameraservice/Android.mk | 11 +- camera/libcameraservice/CameraService.cpp | 135 +- camera/libcameraservice/CameraService.h | 26 +- cmds/pm/src/com/android/commands/pm/Pm.java | 101 +- .../com/android/commands/svc/DataCommand.java | 81 + .../android/commands/svc/PowerCommand.java | 17 +- .../svc/src/com/android/commands/svc/Svc.java | 29 +- .../com/android/commands/svc/WifiCommand.java | 78 + .../java/android/accounts/AccountMonitor.java | 66 +- core/java/android/app/Activity.java | 99 +- core/java/android/app/ActivityGroup.java | 16 + core/java/android/app/ActivityManager.java | 72 +- .../android/app/ActivityManagerNative.java | 21 + core/java/android/app/ActivityThread.java | 32 +- core/java/android/app/AlarmManager.java | 78 +- core/java/android/app/AlertDialog.java | 203 +- core/java/android/app/ApplicationContext.java | 165 +- core/java/android/app/DatePickerDialog.java | 4 +- core/java/android/app/IActivityManager.java | 4 + core/java/android/app/IAlarmManager.aidl | 1 + core/java/android/app/Instrumentation.java | 10 +- .../android/app/LocalActivityManager.java | 40 +- core/java/android/app/Notification.java | 4 +- core/java/android/app/PendingIntent.java | 24 +- core/java/android/app/ProgressDialog.java | 2 +- core/java/android/app/SearchDialog.java | 59 +- core/java/android/app/SearchManager.java | 43 +- core/java/android/app/Service.java | 4 - core/java/android/app/TimePickerDialog.java | 2 +- .../java/android/bluetooth/BluetoothA2dp.java | 181 + .../android/bluetooth/BluetoothClass.java | 191 + .../android/bluetooth/BluetoothDevice.java | 2 +- .../android/bluetooth/BluetoothError.java | 42 + .../android/bluetooth/BluetoothHeadset.java | 162 +- core/java/android/bluetooth/DeviceClass.java | 131 - .../android/bluetooth/IBluetoothA2dp.aidl | 29 + .../android/bluetooth/IBluetoothHeadset.aidl | 6 +- core/java/android/bluetooth/package.html | 1 - .../android/content/AbstractTableMerger.java | 3 +- .../android/content/AsyncQueryHandler.java | 26 +- .../android/content/BroadcastReceiver.java | 2 +- core/java/android/content/Context.java | 24 +- .../android/content/DefaultDataHandler.java | 75 +- .../java/android/content/DialogInterface.java | 41 +- core/java/android/content/Intent.java | 177 +- core/java/android/content/SyncManager.java | 7 +- .../java/android/content/pm/ActivityInfo.java | 29 +- .../android/content/pm/ApplicationInfo.java | 9 +- .../android/content/pm/ConfigurationInfo.java | 120 + .../android/content/pm/IPackageManager.aidl | 2 + .../content/pm/InstrumentationInfo.java | 2 + core/java/android/content/pm/PackageInfo.java | 11 + .../android/content/pm/PackageItemInfo.java | 7 +- .../android/content/pm/PackageManager.java | 186 +- .../android/content/pm/PackageParser.java | 80 +- .../android/content/res/ColorStateList.java | 6 +- .../android/content/res/Configuration.java | 64 +- .../java/android/content/res/PluralRules.java | 14 +- core/java/android/content/res/Resources.java | 169 +- .../java/android/content/res/StringBlock.java | 15 + .../java/android/database/AbstractCursor.java | 21 +- .../database/AbstractWindowedCursor.java | 2 +- core/java/android/database/CursorWindow.java | 9 +- core/java/android/database/DatabaseUtils.java | 15 + .../android/database/sqlite/SQLiteCursor.java | 174 +- .../database/sqlite/SQLiteDatabase.java | 168 +- .../database/sqlite/SQLiteOpenHelper.java | 2 - .../database/sqlite/SQLiteProgram.java | 4 +- .../android/database/sqlite/SQLiteQuery.java | 56 +- core/java/android/hardware/Camera.java | 33 +- .../java/android/hardware/ISensorService.aidl | 1 - core/java/android/hardware/Sensor.java | 146 + core/java/android/hardware/SensorEvent.java | 146 + .../android/hardware/SensorEventListener.java | 49 + .../java/android/hardware/SensorListener.java | 64 +- core/java/android/hardware/SensorManager.java | 1366 +- .../AbstractInputMethodService.java | 170 + .../inputmethodservice/ExtractEditText.java | 23 + .../IInputMethodSessionWrapper.java | 151 + .../IInputMethodWrapper.java | 172 + .../InputMethodService.java | 864 + .../android/inputmethodservice/Keyboard.java | 756 + .../inputmethodservice/KeyboardView.java | 1049 + .../inputmethodservice/SoftInputWindow.java | 151 + .../android/inputmethodservice/package.html | 8 + .../android/net/MobileDataStateTracker.java | 26 +- core/java/android/net/NetworkInfo.java | 121 +- .../java/android/net/NetworkStateTracker.java | 50 +- core/java/android/net/NetworkUtils.java | 8 + core/java/android/net/Proxy.java | 8 +- core/java/android/net/http/Connection.java | 5 + core/java/android/net/http/Headers.java | 219 +- core/java/android/net/http/Request.java | 6 + core/java/android/net/http/RequestHandle.java | 20 +- core/java/android/net/http/RequestQueue.java | 2 +- core/java/android/os/AsyncTask.java | 454 + core/java/android/os/BatteryManager.java | 6 +- core/java/android/os/BatteryStats.java | 518 + core/java/android/os/Debug.java | 4 + core/java/android/os/Handler.java | 64 +- core/java/android/os/ICheckinService.aidl | 3 +- core/java/android/os/IPowerManager.aidl | 2 +- core/java/android/os/Looper.java | 16 +- core/java/android/os/Process.java | 26 +- core/java/android/pim/EventRecurrence.java | 1 + core/java/android/pim/RecurrenceSet.java | 7 +- .../preference/CheckBoxPreference.java | 2 +- .../android/preference/DialogPreference.java | 13 +- .../preference/EditTextPreference.java | 2 +- .../android/preference/ListPreference.java | 16 +- core/java/android/preference/Preference.java | 408 +- .../preference/PreferenceActivity.java | 4 +- .../preference/PreferenceCategory.java | 2 +- .../android/preference/PreferenceGroup.java | 4 +- .../android/preference/PreferenceManager.java | 27 +- .../android/preference/PreferenceScreen.java | 41 +- .../preference/RingtonePreference.java | 4 +- .../android/preference/VolumePreference.java | 200 +- core/java/android/provider/Calendar.java | 21 +- core/java/android/provider/Checkin.java | 2 - core/java/android/provider/Contacts.java | 58 +- core/java/android/provider/Downloads.java | 221 +- core/java/android/provider/Gmail.java | 51 +- core/java/android/provider/Im.java | 146 +- core/java/android/provider/LiveFolders.java | 298 + core/java/android/provider/MediaStore.java | 287 +- .../provider/SearchRecentSuggestions.java | 5 + core/java/android/provider/Settings.java | 1620 +- core/java/android/provider/Sync.java | 51 +- core/java/android/provider/Telephony.java | 126 +- .../android/security/Md5MessageDigest.java | 3 +- core/java/android/security/MessageDigest.java | 21 + .../android/security/Sha1MessageDigest.java | 3 +- core/java/android/security/package.html | 3 +- .../android/server/BluetoothA2dpService.java | 315 + .../server/BluetoothDeviceService.java | 171 +- .../android/server/BluetoothEventLoop.java | 93 +- .../checkin/FallbackCheckinService.java | 4 + .../android/server/search/SearchableInfo.java | 3 +- .../AbstractEmbeddedGrammarListener.java | 51 - .../recognition/AbstractGrammarListener.java | 39 - .../AbstractRecognizerListener.java | 83 - .../AbstractSrecGrammarListener.java | 59 - .../AudioAlreadyInUseException.java | 34 - .../AudioDriverErrorException.java | 33 - .../speech/recognition/AudioSource.java | 45 - .../recognition/AudioSourceListener.java | 44 - .../speech/recognition/AudioStream.java | 35 - .../android/speech/recognition/Codec.java | 126 - .../speech/recognition/DeviceSpeaker.java | 77 - .../recognition/DeviceSpeakerListener.java | 44 - .../speech/recognition/EmbeddedGrammar.java | 43 - .../recognition/EmbeddedGrammarListener.java | 58 - .../recognition/EmbeddedRecognizer.java | 66 - .../android/speech/recognition/Grammar.java | 43 - .../recognition/GrammarErrorException.java | 33 - .../speech/recognition/GrammarListener.java | 45 - .../recognition/GrammarOverflowException.java | 33 - .../recognition/InvalidURLException.java | 34 - .../android/speech/recognition/Logger.java | 127 - .../speech/recognition/MediaFileReader.java | 90 - .../recognition/MediaFileReaderListener.java | 29 - .../speech/recognition/MediaFileWriter.java | 49 - .../recognition/MediaFileWriterListener.java | 40 - .../speech/recognition/Microphone.java | 76 - .../recognition/MicrophoneListener.java | 29 - .../recognition/NBestRecognitionResult.java | 113 - .../recognition/ParameterErrorException.java | 33 - .../recognition/ParametersListener.java | 63 - .../recognition/ParseErrorException.java | 33 - .../speech/recognition/RecognitionResult.java | 27 - .../speech/recognition/Recognizer.java | 102 - .../recognition/RecognizerListener.java | 142 - .../android/speech/recognition/SlotItem.java | 27 - .../speech/recognition/SrecGrammar.java | 81 - .../recognition/SrecGrammarListener.java | 58 - .../speech/recognition/VoicetagItem.java | 82 - .../recognition/VoicetagItemListener.java | 49 - .../android/speech/recognition/WordItem.java | 58 - .../recognition/impl/AudioStreamImpl.java | 84 - .../recognition/impl/DeviceSpeakerImpl.java | 164 - .../recognition/impl/EmbeddedGrammarImpl.java | 73 - .../impl/EmbeddedRecognizerImpl.java | 246 - .../speech/recognition/impl/EntryImpl.java | 147 - .../speech/recognition/impl/GrammarImpl.java | 114 - .../speech/recognition/impl/LoggerImpl.java | 166 - .../recognition/impl/MediaFileReaderImpl.java | 156 - .../recognition/impl/MediaFileWriterImpl.java | 102 - .../recognition/impl/MicrophoneImpl.java | 165 - .../impl/NBestRecognitionResultImpl.java | 106 - .../recognition/impl/SrecGrammarImpl.java | 120 - .../speech/recognition/impl/System.java | 179 - .../recognition/impl/VoicetagItemImpl.java | 206 - .../speech/recognition/impl/WordItemImpl.java | 157 - .../speech/recognition/impl/package.html | 5 - .../android/speech/recognition/package.html | 6 - .../speech/srec/MicrophoneInputStream.java | 106 + core/java/android/speech/srec/Recognizer.java | 679 + core/java/android/speech/srec/Srec.java | 162 - .../speech/srec/UlawEncoderInputStream.java | 186 + core/java/android/speech/srec/package.html | 5 + .../android/test/InstrumentationTestCase.java | 56 +- .../suitebuilder/annotation/LargeTest.java | 30 + .../suitebuilder/annotation/MediumTest.java | 31 + .../suitebuilder/annotation/SmallTest.java | 30 + core/java/android/text/BoringLayout.java | 4 +- core/java/android/text/InputFilter.java | 5 + core/java/android/text/InputType.java | 227 + core/java/android/text/LoginFilter.java | 15 +- core/java/android/text/Selection.java | 7 +- core/java/android/text/Spanned.java | 14 + core/java/android/text/StaticLayout.java | 5 +- core/java/android/text/TextUtils.java | 159 +- .../{pim => text/format}/DateFormat.java | 87 +- .../{pim => text/format}/DateUtils.java | 410 +- .../{content => text/format}/Formatter.java | 27 +- .../android/{pim => text/format}/Time.java | 236 +- .../text/method/ArrowKeyMovementMethod.java | 31 +- .../android/text/method/BaseKeyListener.java | 23 +- .../text/method/CharacterPickerDialog.java | 2 +- .../android/text/method/DateKeyListener.java | 6 + .../text/method/DateTimeKeyListener.java | 6 + .../text/method/DialerKeyListener.java | 6 +- .../text/method/DigitsKeyListener.java | 12 + .../java/android/text/method/KeyListener.java | 40 +- .../text/method/MetaKeyKeyListener.java | 6 + .../text/method/MultiTapKeyListener.java | 7 +- .../text/method/QwertyKeyListener.java | 17 +- .../text/method/ScrollingMovementMethod.java | 28 +- .../android/text/method/TextKeyListener.java | 83 +- .../android/text/method/TimeKeyListener.java | 6 + core/java/android/text/method/Touch.java | 21 +- .../text/style/DynamicDrawableSpan.java | 36 +- core/java/android/text/util/Linkify.java | 38 +- core/java/android/text/util/Regex.java | 20 +- core/java/android/util/TimeUtils.java | 46 +- core/java/android/view/ContextMenu.java | 2 +- core/java/android/view/Gravity.java | 191 +- core/java/android/view/IWindow.aidl | 4 +- core/java/android/view/IWindowManager.aidl | 11 +- core/java/android/view/IWindowSession.aidl | 53 +- core/java/android/view/KeyEvent.java | 54 +- core/java/android/view/Menu.java | 21 +- core/java/android/view/MenuItem.java | 16 + core/java/android/view/MotionEvent.java | 26 + .../android/view/OrientationListener.java | 19 +- core/java/android/view/SurfaceView.java | 15 +- core/java/android/view/View.java | 1360 +- core/java/android/view/ViewConfiguration.java | 15 +- core/java/android/view/ViewDebug.java | 249 +- core/java/android/view/ViewGroup.java | 108 +- core/java/android/view/ViewParent.java | 26 + core/java/android/view/ViewRoot.java | 798 +- core/java/android/view/ViewTreeObserver.java | 171 + core/java/android/view/VolumePanel.java | 147 +- core/java/android/view/Window.java | 46 +- core/java/android/view/WindowManager.java | 222 +- core/java/android/view/WindowManagerImpl.java | 31 +- .../android/view/WindowManagerPolicy.java | 128 +- .../android/view/animation/Animation.java | 10 + .../android/view/animation/AnimationSet.java | 17 + .../view/animation/Transformation.java | 10 +- .../view/inputmethod/BaseInputConnection.java | 98 + .../view/inputmethod/CompletionInfo.aidl | 19 + .../view/inputmethod/CompletionInfo.java | 131 + .../view/inputmethod/DefaultInputMethod.java | 239 + .../android/view/inputmethod/EditorInfo.aidl | 19 + .../android/view/inputmethod/EditorInfo.java | 126 + .../view/inputmethod/ExtractedText.aidl | 19 + .../view/inputmethod/ExtractedText.java | 82 + .../inputmethod/ExtractedTextRequest.aidl | 19 + .../inputmethod/ExtractedTextRequest.java | 61 + .../view/inputmethod/InputBinding.aidl | 19 + .../view/inputmethod/InputBinding.java | 152 + .../view/inputmethod/InputConnection.java | 249 + .../inputmethod/InputConnectionWrapper.java | 95 + .../android/view/inputmethod/InputMethod.java | 170 + .../view/inputmethod/InputMethodInfo.aidl | 19 + .../view/inputmethod/InputMethodInfo.java | 300 + .../view/inputmethod/InputMethodManager.java | 900 + .../view/inputmethod/InputMethodSession.java | 137 + .../MutableInputConnectionWrapper.java | 38 + .../android/view/inputmethod/package.html | 11 + core/java/android/webkit/BrowserFrame.java | 183 +- core/java/android/webkit/CacheManager.java | 70 +- core/java/android/webkit/CallbackProxy.java | 10 +- core/java/android/webkit/CookieManager.java | 118 +- core/java/android/webkit/DateSorter.java | 23 +- core/java/android/webkit/FileLoader.java | 33 +- core/java/android/webkit/FrameLoader.java | 103 +- core/java/android/webkit/HttpDateTime.java | 2 +- .../android/webkit/JWebCoreJavaBridge.java | 1 + core/java/android/webkit/LoadListener.java | 85 +- core/java/android/webkit/MimeTypeMap.java | 2 +- core/java/android/webkit/Network.java | 7 +- core/java/android/webkit/TextDialog.java | 6 + core/java/android/webkit/URLUtil.java | 1 + .../android/webkit/WebBackForwardList.java | 2 +- core/java/android/webkit/WebHistoryItem.java | 18 +- core/java/android/webkit/WebSettings.java | 308 +- core/java/android/webkit/WebView.java | 1074 +- core/java/android/webkit/WebViewCore.java | 400 +- core/java/android/webkit/WebViewDatabase.java | 76 +- .../webkit/gears/AndroidWifiDataProvider.java | 136 + .../android/webkit/gears/DesktopAndroid.java | 6 +- .../webkit/gears/HttpRequestAndroid.java | 29 +- .../android/webkit/gears/NativeDialog.java | 142 + .../android/webkit/gears/PluginSettings.java | 79 + .../gears/UrlInterceptHandlerGears.java | 10 +- core/java/android/widget/AbsListView.java | 256 +- core/java/android/widget/AbsSeekBar.java | 11 + core/java/android/widget/AbsoluteLayout.java | 4 + core/java/android/widget/AdapterView.java | 7 +- core/java/android/widget/AlphabetIndexer.java | 283 + core/java/android/widget/AnalogClock.java | 2 +- .../widget/AppSecurityPermissions.java | 347 +- core/java/android/widget/ArrayAdapter.java | 6 +- .../android/widget/AutoCompleteTextView.java | 441 +- .../widget/BaseExpandableListAdapter.java | 4 +- core/java/android/widget/Chronometer.java | 2 +- core/java/android/widget/CursorAdapter.java | 5 +- .../android/widget/CursorTreeAdapter.java | 7 +- core/java/android/widget/DatePicker.java | 2 +- core/java/android/widget/DigitalClock.java | 10 +- core/java/android/widget/EditText.java | 10 +- .../widget/ExpandableListConnector.java | 330 +- .../widget/ExpandableListPosition.java | 77 +- .../android/widget/ExpandableListView.java | 107 +- core/java/android/widget/FastScroller.java | 471 + core/java/android/widget/Gallery.java | 49 +- core/java/android/widget/GridView.java | 28 +- core/java/android/widget/LinearLayout.java | 14 +- core/java/android/widget/ListView.java | 151 +- core/java/android/widget/MediaController.java | 2 + core/java/android/widget/PopupWindow.java | 488 +- core/java/android/widget/ProgressBar.java | 98 +- .../android/widget/ScrollBarDrawable.java | 5 +- core/java/android/widget/ScrollView.java | 43 +- core/java/android/widget/SectionIndexer.java | 52 + core/java/android/widget/SimpleAdapter.java | 24 +- .../android/widget/SimpleCursorAdapter.java | 44 +- core/java/android/widget/TableLayout.java | 14 +- core/java/android/widget/TextView.java | 1497 +- core/java/android/widget/VideoView.java | 35 +- .../android/internal/app/AlertController.java | 333 +- .../android/internal/app/IBatteryStats.aidl | 5 + .../internal/app/ResolverActivity.java | 197 +- .../internal/app/RingtonePickerActivity.java | 3 + .../internal/app/UsbStorageActivity.java | 4 +- .../internal/database/ArrayListCursor.java | 122 +- .../android/internal/os/BatteryStatsImpl.aidl | 19 + .../android/internal/os/BatteryStatsImpl.java | 1661 + .../android/internal/os/HandlerCaller.java | 166 + .../android/internal/os/ZygoteConnection.java | 14 +- .../com/android/internal/os/ZygoteInit.java | 22 +- .../android/internal/provider/Settings.java | 199 - .../internal/util/FastXmlSerializer.java | 4 +- .../view/IInputConnectionCallback.aidl | 31 + .../view/IInputConnectionWrapper.java | 252 + .../android/internal/view/IInputContext.aidl | 58 + .../internal/view/IInputContextCallback.aidl | 29 + .../android/internal/view/IInputMethod.aidl | 54 + .../internal/view/IInputMethodCallback.aidl | 34 + .../internal/view/IInputMethodClient.aidl | 30 + .../internal/view/IInputMethodManager.aidl | 51 + .../internal/view/IInputMethodSession.aidl | 48 + .../internal/view/InputBindResult.aidl | 19 + .../internal/view/InputBindResult.java | 91 + .../internal/view/InputConnectionWrapper.java | 306 + .../internal/view/menu/IconMenuItemView.java | 10 +- .../internal/view/menu/IconMenuView.java | 235 +- .../internal/view/menu/MenuBuilder.java | 21 +- .../internal/view/menu/MenuDialogHelper.java | 3 +- .../internal/view/menu/MenuItemImpl.java | 3 + .../com/android/internal/view/package.html | 3 + .../android/internal/widget/DialogTitle.java | 71 + .../widget/EditableInputConnection.java | 338 + .../internal/widget/LockPatternUtils.java | 14 + .../internal/widget/LockPatternView.java | 41 +- .../android/internal/widget/NumberPicker.java | 15 +- .../internal/widget/SlidingDrawer.java | 28 +- .../google/android/mms/pdu/PduComposer.java | 5 +- .../google/android/mms/pdu/PduHeaders.java | 7 +- .../google/android/mms/pdu/PduPersister.java | 25 +- .../com/google/android/mms/pdu/SendReq.java | 2 +- .../google/android/net/ParentalControl.java | 23 +- .../android/util/GoogleWebContentHelper.java | 52 +- core/java/jarjar-rules.txt | 2 + core/jni/Android.mk | 18 +- core/jni/AndroidRuntime.cpp | 75 +- core/jni/android/graphics/Bitmap.cpp | 1134 +- core/jni/android/graphics/BitmapFactory.cpp | 93 +- .../CreateJavaOutputStreamAdaptor.cpp | 109 +- core/jni/android/graphics/Graphics.cpp | 4 +- core/jni/android/graphics/Movie.cpp | 2 +- core/jni/android/graphics/NinePatch.cpp | 47 +- core/jni/android/graphics/NinePatchImpl.cpp | 4 + core/jni/android/graphics/Paint.cpp | 39 +- core/jni/android/graphics/Shader.cpp | 70 +- core/jni/android_bluetooth_common.h | 9 + core/jni/android_database_SQLiteProgram.cpp | 2 +- core/jni/android_database_SQLiteQuery.cpp | 18 +- core/jni/android_hardware_Camera.cpp | 86 +- core/jni/android_hardware_SensorManager.cpp | 127 +- core/jni/android_media_AudioRecord.cpp | 566 + core/jni/android_media_AudioTrack.cpp | 832 + core/jni/android_media_ToneGenerator.cpp | 2 +- core/jni/android_net_LocalSocketImpl.cpp | 4 +- core/jni/android_net_NetUtils.cpp | 14 +- core/jni/android_net_wifi_Wifi.cpp | 30 +- .../android_server_BluetoothA2dpService.cpp | 417 + .../jni/android_server_BluetoothEventLoop.cpp | 161 +- core/jni/android_text_AndroidCharacter.cpp | 4 +- ..._Time.cpp => android_text_format_Time.cpp} | 263 +- core/jni/android_util_AssetManager.cpp | 15 +- core/jni/android_util_Process.cpp | 6 + .../com_google_android_gles_jni_EGLImpl.cpp | 11 +- .../com_google_android_gles_jni_GLImpl.cpp | 26 +- core/jni/server/Android.mk | 2 + ...com_android_server_AlarmManagerService.cpp | 18 + .../com_android_server_SensorService.cpp | 30 +- core/res/AndroidManifest.xml | 34 +- core/res/assets/webkit/film.png | Bin 3499 -> 0 bytes core/res/assets/webkit/play.png | Bin 0 -> 64890 bytes core/res/assets/webkit/youtube.html | 65 +- core/res/res/anim/dialog_enter.xml | 29 + core/res/res/anim/dialog_exit.xml | 28 + core/res/res/anim/input_method_enter.xml | 32 + core/res/res/anim/input_method_exit.xml | 31 + core/res/res/anim/search_bar_enter.xml | 24 + core/res/res/anim/search_bar_exit.xml | 25 + core/res/res/anim/task_close_exit.xml | 2 +- core/res/res/anim/task_open_enter.xml | 2 +- .../res/drawable/btn_check_buttonless_off.png | Bin 0 -> 608 bytes .../res/drawable/btn_check_buttonless_on.png | Bin 0 -> 721 bytes core/res/res/drawable/btn_check_off.png | Bin 1261 -> 1172 bytes .../res/drawable/btn_check_off_disable.png | Bin 1414 -> 1142 bytes .../btn_check_off_disable_focused.png | Bin 1437 -> 1243 bytes .../res/drawable/btn_check_off_longpress.png | Bin 1753 -> 1633 bytes .../res/drawable/btn_check_off_pressed.png | Bin 1751 -> 1513 bytes .../res/drawable/btn_check_off_selected.png | Bin 1790 -> 1520 bytes core/res/res/drawable/btn_check_on.png | Bin 1639 -> 1390 bytes .../res/res/drawable/btn_check_on_disable.png | Bin 1733 -> 1268 bytes .../drawable/btn_check_on_disable_focused.png | Bin 1740 -> 1341 bytes .../res/drawable/btn_check_on_longpress.png | Bin 4517 -> 1661 bytes .../res/res/drawable/btn_check_on_pressed.png | Bin 1776 -> 1575 bytes .../res/drawable/btn_check_on_selected.png | Bin 1784 -> 1589 bytes core/res/res/drawable/btn_close.xml | 25 + core/res/res/drawable/btn_close_normal.png | Bin 0 -> 1213 bytes core/res/res/drawable/btn_close_pressed.png | Bin 0 -> 1585 bytes .../res/drawable/btn_default_longpress.9.png | Bin 1991 -> 1269 bytes .../res/res/drawable/btn_default_normal.9.png | Bin 964 -> 836 bytes .../drawable/btn_default_normal_disable.9.png | Bin 1048 -> 3452 bytes .../btn_default_normal_disable_focused.9.png | Bin 992 -> 3574 bytes .../res/drawable/btn_default_pressed.9.png | Bin 1495 -> 1134 bytes .../res/drawable/btn_default_selected.9.png | Bin 1473 -> 1117 bytes .../btn_default_small_longpress.9.png | Bin 4559 -> 1066 bytes .../drawable/btn_default_small_normal.9.png | Bin 3690 -> 790 bytes .../btn_default_small_normal_disable.9.png | Bin 4350 -> 721 bytes ...default_small_normal_disable_focused.9.png | Bin 1547 -> 834 bytes .../drawable/btn_default_small_pressed.9.png | Bin 4201 -> 982 bytes .../drawable/btn_default_small_selected.9.png | Bin 4195 -> 1017 bytes .../res/drawable/btn_dropdown_disabled.9.png | Bin 4991 -> 1193 bytes .../res/drawable/btn_dropdown_normal.9.png | Bin 2349 -> 1290 bytes .../res/drawable/btn_dropdown_pressed.9.png | Bin 5394 -> 2025 bytes .../res/drawable/btn_dropdown_selected.9.png | Bin 5460 -> 2014 bytes core/res/res/drawable/btn_keyboard_key.xml | 38 + .../drawable/btn_keyboard_key_longpress.9.png | Bin 0 -> 709 bytes .../btn_keyboard_key_longpress_off.9.png | Bin 0 -> 885 bytes .../btn_keyboard_key_longpress_on.9.png | Bin 0 -> 921 bytes .../drawable/btn_keyboard_key_normal.9.png | Bin 0 -> 737 bytes .../btn_keyboard_key_normal_off.9.png | Bin 0 -> 877 bytes .../drawable/btn_keyboard_key_normal_on.9.png | Bin 0 -> 949 bytes .../drawable/btn_keyboard_key_pressed.9.png | Bin 0 -> 732 bytes .../btn_keyboard_key_pressed_off.9.png | Bin 0 -> 895 bytes .../btn_keyboard_key_pressed_on.9.png | Bin 0 -> 947 bytes core/res/res/drawable/btn_radio_off.png | Bin 2037 -> 1542 bytes .../res/drawable/btn_radio_off_disable.png | Bin 2023 -> 1409 bytes .../btn_radio_off_disable_focused.png | Bin 2659 -> 1839 bytes .../res/drawable/btn_radio_off_longpress.png | Bin 2324 -> 1931 bytes .../res/drawable/btn_radio_off_pressed.png | Bin 2463 -> 1864 bytes .../res/drawable/btn_radio_off_selected.png | Bin 2457 -> 1852 bytes core/res/res/drawable/btn_radio_on.png | Bin 2310 -> 1700 bytes .../res/res/drawable/btn_radio_on_disable.png | Bin 2329 -> 1497 bytes .../drawable/btn_radio_on_disable_focused.png | Bin 2886 -> 1945 bytes .../res/drawable/btn_radio_on_longpress.png | Bin 2365 -> 2051 bytes .../res/res/drawable/btn_radio_on_pressed.png | Bin 2545 -> 1978 bytes .../res/drawable/btn_radio_on_selected.png | Bin 2547 -> 1954 bytes .../drawable/btn_star_big_buttonless_off.png | Bin 0 -> 664 bytes .../drawable/btn_star_big_buttonless_on.png | Bin 0 -> 877 bytes core/res/res/drawable/btn_star_buttonless.xml | 51 + core/res/res/drawable/ic_btn_search.png | Bin 0 -> 1390 bytes .../res/drawable/ic_volume_bluetooth_ad2p.png | Bin 0 -> 2996 bytes .../drawable/ic_volume_bluetooth_in_call.png | Bin 0 -> 2172 bytes core/res/res/drawable/ime_qwerty.png | Bin 0 -> 3052 bytes .../drawable/indicator_check_mark_dark.xml | 10 +- .../drawable/indicator_check_mark_light.xml | 12 +- .../res/drawable/keyboard_background.9.png | Bin 0 -> 203 bytes .../res/drawable/keyboard_key_feedback.xml | 22 + .../keyboard_key_feedback_background.9.png | Bin 0 -> 1182 bytes ...eyboard_key_feedback_more_background.9.png | Bin 0 -> 1385 bytes .../keyboard_popup_panel_background.9.png | Bin 0 -> 996 bytes .../spinner_dropdown_background_down.9.png | Bin 293 -> 350 bytes .../spinner_dropdown_background_up.9.png | Bin 267 -> 347 bytes .../stat_notify_calibrate_compass.png | Bin 1135 -> 0 bytes core/res/res/layout-land/icon_menu_layout.xml | 3 +- core/res/res/layout-port/icon_menu_layout.xml | 3 +- core/res/res/layout/alert_dialog.xml | 6 +- core/res/res/layout/always_use_checkbox.xml | 18 +- core/res/res/layout/icon_menu_item_layout.xml | 6 +- core/res/res/layout/input_method.xml | 46 + .../res/layout/input_method_extract_view.xml | 28 + core/res/res/layout/keyboard_key_preview.xml | 29 + .../res/layout/keyboard_popup_keyboard.xml | 47 + .../keyguard_screen_unlock_landscape.xml | 1 + .../keyguard_screen_unlock_portrait.xml | 1 + core/res/res/layout/list_menu_item_layout.xml | 4 +- core/res/res/layout/preference.xml | 7 +- core/res/res/layout/preference_child.xml | 6 +- .../res/res/layout/preference_information.xml | 3 +- core/res/res/layout/resolve_list_item.xml | 28 +- core/res/res/layout/search_bar.xml | 11 +- core/res/res/layout/select_dialog_item.xml | 1 + .../res/layout/select_dialog_multichoice.xml | 1 + .../res/layout/select_dialog_singlechoice.xml | 2 +- .../res/layout/simple_dropdown_item_1line.xml | 3 +- .../layout/simple_spinner_dropdown_item.xml | 3 +- core/res/res/layout/simple_spinner_item.xml | 7 +- core/res/res/layout/volume_adjust.xml | 6 + core/res/res/raw-de/loaderror.html | 18 + core/res/res/raw-de/nodomain.html | 24 + .../{assets/webkit => res/raw}/loaderror.html | 0 .../{assets/webkit => res/raw}/nodomain.html | 0 core/res/res/values-cs-rCZ/strings.xml | 1372 +- core/res/res/values-de-rDE/strings.xml | 767 - core/res/res/values-de/arrays.xml | 4 + core/res/res/values-de/strings.xml | 698 + core/res/res/values-en-rAU/arrays.xml | 32 + core/res/res/values-en-rAU/strings.xml | 1256 + core/res/res/values-en-rGB/arrays.xml | 32 + core/res/res/values-en-rGB/strings.xml | 1526 +- core/res/res/values-en-rSG/strings.xml | 1256 + core/res/res/values-en-rUS/strings.xml | 1256 + core/res/res/values-es-rUS/strings.xml | 1472 +- core/res/res/values-it-rIT/strings.xml | 818 - core/res/res/values-ja/arrays.xml | 4 + core/res/res/values-ja/strings.xml | 699 + core/res/res/values-mcc204-de/strings.xml | 6 + core/res/res/values-mcc204-ja/strings.xml | 6 + core/res/res/values-mcc204/arrays.xml | 32 + core/res/res/values-mcc204/strings.xml | 25 + core/res/res/values-mcc230-de/strings.xml | 6 + core/res/res/values-mcc230-ja/strings.xml | 6 + core/res/res/values-mcc230/arrays.xml | 32 + core/res/res/values-mcc230/strings.xml | 25 + core/res/res/values-mcc232-de/strings.xml | 6 + core/res/res/values-mcc232-ja/strings.xml | 6 + core/res/res/values-mcc232/arrays.xml | 32 + core/res/res/values-mcc232/strings.xml | 25 + core/res/res/values-mcc234-de/strings.xml | 6 + core/res/res/values-mcc234-ja/strings.xml | 6 + core/res/res/values-mcc234/strings.xml | 25 + core/res/res/values-mcc260/arrays.xml | 32 + core/res/res/values-mcc260/strings.xml | 25 + core/res/res/values-mcc262-de/strings.xml | 6 + core/res/res/values-mcc262-ja/strings.xml | 6 + core/res/res/values-mcc262/arrays.xml | 32 + core/res/res/values-mcc262/strings.xml | 25 + core/res/res/values-nl-rNL/strings.xml | 1457 +- core/res/res/values/arrays.xml | 7 +- core/res/res/values/attrs.xml | 422 +- core/res/res/values/attrs_manifest.xml | 71 +- core/res/res/values/colors.xml | 2 + core/res/res/values/ids.xml | 12 + core/res/res/values/public.xml | 132 +- core/res/res/values/strings.xml | 1384 +- core/res/res/values/styles.xml | 39 +- core/res/res/values/themes.xml | 62 +- core/res/res/xml/autotext.xml | 7 + core/res/res/xml/time_zones_by_country.xml | 985 +- data/fonts/Android.mk | 7 +- data/fonts/DroidSans-Bold.ttf | Bin 150804 -> 191032 bytes data/fonts/DroidSans.ttf | Bin 149076 -> 190044 bytes data/fonts/DroidSansFallback.ttf | Bin 3022632 -> 3081908 bytes data/fonts/DroidSansMono.ttf | Bin 78296 -> 117072 bytes data/fonts/DroidSerif-Bold.ttf | Bin 172012 -> 184836 bytes data/fonts/DroidSerif-BoldItalic.ttf | Bin 137212 -> 189916 bytes data/fonts/DroidSerif-Italic.ttf | Bin 155220 -> 177176 bytes data/fonts/DroidSerif-Regular.ttf | Bin 162864 -> 172532 bytes data/localization/import-from-xtb | 84 + docs/html/community/groups.jd | 98 - docs/html/community/index.jd | 91 +- docs/html/guide/appendix/faq/commontasks.jd | 129 +- docs/html/guide/appendix/faq/framework.jd | 38 +- .../guide/appendix/faq/licensingandoss.jd | 2 +- .../guide/appendix/faq/troubleshooting.jd | 20 +- docs/html/guide/appendix/g-app-intents.jd | 5 +- docs/html/guide/appendix/glossary.jd | 392 +- docs/html/guide/appendix/index.jd | 4 +- docs/html/guide/basics/android-sdk.jd | 11 + docs/html/guide/basics/app-framework.jd | 4 + docs/html/guide/basics/appmodel.jd | 17 +- docs/html/guide/basics/index.jd | 58 - docs/html/guide/basics/what-is-android.jd | 18 +- docs/html/guide/developing/aapt.jd | 20 - docs/html/guide/developing/adb.jd | 668 - docs/html/guide/developing/aidl.jd | 301 - docs/html/guide/developing/ddms.jd | 250 - docs/html/guide/developing/debug-tasks.jd | 41 +- .../guide/developing/develop-and-debug.jd | 675 - docs/html/guide/developing/draw9patch.jd | 61 - docs/html/guide/developing/eclipse-adt.jd | 7 +- docs/html/guide/developing/emulator.jd | 1724 - .../html/guide/developing/hierarchy-viewer.jd | 99 - .../guide/developing/instrumentation/index.jd | 6 +- .../instrumentation/inst-framework.jd | 32 +- .../instrumentation/inst-testing.jd | 29 - docs/html/guide/developing/monkey.jd | 240 - docs/html/guide/developing/other-ide.jd | 30 +- docs/html/guide/developing/othertools.jd | 104 - docs/html/guide/developing/tools.jd | 112 - docs/html/guide/developing/tools/adb.jd | 49 +- docs/html/guide/developing/tools/adt.jd | 154 + .../guide/developing/tools/adt_download.jd | 65 + docs/html/guide/developing/tools/aidl.jd | 9 +- docs/html/guide/developing/tools/ddms.jd | 16 +- .../html/guide/developing/tools/draw9patch.jd | 11 +- docs/html/guide/developing/tools/emulator.jd | 148 +- .../developing/tools/hierarchy-viewer.jd | 5 +- docs/html/guide/developing/tools/index.jd | 116 +- docs/html/guide/developing/tools/monkey.jd | 4 +- .../html/guide/developing/tools/othertools.jd | 8 +- docs/html/guide/developing/tools/traceview.jd | 6 +- docs/html/guide/developing/traceview.jd | 310 - docs/html/guide/guide_toc.cs | 188 +- docs/html/guide/index.jd | 62 +- .../guide/practices/design/responsiveness.jd | 2 +- .../guide/practices/design/seamlessness.jd | 2 +- docs/html/guide/publishing/app-signing.jd | 489 + docs/html/guide/publishing/preparing.jd | 252 + docs/html/guide/publishing/publishing.jd | 250 + docs/html/guide/publishing/versioning.jd | 135 + docs/html/guide/samples/index.jd | 8 +- .../guide/topics/data/contentproviders.jd | 608 - docs/html/guide/topics/data/data-storage.jd | 107 +- docs/html/guide/topics/data/index.html | 9 + docs/html/guide/topics/drawing/index.html | 9 + docs/html/guide/topics/fundamentals.jd | 1411 + .../html/guide/topics/graphics/2d-graphics.jd | 459 + docs/html/guide/topics/graphics/index.jd | 21 + docs/html/guide/topics/graphics/opengl.jd | 56 + docs/html/guide/topics/intents/index.html | 9 + .../guide/topics/intents/intents-filters.jd | 562 +- docs/html/guide/topics/location/geo/mapkey.jd | 28 + docs/html/guide/topics/location/index.jd | 109 + docs/html/guide/topics/manifest/manifest.jd | 3212 +- docs/html/guide/topics/media/index.jd | 188 + docs/html/guide/topics/media/media.jd | 1 + .../topics/providers/content-providers.jd | 271 +- .../topics/resources/available-resources.jd | 434 +- docs/html/guide/topics/resources/index.jd | 40 + .../guide/topics/resources/resources-i18n.jd | 93 +- docs/html/guide/topics/security/security.jd | 37 +- .../guide/topics/sensors/accelerometer.jd | 18 + docs/html/guide/topics/sensors/camera.jd | 18 + docs/html/guide/topics/sensors/compass.jd | 18 + docs/html/guide/topics/sensors/index.jd | 13 + docs/html/guide/topics/views/binding.jd | 56 +- .../guide/topics/views/custom-components.jd | 563 + docs/html/guide/topics/views/custom-views.jd | 148 +- .../guide/topics/views/declaring-layout.jd | 228 + .../guide/topics/views/how-android-draws.jd | 90 + docs/html/guide/topics/views/index.jd | 235 +- .../topics/views/{hierarchy.jd => intro.jd} | 4 +- docs/html/guide/topics/views/layout.jd | 177 +- docs/html/guide/topics/views/themes.jd | 137 +- docs/html/guide/topics/views/ui-events.jd | 94 +- docs/html/guide/topics/views/ui-xml.jd | 2 + docs/html/guide/topics/wireless/bluetooth.jd | 18 + docs/html/guide/topics/wireless/index.jd | 19 + docs/html/guide/topics/wireless/wifi.jd | 18 + docs/html/guide/tutorials/hello-world.jd | 350 +- .../guide/tutorials/images/hello_world_0.png | Bin 32885 -> 30614 bytes .../guide/tutorials/images/hello_world_1.png | Bin 42372 -> 38174 bytes .../guide/tutorials/images/hello_world_2.png | Bin 76964 -> 67830 bytes .../guide/tutorials/images/hello_world_3.png | Bin 60105 -> 60750 bytes .../guide/tutorials/images/hello_world_4.png | Bin 62820 -> 61711 bytes .../guide/tutorials/images/hello_world_5.png | Bin 10022 -> 6244 bytes .../guide/tutorials/images/hello_world_8.png | Bin 23668 -> 10993 bytes .../guide/tutorials/images/hello_world_9.png | Bin 38390 -> 25933 bytes docs/html/guide/tutorials/notepad/index.jd | 142 + .../guide/tutorials/notepad/notepad-ex1.jd | 38 +- .../guide/tutorials/notepad/notepad-ex2.jd | 22 +- .../guide/tutorials/notepad/notepad-ex3.jd | 17 +- .../tutorials/notepad/notepad-extra-credit.jd | 12 +- .../tutorials/views/hello-autocomplete.jd | 4 +- .../guide/tutorials/views/hello-datepicker.jd | 4 +- .../guide/tutorials/views/hello-formstuff.jd | 3 +- .../guide/tutorials/views/hello-gallery.jd | 4 +- .../guide/tutorials/views/hello-gridview.jd | 3 +- .../tutorials/views/hello-linearlayout.jd | 4 +- .../guide/tutorials/views/hello-listview.jd | 3 +- .../guide/tutorials/views/hello-mapview.jd | 42 +- .../tutorials/views/hello-relativelayout.jd | 6 +- .../guide/tutorials/views/hello-spinner.jd | 3 +- .../tutorials/views/hello-tablelayout.jd | 5 +- .../guide/tutorials/views/hello-tabwidget.jd | 124 + .../guide/tutorials/views/hello-timepicker.jd | 4 +- .../guide/tutorials/views/hello-webview.jd | 3 +- .../views/images/hello-tabwidget.png | Bin 0 -> 2117 bytes .../views/{hello-views-index.jd => index.jd} | 14 +- docs/html/images/activity_lifecycle.png | Bin 65850 -> 66148 bytes docs/html/images/draw9patch-bad.png | Bin docs/html/images/draw9patch-norm.png | Bin docs/html/images/hello_world_9.png | Bin 25933 -> 28538 bytes docs/html/images/hierarchyviewer-layout.png | Bin .../images/hierarchyviewer-pixelperfect.png | Bin docs/html/images/layoutparams.png | Bin 40397 -> 42180 bytes .../html/images/mediaplayer_state_diagram.gif | Bin 0 -> 23582 bytes .../images/mediarecorder_state_diagram.gif | Bin 20271 -> 21124 bytes docs/html/images/service_lifecycle.png | Bin 0 -> 59286 bytes docs/html/images/zippy_bullet.gif | Bin docs/html/images/zippy_closed.gif | Bin docs/html/images/zippy_open.gif | Bin docs/html/index.jd | 109 +- docs/html/sdk/1.0_r1/RELEASENOTES.jd | 541 +- docs/html/sdk/1.0_r1/download.jd | 26 - docs/html/sdk/1.0_r1/download_list.jd | 49 - docs/html/sdk/1.0_r1/download_previous.jd | 188 - docs/html/sdk/1.0_r1/installing.jd | 211 +- docs/html/sdk/1.0_r1/requirements.jd | 40 + docs/html/sdk/1.0_r1/sdk_toc.cs | 1 - docs/html/sdk/1.0_r1/upgrading.jd | 22 +- docs/html/sdk/sdk_toc.cs | 38 +- .../sdk/{1.0_r1/terms_body.html => terms.jd} | 8 +- docs/html/search.jd | 15 +- graphics/java/android/graphics/Rect.java | 9 +- graphics/java/android/graphics/RectF.aidl | 19 + graphics/java/android/graphics/RectF.java | 54 +- .../graphics/drawable/AnimationDrawable.java | 56 +- .../graphics/drawable/BitmapDrawable.java | 1 - .../graphics/drawable/ColorDrawable.java | 3 +- .../graphics/drawable/LayerDrawable.java | 122 +- .../graphics/drawable/TransitionDrawable.java | 27 +- im/java/android/im/BrandingResourceIDs.java | 52 + im/java/android/im/IImPlugin.aidl | 69 + im/java/android/im/ImPluginConsts.java | 27 + include/GLES/eglnatives.h | 3 +- include/media/AudioRecord.h | 198 +- include/media/AudioSystem.h | 12 +- include/media/AudioTrack.h | 256 +- include/media/IAudioFlinger.h | 12 +- include/media/IMediaMetadataRetriever.h | 56 + include/media/IMediaPlayer.h | 1 - include/media/IMediaPlayerService.h | 10 +- include/media/IMediaRecorder.h | 67 + .../media/MediaMetadataRetrieverInterface.h | 52 + include/media/MediaPlayerInterface.h | 8 +- include/media/PVMediaRecorder.h | 60 + include/media/PVMetadataRetriever.h | 51 + include/media/PVPlayer.h | 12 +- include/media/ToneGenerator.h | 9 +- include/media/mediametadataretriever.h | 85 +- include/media/mediaplayer.h | 28 +- include/media/mediarecorder.h | 123 +- include/media/mediascanner.h | 24 +- include/private/media/AudioTrackShared.h | 36 +- include/private/media/VideoFrame.h | 127 + include/private/opengles/gl_context.h | 7 + include/ui/BlitHardware.h | 143 - include/ui/Camera.h | 61 +- include/ui/CameraHardwareInterface.h | 72 +- include/ui/EGLDisplaySurface.h | 5 +- include/ui/ICamera.h | 14 +- include/ui/IOverlay.h | 55 + include/ui/ISurface.h | 4 + include/ui/ISurfaceFlingerClient.h | 1 - include/ui/KeycodeLabels.h | 18 +- include/ui/Overlay.h | 88 + include/ui/PixelFormat.h | 1 + include/ui/Region.h | 4 +- include/ui/Surface.h | 21 +- include/utils/IPCThreadState.h | 3 + include/utils/MemoryHeapPmem.h | 25 +- include/utils/ResourceTypes.h | 49 +- include/utils/TimeUtils.h | 5 +- include/utils/string_array.h | 13 + libs/audioflinger/A2dpAudioInterface.cpp | 186 + libs/audioflinger/A2dpAudioInterface.h | 107 + libs/audioflinger/Android.mk | 7 +- libs/audioflinger/AudioDumpInterface.cpp | 49 +- libs/audioflinger/AudioDumpInterface.h | 53 +- libs/audioflinger/AudioFlinger.cpp | 710 +- libs/audioflinger/AudioFlinger.h | 101 +- libs/audioflinger/AudioHardwareGeneric.cpp | 46 +- libs/audioflinger/AudioHardwareGeneric.h | 30 +- libs/audioflinger/AudioHardwareInterface.cpp | 59 +- libs/audioflinger/AudioHardwareStub.cpp | 36 +- libs/audioflinger/AudioHardwareStub.h | 28 +- libs/audioflinger/AudioMixer.cpp | 278 +- libs/audioflinger/AudioMixer.h | 18 +- libs/audioflinger/AudioResampler.cpp | 350 +- libs/audioflinger/AudioResamplerCubic.cpp | 18 +- libs/audioflinger/AudioResamplerSinc.cpp | 292 +- libs/audioflinger/AudioResamplerSinc.h | 23 +- libs/surfaceflinger/Android.mk | 1 + .../DisplayHardware/DisplayHardware.cpp | 46 +- .../DisplayHardware/DisplayHardware.h | 10 +- .../DisplayHardware/DisplayHardwareBase.cpp | 20 +- .../GPUHardware/GPUHardware.cpp | 608 +- libs/surfaceflinger/GPUHardware/GPUHardware.h | 77 +- libs/surfaceflinger/Layer.cpp | 33 +- libs/surfaceflinger/LayerBase.cpp | 37 +- libs/surfaceflinger/LayerBase.h | 14 +- libs/surfaceflinger/LayerBlur.cpp | 10 +- libs/surfaceflinger/LayerBuffer.cpp | 52 +- libs/surfaceflinger/LayerBuffer.h | 6 +- libs/surfaceflinger/LayerDim.cpp | 4 +- libs/surfaceflinger/SurfaceFlinger.cpp | 79 +- libs/surfaceflinger/SurfaceFlinger.h | 9 +- libs/surfaceflinger/VRamHeap.cpp | 81 +- libs/surfaceflinger/VRamHeap.h | 22 +- libs/ui/Android.mk | 3 +- libs/ui/BlitHardware.cpp | 446 - libs/ui/Camera.cpp | 119 +- libs/ui/EGLDisplaySurface.cpp | 35 +- libs/ui/EGLNativeWindowSurface.cpp | 7 +- libs/ui/EventHub.cpp | 13 +- libs/ui/ICamera.cpp | 82 +- libs/ui/ICameraClient.cpp | 16 +- libs/ui/IOverlay.cpp | 87 + libs/ui/ISurface.cpp | 22 + libs/ui/ISurfaceFlingerClient.cpp | 4 +- libs/ui/Overlay.cpp | 145 + libs/ui/Surface.cpp | 7 +- libs/ui/Time.cpp | 4 +- libs/utils/Android.mk | 8 + libs/utils/CallStack.cpp | 58 +- libs/utils/IPCThreadState.cpp | 27 +- libs/utils/LogSocket.cpp | 2 +- libs/utils/MemoryDealer.cpp | 22 +- libs/utils/MemoryHeapPmem.cpp | 54 +- libs/utils/ResourceTypes.cpp | 41 +- libs/utils/futex_synchro.c | 6 +- location/java/android/location/Geocoder.java | 2 +- .../java/android/location/GpsSatellite.java | 117 + location/java/android/location/GpsStatus.java | 200 + .../android/location/GpsStatusListener.java | 58 - .../android/location/ILocationManager.aidl | 3 + .../android/location/LocationManager.java | 265 +- .../android/internal/location/CellState.java | 187 +- .../location/GpsLocationProvider.java | 18 +- .../internal/location/LocationCache.java | 53 +- .../internal/location/LocationCollector.java | 6 +- .../internal/location/LocationMasfClient.java | 149 +- .../location/NetworkLocationProvider.java | 4 +- .../location/protocol/GDebugProfile.java | 1 + .../protocol/GdebugprofileMessageTypes.java | 4 +- media/java/android/media/AmrInputStream.java | 141 + media/java/android/media/AudioFormat.java | 51 + media/java/android/media/AudioManager.java | 61 +- media/java/android/media/AudioRecord.java | 721 + media/java/android/media/AudioService.java | 53 +- media/java/android/media/AudioSystem.java | 17 +- media/java/android/media/AudioTrack.java | 934 + .../android/media/MediaMetadataRetriever.java | 108 +- media/java/android/media/MediaPlayer.java | 552 +- media/java/android/media/MediaRecorder.java | 24 +- media/java/android/media/MediaScanner.java | 11 +- media/java/android/media/Ringtone.java | 13 +- media/java/android/media/RingtoneManager.java | 51 +- media/java/android/media/SoundPool.java | 13 +- media/jni/Android.mk | 11 +- media/jni/android_media_AmrInputStream.cpp | 184 + .../android_media_MediaMetadataRetriever.cpp | 229 +- media/jni/android_media_MediaPlayer.cpp | 18 + media/jni/android_media_MediaRecorder.cpp | 136 +- media/jni/android_media_MediaScanner.cpp | 20 + media/jni/soundpool/SoundPool.cpp | 558 +- media/jni/soundpool/SoundPool.h | 73 +- media/libdrm/mobile1/src/jni/drm1_jni.c | 2 +- .../mobile2/src/util/ustl-1.0/bktrace.cpp | 2 +- media/libmedia/Android.mk | 3 + media/libmedia/AudioRecord.cpp | 382 +- media/libmedia/AudioSystem.cpp | 56 +- media/libmedia/AudioTrack.cpp | 684 +- media/libmedia/IAudioFlinger.cpp | 74 +- media/libmedia/IMediaMetadataRetriever.cpp | 218 + media/libmedia/IMediaPlayer.cpp | 20 - media/libmedia/IMediaPlayerService.cpp | 49 +- media/libmedia/IMediaRecorder.cpp | 376 + media/libmedia/ToneGenerator.cpp | 145 +- media/libmedia/mediametadataretriever.cpp | 228 +- media/libmedia/mediaplayer.cpp | 126 +- media/libmedia/mediarecorder.cpp | 518 + media/libmediaplayerservice/Android.mk | 3 + .../MediaPlayerService.cpp | 136 +- .../MediaPlayerService.h | 40 +- .../MediaRecorderClient.cpp | 251 + .../MediaRecorderClient.h | 64 + .../MetadataRetrieverClient.cpp | 250 + .../MetadataRetrieverClient.h | 71 + media/libmediaplayerservice/MidiFile.cpp | 2 +- media/libmediaplayerservice/VorbisPlayer.cpp | 2 +- media/tests/MediaFrameworkTest/Android.mk | 12 + .../MediaFrameworkTest/AndroidManifest.xml | 46 + .../MediaFrameworkTest/res/drawable/icon.png | Bin 0 -> 6094 bytes .../res/layout/movie_view.xml | 57 + .../res/layout/surface_view.xml | 43 + .../MediaFrameworkTest/res/raw/shortmp3.mp3 | Bin 0 -> 3736 bytes .../MediaFrameworkTest/res/raw/testmidi.mid | Bin 0 -> 38964 bytes .../MediaFrameworkTest/res/raw/testmp3.mp3 | Bin 0 -> 249241 bytes .../MediaFrameworkTest/res/values/strings.xml | 5 + .../MediaFrameworkPerfTestRunner.java | 51 + .../MediaFrameworkTest.java | 149 + .../MediaFrameworkTestRunner.java | 59 + .../MediaFrameworkUnitTestRunner.java | 91 + .../mediaframeworktest/MediaNames.java | 479 + .../functional/CameraTest.java | 260 + .../functional/CodecTest.java | 577 + .../functional/MediaMetadataTest.java | 255 + .../functional/MediaPlayerApiTest.java | 436 + .../functional/MediaRecorderTest.java | 276 + .../functional/SimTonesTest.java | 73 + .../functional/TonesAutoTest.java | 180 + .../performance/MediaPlayerPerformance.java | 159 + .../unit/MediaMetadataRetrieverTest.java | 242 + ...PlayerGetCurrentPositionStateUnitTest.java | 68 + .../MediaPlayerGetDurationStateUnitTest.java | 68 + ...ediaPlayerGetVideoHeightStateUnitTest.java | 68 + ...MediaPlayerGetVideoWidthStateUnitTest.java | 68 + .../MediaPlayerIsPlayingStateUnitTest.java | 68 + .../unit/MediaPlayerMethodUnderTest.java | 27 + .../unit/MediaPlayerPauseStateUnitTest.java | 68 + .../unit/MediaPlayerResetStateUnitTest.java | 68 + .../unit/MediaPlayerSeekToStateUnitTest.java | 68 + ...PlayerSetAudioStreamTypeStateUnitTest.java | 69 + .../MediaPlayerSetLoopingStateUnitTest.java | 65 + .../MediaPlayerSetVolumeStateUnitTest.java | 68 + .../unit/MediaPlayerStartStateUnitTest.java | 69 + .../unit/MediaPlayerStateErrors.java | 47 + .../MediaPlayerStateUnitTestTemplate.java | 506 + .../unit/MediaPlayerStopStateUnitTest.java | 63 + .../unit/MediaRecorderMethodUnderTest.java | 27 + .../MediaRecorderPrepareStateUnitTest.java | 74 + .../unit/MediaRecorderResetStateUnitTest.java | 69 + ...aRecorderSetAudioEncoderStateUnitTest.java | 69 + ...iaRecorderSetAudioSourceStateUnitTest.java | 69 + ...diaRecorderSetOutputFileStateUnitTest.java | 68 + ...aRecorderSetOutputFormatStateUnitTest.java | 69 + .../unit/MediaRecorderStartStateUnitTest.java | 69 + .../unit/MediaRecorderStateErrors.java | 40 + .../MediaRecorderStateUnitTestTemplate.java | 333 + .../unit/MediaRecorderStopStateUnitTest.java | 69 + opengl/java/android/opengl/GLDebugHelper.java | 2 +- opengl/java/android/opengl/GLSurfaceView.java | 661 + opengl/java/android/opengl/GLU.java | 15 +- opengl/libGLES_CM/gl_wrapper.cpp | 125 +- opengl/libagl/TextureObjectManager.cpp | 4 +- opengl/libagl/array.cpp | 4 +- opengl/libagl/egl.cpp | 197 +- opengl/libagl/light.cpp | 8 +- opengl/libagl/matrix.cpp | 5 +- opengl/libagl/primitives.cpp | 92 +- opengl/libagl/vertex.cpp | 2 +- opengl/tests/Android.mk | 1 + opengl/tests/angeles/Android.mk | 17 + .../tests/angeles/MODULE_LICENSE_BSD_OR_LGPL | 0 opengl/tests/angeles/README.txt | 77 + opengl/tests/angeles/app-linux.c | 222 + opengl/tests/angeles/app.h | 56 + opengl/tests/angeles/cams.h | 65 + opengl/tests/angeles/demo.c | 792 + opengl/tests/angeles/gpustate.c | 39 + opengl/tests/angeles/include/GLES/egl.h | 229 + opengl/tests/angeles/include/GLES/egltypes.h | 20 + opengl/tests/angeles/include/GLES/gl.h | 584 + opengl/tests/angeles/license-BSD.txt | 34 + opengl/tests/angeles/license-LGPL.txt | 504 + opengl/tests/angeles/license.txt | 19 + opengl/tests/angeles/shapes.h | 59 + opengl/tests/filter/Android.mk | 16 + opengl/tests/filter/filter.c | 125 + opengl/tests/finish/Android.mk | 16 + opengl/tests/finish/finish.c | 221 + opengl/tests/sfsim/Android.mk | 15 + opengl/tests/sfsim/egl_surface.cpp | 346 + opengl/tests/sfsim/egl_surface.h | 113 + opengl/tests/sfsim/sfsim.c | 112 + opengl/tests/textures/Android.mk | 16 + opengl/tests/textures/textures.c | 107 + opengl/tests/tritex/Android.mk | 16 + opengl/tests/tritex/tritex.c | 271 + opengl/tools/glgen/gen | 99 + opengl/tools/glgen/glspec-1.0 | 106 + opengl/tools/glgen/glspec-1.0ext | 1 + opengl/tools/glgen/glspec-1.1 | 42 + opengl/tools/glgen/glspec-1.1ext | 16 + opengl/tools/glgen/glspec-1.1extpack | 38 + opengl/tools/glgen/glspec-checks | 59 + opengl/tools/glgen/src/CFunc.java | 155 + opengl/tools/glgen/src/CType.java | 85 + opengl/tools/glgen/src/CodeEmitter.java | 8 + opengl/tools/glgen/src/GenerateGL.java | 164 + opengl/tools/glgen/src/JFunc.java | 148 + opengl/tools/glgen/src/JType.java | 139 + opengl/tools/glgen/src/JniCodeEmitter.java | 1086 + opengl/tools/glgen/src/ParameterChecker.java | 28 + .../tools/glgen/stubs/GL10ExtHeader.java-if | 22 + opengl/tools/glgen/stubs/GL10Header.java-if | 259 + .../tools/glgen/stubs/GL11ExtHeader.java-if | 40 + .../stubs/GL11ExtensionPackHeader.java-if | 108 + opengl/tools/glgen/stubs/GL11Header.java-if | 145 + .../glgen/stubs/GL11ImplHeader.java-impl | 30 + opengl/tools/glgen/stubs/GLCHeader.cpp | 129 + opengl/tools/glgen/stubs/GLHeader.java-if | 22 + .../tools/glgen/stubs/GLImplHeader.java-impl | 48 + opengl/tools/glgen/stubs/glGetString.cpp | 10 + .../tools/glgen/stubs/glGetString.java-10-if | 4 + opengl/tools/glgen/stubs/glGetString.java-if | 4 + .../tools/glgen/stubs/glGetString.java-impl | 16 + .../tools/glgen/stubs/glGetString.nativeReg | 1 + packages/SettingsProvider/AndroidManifest.xml | 8 + .../SettingsProvider/res/values/strings.xml | 23 + .../providers/settings/DatabaseHelper.java | 368 +- .../providers/settings/SettingsProvider.java | 28 +- preloaded-classes | 20 +- .../android/server/AlarmManagerService.java | 107 +- .../com/android/server/BatteryService.java | 29 +- .../android/server/ConnectivityService.java | 99 +- .../server/DeviceStorageMonitorService.java | 294 + .../com/android/server/HeadsetObserver.java | 2 +- .../java/com/android/server/InputDevice.java | 29 +- .../server/InputMethodManagerService.java | 1305 + .../com/android/server/KeyInputQueue.java | 3 +- .../server/LocationManagerService.java | 401 +- .../java/com/android/server/MountService.java | 28 +- .../server/NotificationManagerService.java | 2 +- .../android/server/PackageManagerService.java | 1294 +- .../android/server/PowerManagerService.java | 78 +- .../com/android/server/SensorService.java | 125 +- .../java/com/android/server/SystemServer.java | 104 +- .../com/android/server/TelephonyRegistry.java | 28 +- .../java/com/android/server/Watchdog.java | 10 +- .../java/com/android/server/WifiService.java | 220 +- .../android/server/WifiWatchdogService.java | 121 +- .../android/server/WindowManagerService.java | 1285 +- .../server/am/ActivityManagerService.java | 224 +- .../com/android/server/am/AppErrorDialog.java | 2 +- .../server/am/AppNotRespondingDialog.java | 2 +- .../com/android/server/am/BatteryStats.java | 1146 - .../server/am/BatteryStatsService.java | 130 + .../com/android/server/am/ProcessRecord.java | 41 +- .../com/android/server/am/ServiceRecord.java | 6 +- .../com/android/server/status/DateView.java | 2 +- .../android/server/status/StatusBarIcon.java | 4 +- .../server/status/StatusBarPolicy.java | 54 +- .../server/status/StatusBarService.java | 93 +- .../JapanesePhoneNumberFormatter.java | 216 + .../telephony/NeighboringCellInfo.aidl | 20 + .../telephony/NeighboringCellInfo.java | 123 + .../android/telephony/PhoneNumberUtils.java | 145 +- .../android/telephony/TelephonyManager.java | 204 +- .../android/telephony/gsm/SmsManager.java | 12 +- .../android/telephony/gsm/SmsMessage.java | 27 +- .../internal/telephony/CallerInfo.java | 38 +- .../telephony/CallerInfoAsyncQuery.java | 7 +- .../internal/telephony/ITelephony.aidl | 27 +- .../telephony/PhoneStateIntentReceiver.java | 11 +- .../internal/telephony/TelephonyIntents.java | 20 - .../telephony/TelephonyProperties.java | 14 +- .../internal/telephony/gsm/CallTracker.java | 51 +- .../telephony/gsm/CommandsInterface.java | 6 +- .../telephony/gsm/DataConnectionTracker.java | 323 +- .../internal/telephony/gsm/GSMConnection.java | 53 +- .../internal/telephony/gsm/GSMPhone.java | 128 +- .../internal/telephony/gsm/GsmAlphabet.java | 4 +- .../internal/telephony/gsm/GsmMmiCode.java | 32 +- .../internal/telephony/gsm/MccTable.java | 80 +- .../internal/telephony/gsm/PdpConnection.java | 27 +- .../android/internal/telephony/gsm/RIL.java | 414 +- .../internal/telephony/gsm/SIMRecords.java | 119 +- .../internal/telephony/gsm/SMSDispatcher.java | 14 +- .../telephony/gsm/ServiceStateTracker.java | 198 +- .../internal/telephony/gsm/SimException.java | 25 + .../internal/telephony/gsm/SimUtils.java | 147 + .../telephony/gsm/stk/AppInterface.java | 291 +- .../internal/telephony/gsm/stk/BerTlv.java | 21 +- .../telephony/gsm/stk/CommandDetails.java | 106 + .../telephony/gsm/stk/CommandListener.java | 187 - .../telephony/gsm/stk/CommandParams.java | 168 +- .../gsm/stk/CommandParamsFactory.java | 870 + .../telephony/gsm/stk/ComprehensionTlv.java | 8 +- .../internal/telephony/gsm/stk/Duration.java | 29 +- .../telephony/gsm/stk/IconLoader.java | 45 +- .../internal/telephony/gsm/stk/Input.java | 97 + .../internal/telephony/gsm/stk/Item.java | 2 + .../internal/telephony/gsm/stk/Menu.java | 46 +- .../telephony/gsm/stk/ResponseData.java | 140 + .../telephony/gsm/stk/ResultCode.java | 11 +- .../telephony/gsm/stk/RilMessageDecoder.java | 145 + .../internal/telephony/gsm/stk/Service.java | 2534 +- .../telephony/gsm/stk/StkAppInstaller.java | 61 - .../gsm/stk/StkAppStateReceiver.java | 51 - .../telephony/gsm/stk/StkCmdMessage.java | 175 + .../internal/telephony/gsm/stk/StkLog.java | 41 + .../telephony/gsm/stk/StkResponseMessage.java | 54 + .../telephony/gsm/stk/TextMessage.java | 71 + .../internal/telephony/gsm/stk/Tone.java | 26 +- .../telephony/gsm/stk/ToneSettings.java | 62 + .../telephony/gsm/stk/ValueParser.java | 340 + .../telephony/test/ModelInterpreter.java | 43 +- .../telephony/test/SimulatedCommands.java | 46 +- .../telephony/test/SimulatedGsmCallState.java | 8 +- .../test/ActivityInstrumentationTestCase.java | 5 + .../ActivityInstrumentationTestCase2.java | 174 + .../android/test/AndroidTestRunner.java | 8 + .../android/test/DatabaseTestUtils.java | 57 + .../test/InstrumentationCoreTestRunner.java | 43 + .../test/InstrumentationTestRunner.java | 387 +- .../android/test/NoExecTestResult.java | 39 + .../android/test/ProviderTestCase.java | 10 +- .../android/test/ProviderTestCase2.java | 82 + .../test/mock/MockContentResolver.java | 7 +- .../android/test/mock/MockPackageManager.java | 8 + .../android/test/suitebuilder/TestMethod.java | 14 +- .../test/suitebuilder/TestPredicates.java | 6 + .../test/suitebuilder/TestSuiteBuilder.java | 48 +- tests/AndroidTests/Android.mk | 22 + tests/AndroidTests/AndroidManifest.xml | 226 + tests/AndroidTests/DisabledTestApp/Android.mk | 12 + .../DisabledTestApp/AndroidManifest.xml | 13 + .../disabled_app/EnabledActivity.java | 27 + tests/AndroidTests/EnabledTestApp/Android.mk | 12 + .../EnabledTestApp/AndroidManifest.xml | 37 + .../enabled_app/DisabledActivity.java | 27 + .../enabled_app/DisabledProvider.java | 54 + .../enabled_app/DisabledReceiver.java | 32 + .../enabled_app/DisabledService.java | 32 + .../enabled_app/EnabledActivity.java | 27 + .../enabled_app/EnabledProvider.java | 54 + .../enabled_app/EnabledReceiver.java | 32 + .../enabled_app/EnabledService.java | 32 + tests/AndroidTests/MODULE_LICENSE_APACHE2 | 0 tests/AndroidTests/NOTICE | 190 + tests/AndroidTests/assets/text.txt | 1 + .../AndroidTests/res/drawable/test128x96.png | Bin 0 -> 21474 bytes tests/AndroidTests/res/drawable/test16x12.png | Bin 0 -> 707 bytes .../AndroidTests/res/drawable/test256x192.png | Bin 0 -> 78630 bytes .../AndroidTests/res/drawable/test320x240.png | Bin 0 -> 39533 bytes tests/AndroidTests/res/drawable/test32x24.png | Bin 0 -> 1841 bytes tests/AndroidTests/res/drawable/test64x48.png | Bin 0 -> 6020 bytes tests/AndroidTests/res/layout/layout_five.xml | 22 + tests/AndroidTests/res/layout/layout_four.xml | 20 + tests/AndroidTests/res/layout/layout_one.xml | 20 + tests/AndroidTests/res/layout/layout_six.xml | 27 + tests/AndroidTests/res/layout/layout_tag.xml | 23 + .../AndroidTests/res/layout/layout_three.xml | 27 + tests/AndroidTests/res/layout/layout_two.xml | 23 + tests/AndroidTests/res/raw/calendarjs.txt | 1 + tests/AndroidTests/res/raw/calendarjsgz.jsgz | Bin 0 -> 1956 bytes tests/AndroidTests/res/raw/calendarxml.xml | 38 + .../AndroidTests/res/raw/calendarxmlgz.xmlgz | Bin 0 -> 2412 bytes tests/AndroidTests/res/raw/medium.xml | 27 + tests/AndroidTests/res/raw/small.xml | 20 + tests/AndroidTests/res/raw/text.txt | 1 + tests/AndroidTests/res/raw/youtube.xml | 1852 + .../res/values-12key/configVarying.xml | 26 + .../res/values-320x200/configVarying.xml | 26 + .../res/values-480x320/configVarying.xml | 26 + tests/AndroidTests/res/values-cs/strings.xml | 25 + .../res/values-dpad/configVarying.xml | 22 + .../res/values-finger/configVarying.xml | 26 + .../res/values-keysexposed/configVarying.xml | 22 + .../res/values-keyshidden/configVarying.xml | 22 + .../res/values-mcc111/configVarying.xml | 26 + .../res/values-mnc222/configVarying.xml | 26 + .../res/values-nokeys/configVarying.xml | 22 + .../res/values-nonav/configVarying.xml | 22 + .../res/values-notouch/configVarying.xml | 26 + .../res/values-qwerty/configVarying.xml | 22 + .../res/values-stylus/configVarying.xml | 26 + .../res/values-trackball/configVarying.xml | 22 + .../res/values-wheel/configVarying.xml | 22 + .../res/values-xx-rYY/configVarying.xml | 26 + .../res/values-xx/configVarying.xml | 26 + tests/AndroidTests/res/values/arrays.xml | 42 + tests/AndroidTests/res/values/attrs.xml | 44 + tests/AndroidTests/res/values/bools.xml | 20 + .../AndroidTests/res/values/configVarying.xml | 27 + tests/AndroidTests/res/values/dimens.xml | 42 + tests/AndroidTests/res/values/strings.xml | 54 + tests/AndroidTests/res/values/styles.xml | 46 + tests/AndroidTests/res/xml/calendar.xml | 38 + tests/AndroidTests/res/xml/metadata.xml | 23 + tests/AndroidTests/res/xml/metadata_app.xml | 24 + tests/AndroidTests/res/xml/searchable.xml | 21 + tests/AndroidTests/run_test.sh | 4 + .../unit_tests/AndroidPerformanceTests.java | 39 + .../com/android/unit_tests/AndroidTests.java | 32 + .../android/unit_tests/ApacheHttpTests.java | 13 + .../com/android/unit_tests/AppCacheTest.java | 654 + .../com/android/unit_tests/ArrayListTest.java | 327 + .../com/android/unit_tests/BluetoothTest.java | 510 + .../android/unit_tests/BrickDeniedTest.java | 33 + .../src/com/android/unit_tests/BuildTest.java | 130 + .../android/unit_tests/CharSequencesTest.java | 58 + .../unit_tests/CheckinProviderTest.java | 187 + .../com/android/unit_tests/ComponentTest.java | 738 + .../unit_tests/ContentQueryMapTest.java | 104 + .../android/unit_tests/CreateViewTest.java | 123 + .../android/unit_tests/CursorWindowTest.java | 173 + .../unit_tests/DatabaseCursorTest.java | 626 + .../unit_tests/DatabaseGeneralTest.java | 871 + .../unit_tests/DatabaseLocaleTest.java | 102 + .../unit_tests/DatabasePerformanceTests.java | 1353 + .../unit_tests/DatabaseStatementTest.java | 320 + .../unit_tests/DatabaseStressTest.java | 99 + .../com/android/unit_tests/DatabaseTests.java | 33 + .../unit_tests/ExpatPerformanceTest.java | 123 + .../android/unit_tests/GDataParseTest.java | 162 + .../com/android/unit_tests/GeocoderTest.java | 64 + .../unit_tests/GoogleHttpClientTest.java | 120 + .../unit_tests/GoogleLoginServiceTest.java | 145 + .../unit_tests/GraphicsPerformanceTests.java | 448 + .../com/android/unit_tests/HashMapTest.java | 185 + .../com/android/unit_tests/HashSetTest.java | 207 + .../com/android/unit_tests/HashtableTest.java | 357 + .../src/com/android/unit_tests/HeapTest.java | 631 + .../src/com/android/unit_tests/HtmlTest.java | 156 + .../com/android/unit_tests/InflateTest.java | 154 + .../android/unit_tests/InstanceofTest.java | 141 + .../unit_tests/JavaPerformanceTests.java | 38 + .../com/android/unit_tests/JniLibTest.java | 59 + .../src/com/android/unit_tests/LabelView.java | 191 + .../android/unit_tests/LinkedListTest.java | 529 + .../com/android/unit_tests/LinkifyTest.java | 68 + .../android/unit_tests/LocalSocketTest.java | 171 + .../unit_tests/LocationManagerTest.java | 132 + .../src/com/android/unit_tests/LogTest.java | 152 + .../src/com/android/unit_tests/MathTest.java | 380 + .../src/com/android/unit_tests/MenuTest.java | 290 + .../com/android/unit_tests/MonitorTest.java | 469 + .../unit_tests/ParentalControlTest.java | 57 + .../android/unit_tests/PerformanceTests.java | 1223 + .../src/com/android/unit_tests/RegexTest.java | 124 + .../src/com/android/unit_tests/SMSTest.java | 277 + .../src/com/android/unit_tests/SSLTest.java | 52 + .../com/android/unit_tests/SafeSaxTest.java | 539 + .../android/unit_tests/SearchManagerTest.java | 542 + .../android/unit_tests/SerializationTest.java | 47 + .../unit_tests/SettingsProviderTest.java | 147 + .../unit_tests/SimplePullParserTest.java | 132 + .../android/unit_tests/SmsProviderTest.java | 76 + .../com/android/unit_tests/SpannedTest.java | 187 + .../com/android/unit_tests/StringTest.java | 951 + .../android/unit_tests/TestHttpClient.java | 116 + .../android/unit_tests/TestHttpServer.java | 207 + .../android/unit_tests/TestHttpService.java | 608 + .../android/unit_tests/TextLayoutTest.java | 51 + .../com/android/unit_tests/TextUtilsTest.java | 358 + .../unit_tests/TextViewPerformanceTest.java | 132 + .../com/android/unit_tests/TextViewTest.java | 61 + .../android/unit_tests/ThreadBitmapTest.java | 47 + .../src/com/android/unit_tests/TimeTest.java | 525 + .../com/android/unit_tests/TimeUtilsTest.java | 432 + .../src/com/android/unit_tests/TraceTest.java | 215 + .../com/android/unit_tests/TreeMapTest.java | 281 + .../com/android/unit_tests/TreeSetTest.java | 349 + .../android/unit_tests/UriMatcherTest.java | 95 + .../src/com/android/unit_tests/UriTest.java | 502 + .../com/android/unit_tests/UrlRulesTest.java | 120 + .../com/android/unit_tests/VectorTest.java | 555 + .../com/android/unit_tests/WebkitTest.java | 59 + .../unit_tests/activity/AbortReceiver.java | 49 + .../activity/ActivityManagerTest.java | 115 + .../unit_tests/activity/ActivityTests.java | 40 + .../activity/ActivityTestsBase.java | 212 + .../unit_tests/activity/BroadcastTest.java | 536 + .../android/unit_tests/activity/ClearTop.java | 51 + .../unit_tests/activity/IntentSenderTest.java | 86 + .../unit_tests/activity/LaunchTest.java | 75 + .../activity/LaunchpadActivity.java | 588 + .../activity/LaunchpadTabActivity.java | 43 + .../unit_tests/activity/LifecycleTest.java | 108 + .../unit_tests/activity/LocalActivity.java | 33 + .../activity/LocalDeniedReceiver.java | 42 + .../activity/LocalDeniedService.java | 15 +- .../unit_tests/activity/LocalDialog.java | 33 + .../activity/LocalGrantedReceiver.java | 42 + .../activity/LocalGrantedService.java | 22 + .../unit_tests/activity/LocalProvider.java | 163 + .../unit_tests/activity/LocalReceiver.java | 77 + .../unit_tests/activity/LocalScreen.java | 33 + .../unit_tests/activity/LocalService.java | 122 + .../unit_tests/activity/MetaDataTest.java | 166 + .../activity/RemoteDeniedReceiver.java | 42 + .../activity/RemoteGrantedReceiver.java | 42 + .../unit_tests/activity/RemoteReceiver.java | 50 + .../activity/RemoteSubActivityScreen.java | 59 + .../unit_tests/activity/ResultReceiver.java | 43 + .../unit_tests/activity/ServiceTest.java | 465 + .../activity/SetTimeZonePermissionsTest.java | 70 + .../activity/SubActivityScreen.java | 168 + .../unit_tests/activity/SubActivityTest.java | 92 + .../unit_tests/activity/TestedActivity.java | 77 + .../unit_tests/activity/TestedScreen.java | 128 + .../android/unit_tests/content/ArrayTest.java | 77 + .../android/unit_tests/content/AssetTest.java | 74 + .../unit_tests/content/ConfigTest.java | 326 + .../unit_tests/content/ContentTests.java | 32 + .../unit_tests/content/FractionTest.java | 92 + .../unit_tests/content/IntentFilterTest.java | 570 + .../content/PluralResourcesTest.java | 97 + .../unit_tests/content/PrimitiveTest.java | 141 + .../unit_tests/content/RawResourceTest.java | 40 + .../unit_tests/content/ResourceNameTest.java | 61 + .../unit_tests/content/ResourceTests.java | 33 + .../unit_tests/graphics/BitmapTest.java | 232 + .../unit_tests/graphics/GraphicsTests.java | 29 + .../unit_tests/graphics/TypefaceTest.java | 91 + .../com/android/unit_tests/os/AidlTest.aidl | 20 + .../com/android/unit_tests/os/AidlTest.java | 422 + .../unit_tests/os/BroadcasterTest.java | 232 + .../unit_tests/os/FileObserverTest.java | 120 + .../android/unit_tests/os/FileUtilsTest.java | 171 + .../android/unit_tests/os/HandlerTester.java | 89 + .../unit_tests/os/HandlerThreadTest.java | 90 + .../com/android/unit_tests/os/IAidlTest.aidl | 47 + .../unit_tests/os/IdleHandlerTest.java | 199 + .../android/unit_tests/os/MemoryFileTest.java | 243 + .../unit_tests/os/MessageQueueTest.java | 103 + .../unit_tests/os/MessengerService.java | 50 + .../android/unit_tests/os/MessengerTest.java | 119 + .../com/android/unit_tests/os/OsTests.java | 41 + .../unit_tests/os/PowerManagerTest.java | 125 + .../unit_tests/os/SystemPropertiesTest.java | 51 + .../unit_tests/os/TestHandlerThread.java | 104 + tests/CoreTests/Android.mk | 2 + tests/CoreTests/MODULE_LICENSE_APACHE2 | 0 tests/CoreTests/android/Android.mk | 15 + tests/CoreTests/android/AndroidManifest.xml | 53 + .../android/content/ObserverNodeTest.java | 92 + .../content/SyncStorageEngineTest.java | 66 + .../android/core/AbstractJDBCDriverTest.java | 211 + .../CoreTests/android/core/ArrayListTest.java | 94 + .../CoreTests/android/core/AtParserTest.java | 348 + tests/CoreTests/android/core/BooleanTest.java | 46 + .../android/core/BufferedInputStreamTest.java | 81 + .../core/BufferedOutputStreamTest.java | 50 + .../android/core/BufferedReaderTest.java | 66 + .../android/core/BufferedWriterTest.java | 53 + .../core/ByteArrayInputStreamTest.java | 43 + .../core/ByteArrayOutputStreamTest.java | 43 + .../android/core/CharArrayReaderTest.java | 42 + .../android/core/CharArrayWriterTest.java | 48 + .../CoreTests/android/core/ChecksumTest.java | 97 + .../android/core/ClassLoaderTest.java | 243 + tests/CoreTests/android/core/ClassTest.java | 337 + tests/CoreTests/android/core/CoreTests.java | 66 + tests/CoreTests/android/core/CryptoTest.java | 137 + .../android/core/DataInputStreamTest.java | 107 + .../android/core/DataOutputStreamTest.java | 51 + .../CoreTests/android/core/DatagramTest.java | 192 + tests/CoreTests/android/core/DeflateTest.java | 199 + tests/CoreTests/android/core/EnumTest.java | 64 + tests/CoreTests/android/core/FileTest.java | 38 + .../android/core/FloatDoubleTest.java | 152 + .../android/core/GZIPStreamTest.java | 114 + .../android/core/HashMapPerfTest.java | 93 + tests/CoreTests/android/core/HashMapTest.java | 281 + .../CoreTests/android/core/HttpConstants.java | 157 + tests/CoreTests/android/core/IOUtil.java | 193 + .../CoreTests/android/core/InetAddrTest.java | 100 + .../android/core/InputStreamReaderTest.java | 114 + tests/CoreTests/android/core/JavaTests.java | 86 + .../android/core/LineNumberReaderTest.java | 79 + tests/CoreTests/android/core/LocaleTest.java | 199 + .../android/core/LowLevelNetRunner.java | 46 + tests/CoreTests/android/core/MathTest.java | 831 + .../android/core/MiscRegressionTest.java | 506 + tests/CoreTests/android/core/NIOTest.java | 694 + .../android/core/OutputStreamWriterTest.java | 48 + .../CoreTests/android/core/ParseIntTest.java | 110 + .../android/core/PipedStreamTest.java | 303 + .../android/core/PrintWriterTest.java | 75 + .../android/core/PushbackInputStreamTest.java | 57 + .../android/core/PushbackReaderTest.java | 57 + .../android/core/ReflectArrayTest.java | 136 + tests/CoreTests/android/core/RegexTest.java | 288 + .../android/core/RequestAPITest.java | 483 + .../android/core/SQLiteJDBCDriverTest.java | 137 + .../CoreTests/android/core/SSLSocketTest.java | 872 + tests/CoreTests/android/core/Sha1Test.java | 69 + tests/CoreTests/android/core/SocketTest.java | 288 + .../android/core/StreamTokenizerTest.java | 96 + .../android/core/StrictMathTest.java | 855 + .../android/core/StringReaderTest.java | 40 + tests/CoreTests/android/core/StringTest.java | 149 + .../android/core/StringWriterTest.java | 42 + .../android/core/TestEventHandler.java | 811 + tests/CoreTests/android/core/TestHandler.java | 174 + tests/CoreTests/android/core/TestWebData.java | 132 + .../CoreTests/android/core/TestWebServer.java | 871 + tests/CoreTests/android/core/TreeMapTest.java | 105 + tests/CoreTests/android/core/URITest.java | 55 + tests/CoreTests/android/core/URLTest.java | 200 + tests/CoreTests/android/core/ZipFileTest.java | 200 + .../CoreTests/android/core/ZipStreamTest.java | 171 + .../android/database/MatrixCursorTest.java | 146 + .../android/graphics/ColorStateListTest.java | 68 + .../drawable/StateListDrawableTest.java | 98 + .../LocationManagerProximityTest.java | 294 + .../android/location/LocationTest.java | 230 + tests/CoreTests/android/res/color/color1.xml | 20 + .../android/res/color/color_no_default.xml | 19 + tests/CoreTests/android/res/values/colors.xml | 24 + .../android/test/AndroidTestRunnerTest.java | 294 + .../test/InstrumentationTestRunnerTest.java | 251 + .../android/test/StubTestBrowserActivity.java | 33 + .../android/test/TestBrowserActivityTest.java | 270 + .../test/TestBrowserControllerImplTest.java | 134 + .../android/test/TestBrowserTests.java | 22 + .../android/test/TestCaseUtilTest.java | 100 + .../test/suitebuilder/AssignableFromTest.java | 85 + .../InstrumentationTestSuiteBuilderTest.java | 116 + .../test/suitebuilder/ListTestCaseNames.java | 102 + .../SmokeTestSuiteBuilderTest.java | 34 + .../suitebuilder/TestSuiteBuilderTest.java | 218 + .../UnitTestSuiteBuilderTest.java | 109 + .../annotation/HasAnnotationTest.java | 76 + .../annotation/HasClassAnnotationTest.java | 57 + .../annotation/HasMethodAnnotationTest.java | 56 + .../test/suitebuilder/examples/OuterTest.java | 37 + .../examples/error/ErrorTest.java | 30 + .../examples/error/FailingTest.java | 30 + .../instrumentation/InstrumentationTest.java | 26 + .../examples/nested/Level1Test.java | 26 + .../examples/nested/nested/Level2Test.java | 26 + .../examples/simple/AnotherSimpleTest.java | 26 + .../examples/simple/SimpleTest.java | 30 + .../examples/smoke/NonSmokeTest.java | 26 + .../examples/smoke/SmokeTest.java | 28 + .../examples/subclass/SubclassTest.java | 24 + .../examples/subclass/SuperclassTest.java | 26 + .../suppress/PartiallySuppressedTest.java | 33 + .../examples/suppress/SuppressedTest.java | 29 + .../android/util/DayOfMonthCursorTest.java | 157 + .../CoreTests/android/util/FloatMathTest.java | 55 + .../android/util/MonthDisplayHelperTest.java | 211 + .../CoreTests/android/util/StateSetTest.java | 182 + .../android/view/FocusFinderTest.java | 576 + tests/CoreTests/android/view/MockView.java | 25 + .../android/view/ViewGroupAttributesTest.java | 83 + .../CoreTests/android/webkit/CookieTest.java | 184 + .../telephony/ATResponseParserTest.java | 113 + .../telephony/PhoneNumberUtilsTest.java | 326 + .../telephony/PhoneNumberWatcherTest.java | 65 + .../internal/telephony/TelephonyTests.java | 53 + .../internal/telephony/TestPhoneNotifier.java | 53 + .../internal/telephony/gsm/AdnRecordTest.java | 176 + .../internal/telephony/gsm/GSMPhoneTest.java | 2024 + .../telephony/gsm/GsmAlphabetTest.java | 309 + .../telephony/gsm/SMSDispatcherTest.java | 98 + .../telephony/gsm/SimPhoneBookTest.java | 107 + .../internal/telephony/gsm/SimSmsTest.java | 60 + .../internal/telephony/gsm/SimUtilsTest.java | 79 + .../android/internal/util/PredicatesTest.java | 74 + tests/CoreTests/run_core_test.sh | 4 + tests/CoreTests/run_junit.sh | 9 + tests/DumpRenderTree/Android.mk | 12 + tests/DumpRenderTree/AndroidManifest.xml | 34 + .../android/dumprendertree/CallbackProxy.java | 328 + .../android/dumprendertree/EventSender.java | 29 + .../android/dumprendertree/FileFilter.java | 242 + .../com/android/dumprendertree/FileList.java | 160 + .../dumprendertree/HTMLHostActivity.java | 607 + .../android/dumprendertree/HTMLHostApp.java | 33 + .../HTMLHostCallbackInterface.java | 21 + .../dumprendertree/LayoutTestController.java | 62 + .../dumprendertree/LayoutTestsAutoRunner.java | 48 + .../dumprendertree/LayoutTestsAutoTest.java | 157 + .../src/com/android/dumprendertree/Menu.java | 53 + .../dumprendertree/WebViewEventSender.java | 194 + tests/FrameworkTest/Android.mk | 15 + tests/FrameworkTest/AndroidManifest.xml | 929 + tests/FrameworkTest/README | 8 + .../drawable/big_drawable_background.9.png | Bin 0 -> 330 bytes .../res/drawable/bitmap_drawable.xml | 19 + .../res/drawable/black_square.png | Bin 0 -> 151 bytes .../drawable/black_square_stretchable.9.png | Bin 0 -> 175 bytes tests/FrameworkTest/res/drawable/box.xml | 26 + .../res/drawable/drawable_background.9.png | Bin 0 -> 270 bytes .../res/drawable/sym_now_playing_pause_1.png | Bin 0 -> 3038 bytes .../sym_now_playing_skip_backward_1.png | Bin 0 -> 3262 bytes .../sym_now_playing_skip_forward_1.png | Bin 0 -> 3275 bytes .../res/layout/add_column_in_table.xml | 46 + .../res/layout/baseline_0width_and_weight.xml | 49 + .../res/layout/baseline_buttons.xml | 68 + .../res/layout/baseline_center_gravity.xml | 39 + .../res/layout/brightness_limit.xml | 29 + .../res/layout/descendant_focusability.xml | 66 + tests/FrameworkTest/res/layout/disabled.xml | 43 + .../drawable_background_minimum_size.xml | 93 + .../FrameworkTest/res/layout/fill_in_wrap.xml | 64 + .../res/layout/focus_after_removal.xml | 60 + .../res/layout/focus_listener.xml | 38 + .../res/layout/framelayout_gravity.xml | 76 + .../res/layout/framelayout_margin.xml | 50 + .../res/layout/grid_in_horizontal.xml | 38 + .../res/layout/grid_in_vertical.xml | 42 + .../FrameworkTest/res/layout/grid_padding.xml | 24 + .../res/layout/grid_scroll_listener.xml | 39 + .../res/layout/grid_thrasher.xml | 38 + .../res/layout/include_button.xml | 21 + .../res/layout/include_button_with_size.xml | 21 + .../FrameworkTest/res/layout/include_tag.xml | 45 + .../layout/inflated_expandablelistview.xml | 20 + .../res/layout/linear_layout_buttons.xml | 48 + .../linear_layout_edittext_then_button.xml | 39 + .../res/layout/linear_layout_grid.xml | 101 + .../layout/linear_layout_listview_height.xml | 66 + .../linear_layout_spinner_then_button.xml | 37 + .../res/layout/linear_layout_textviews.xml | 41 + .../res/layout/linear_layout_weight.xml | 55 + .../res/layout/list_dividers.xml | 32 + .../FrameworkTest/res/layout/list_filter.xml | 50 + .../res/layout/list_in_horizontal.xml | 29 + .../res/layout/list_in_vertical.xml | 46 + .../res/layout/list_recycler_profiling.xml | 32 + .../res/layout/list_scroll_listener.xml | 33 + .../res/layout/list_take_focus_from_side.xml | 113 + .../res/layout/list_thrasher.xml | 33 + .../res/layout/list_with_button_above.xml | 39 + .../list_with_disappearing_item_bug_item.xml | 31 + .../res/layout/list_with_empty_view.xml | 36 + tests/FrameworkTest/res/layout/longpress.xml | 32 + .../FrameworkTest/res/layout/mail_message.xml | 32 + .../FrameworkTest/res/layout/merge_child.xml | 34 + tests/FrameworkTest/res/layout/merge_tag.xml | 41 + .../res/layout/popup_window_visibility.xml | 60 + .../res/layout/pre_draw_listener.xml | 41 + .../res/layout/remote_view_host.xml | 25 + .../res/layout/remote_view_test_bad_1.xml | 31 + .../res/layout/remote_view_test_bad_2.xml | 31 + .../res/layout/remote_view_test_good.xml | 50 + .../scroll_to_rect_with_internal_scroll.xml | 49 + .../res/layout/scroll_to_rectangle.xml | 79 + .../res/layout/scrollview_linear_layout.xml | 32 + .../res/layout/scrollview_with_webviews.xml | 45 + .../res/layout/table_layout_cell_span.xml | 88 + .../res/layout/table_layout_fixed_width.xml | 56 + .../table_layout_horizontal_gravity.xml | 82 + .../layout/table_layout_vertical_gravity.xml | 70 + .../res/layout/table_layout_weight.xml | 44 + .../res/layout/translucent_background.xml | 24 + .../res/layout/viewgroupchildren.xml | 29 + tests/FrameworkTest/res/layout/viewstub.xml | 42 + tests/FrameworkTest/res/layout/visibility.xml | 75 + tests/FrameworkTest/res/layout/weight_sum.xml | 34 + .../res/layout/with_bitmap_background.xml | 27 + tests/FrameworkTest/res/layout/zero_sized.xml | 48 + tests/FrameworkTest/res/values/arrays.xml | 34 + tests/FrameworkTest/res/values/attrs.xml | 21 + tests/FrameworkTest/res/values/colors.xml | 26 + tests/FrameworkTest/res/values/strings.xml | 103 + tests/FrameworkTest/res/values/styles.xml | 22 + .../FrameworkTestApplication.java | 19 + .../activity/TranslucentFancyActivity.java | 70 + .../drawable/BitmapDrawable.java | 40 + .../drawable/DrawableBgMinSize.java | 91 + .../ExpandableListSimple.java | 49 + .../ExpandableListWithHeaders.java | 70 + .../InflatedExpandableListView.java | 115 + .../focus/AdjacentVerticalRectLists.java | 94 + .../focus/DescendantFocusability.java | 53 + .../focus/FocusAfterRemoval.java | 78 + .../focus/GoneParentFocusedChild.java | 88 + .../focus/HorizontalFocusSearch.java | 134 + .../frameworktest/focus/LinearLayoutGrid.java | 65 + .../frameworktest/focus/ListOfButtons.java | 76 + .../frameworktest/focus/ListOfEditTexts.java | 125 + .../focus/ListOfInternalSelectionViews.java | 170 + .../focus/ListWithFooterViewAndNewLabels.java | 111 + .../focus/ListWithMailMessages.java | 147 + .../frameworktest/focus/RequestFocus.java | 47 + .../focus/VerticalFocusSearch.java | 151 + .../frameworktest/gridview/GridDelete.java | 108 + .../gridview/GridInHorizontal.java | 59 + .../gridview/GridInVertical.java | 59 + .../frameworktest/gridview/GridPadding.java | 52 + .../gridview/GridScrollListener.java | 68 + .../gridview/GridSetSelection.java | 35 + .../gridview/GridSetSelectionMany.java | 35 + .../GridSetSelectionStackFromBottom.java | 35 + .../GridSetSelectionStackFromBottomMany.java | 35 + .../frameworktest/gridview/GridSimple.java | 55 + .../gridview/GridSingleColumn.java | 37 + .../gridview/GridStackFromBottom.java | 35 + .../gridview/GridStackFromBottomMany.java | 35 + .../frameworktest/gridview/GridThrasher.java | 135 + .../gridview/GridVerticalSpacing.java | 34 + .../GridVerticalSpacingStackFromBottom.java | 35 + .../layout/frame/FrameLayoutGravity.java | 31 + .../layout/frame/FrameLayoutMargin.java | 31 + .../BaselineAlignmentCenterGravity.java | 31 + .../BaselineAlignmentZeroWidthAndWeight.java | 37 + .../layout/linear/BaselineButtons.java | 31 + .../layout/linear/ExceptionTextView.java | 65 + .../layout/linear/FillInWrap.java | 32 + ...orizontalOrientationVerticalAlignment.java | 31 + .../layout/linear/LLEditTextThenButton.java | 55 + .../layout/linear/LLOfButtons1.java | 66 + .../layout/linear/LLOfButtons2.java | 26 + .../linear/LLOfTwoFocusableInTouchMode.java | 91 + .../layout/linear/LinearLayoutEditTexts.java | 31 + .../frameworktest/layout/linear/Weight.java | 30 + .../layout/linear/WeightSum.java | 31 + .../frameworktest/layout/table/AddColumn.java | 54 + .../frameworktest/layout/table/CellSpan.java | 33 + .../layout/table/FixedWidth.java | 33 + .../layout/table/HorizontalGravity.java | 33 + .../layout/table/VerticalGravity.java | 33 + .../frameworktest/layout/table/Weight.java | 33 + .../AdjacentListsWithAdjacentISVsInside.java | 131 + .../listview/ListBottomGravity.java | 37 + .../listview/ListBottomGravityMany.java | 36 + .../ListButtonsDiagonalAcrossItems.java | 57 + .../frameworktest/listview/ListDividers.java | 52 + .../ListEndingWithMultipleSeparators.java | 32 + .../frameworktest/listview/ListFilter.java | 193 + .../listview/ListGetSelectedView.java | 30 + .../listview/ListHeterogeneous.java | 83 + .../ListHorizontalFocusWithinItemWins.java | 64 + .../listview/ListInHorizontal.java | 55 + .../listview/ListInVertical.java | 56 + .../listview/ListInterleaveFocusables.java | 63 + .../ListItemFocusableAboveUnfocusable.java | 48 + .../listview/ListItemFocusablesClose.java | 54 + .../listview/ListItemFocusablesFarApart.java | 44 + .../listview/ListItemISVAndButton.java | 75 + .../listview/ListItemsExpandOnSelection.java | 80 + .../ListLastItemPartiallyVisible.java | 31 + .../listview/ListManagedCursor.java | 60 + .../ListOfItemsShorterThanScreen.java | 28 + .../listview/ListOfItemsTallerThanScreen.java | 29 + .../ListOfShortShortTallShortShort.java | 33 + .../listview/ListOfShortTallShort.java | 32 + .../listview/ListOfThinItems.java | 33 + .../listview/ListOfTouchables.java | 47 + .../listview/ListRecyclerProfiling.java | 55 + .../listview/ListScrollListener.java | 72 + .../listview/ListSetSelection.java | 72 + .../frameworktest/listview/ListSimple.java | 51 + .../listview/ListTakeFocusFromSide.java | 84 + .../frameworktest/listview/ListThrasher.java | 131 + .../listview/ListTopGravity.java | 37 + .../listview/ListTopGravityMany.java | 35 + .../listview/ListViewHeight.java | 109 + .../listview/ListWithDisappearingItemBug.java | 80 + .../listview/ListWithEditTextHeader.java | 34 + .../listview/ListWithEmptyView.java | 104 + .../listview/ListWithHeaders.java | 57 + .../listview/ListWithNoFadingEdge.java | 28 + .../ListWithOffScreenNextSelectable.java | 37 + .../ListWithOnItemSelectedAction.java | 44 + .../ListWithScreenOfNoSelectables.java | 28 + .../listview/ListWithSeparators.java | 33 + .../frameworktest/menus/ListContextMenu.java | 201 + .../frameworktest/menus/MenuLayout.java | 65 + .../menus/MenuLayoutLandscape.java | 24 + .../menus/MenuLayoutPortrait.java | 24 + .../frameworktest/menus/MenuScenario.java | 212 + .../frameworktest/menus/MenuWith1Item.java | 44 + .../performance/InvalidateCycle.java | 49 + .../ButtonAboveTallInternalSelectionView.java | 46 + .../ButtonsWithTallTextViewInBetween.java | 50 + .../scroll/RequestRectangleVisible.java | 94 + ...estRectangleVisibleWithInternalScroll.java | 76 + .../scroll/ScrollViewButtonsAndLabels.java | 91 + .../frameworktest/scroll/ShortButtons.java | 54 + .../scroll/TallTextAboveButton.java | 31 + .../settings/BrightnessLimit.java | 60 + .../RingtonePickerActivityLauncher.java | 79 + .../util/ExpandableListScenario.java | 387 + .../frameworktest/util/GridScenario.java | 370 + .../util/InternalSelectionView.java | 273 + .../android/frameworktest/util/KeyUtils.java | 88 + .../frameworktest/util/ListItemFactory.java | 291 + .../frameworktest/util/ListScenario.java | 662 + .../android/frameworktest/util/ListUtil.java | 103 + .../util/ScrollViewScenario.java | 258 + .../util/TouchModeFlexibleAsserts.java | 75 + .../android/frameworktest/view/BigCache.java | 71 + .../android/frameworktest/view/Disabled.java | 49 + .../frameworktest/view/GlobalFocusChange.java | 46 + .../android/frameworktest/view/Include.java | 33 + .../android/frameworktest/view/Longpress.java | 32 + .../com/android/frameworktest/view/Merge.java | 47 + .../view/PopupWindowVisibility.java | 117 + .../frameworktest/view/PreDrawListener.java | 92 + .../view/RemoteViewsActivity.java | 33 + .../android/frameworktest/view/RunQueue.java | 70 + .../frameworktest/view/StubbedView.java | 43 + .../frameworktest/view/ViewGroupChildren.java | 35 + .../frameworktest/view/Visibility.java | 70 + .../android/frameworktest/view/ZeroSized.java | 34 + tests/FrameworkTest/tests/Android.mk | 17 + tests/FrameworkTest/tests/AndroidManifest.xml | 34 + .../SearchRecentSuggestionsProviderTest.java | 402 + .../widget/SimpleCursorAdapterTest.java | 185 + .../com/android/frameworktest/AllTests.java | 34 + .../drawable/DrawableBgMinSizeTest.java | 152 + .../ExpandableListBasicTest.java | 129 + .../ExpandableListWithHeadersTest.java | 66 + .../focus/DescendantFocusabilityTest.java | 138 + .../focus/FocusAfterRemovalTest.java | 131 + ...ocusChangeWithInterestingRectHintTest.java | 114 + .../focus/GoneParentFocusedChildTest.java | 56 + .../focus/HorizontalFocusSearchTest.java | 124 + .../focus/LinearLayoutGridTest.java | 81 + .../focus/ListOfButtonsTest.java | 170 + .../ListWithFooterViewAndNewLabelsTest.java | 72 + .../frameworktest/focus/RequestFocusTest.java | 97 + .../ScrollingThroughListOfFocusablesTest.java | 222 + .../focus/VerticalFocusSearchTest.java | 152 + .../gridview/GridInHorizontalTest.java | 49 + .../gridview/GridInVerticalTest.java | 49 + .../gridview/GridPaddingTest.java | 49 + .../gridview/GridScrollListenerTest.java | 110 + .../gridview/GridSetSelectionBaseTest.java | 102 + .../gridview/GridSetSelectionManyTest.java | 25 + ...idSetSelectionStackFromBottomManyTest.java | 25 + .../GridSetSelectionStackFromBottomTest.java | 25 + .../gridview/GridSetSelectionTest.java | 25 + .../gridview/GridSingleColumnTest.java | 47 + .../gridview/GridStackFromBottomManyTest.java | 49 + .../gridview/GridStackFromBottomTest.java | 49 + .../touch/GridTouchSetSelectionTest.java | 82 + .../GridTouchStackFromBottomManyTest.java | 86 + .../touch/GridTouchStackFromBottomTest.java | 119 + ...uchVerticalSpacingStackFromBottomTest.java | 154 + .../touch/GridTouchVerticalSpacingTest.java | 142 + .../layout/frame/FrameLayoutGravityTest.java | 131 + .../layout/frame/FrameLayoutMarginTest.java | 85 + .../BaselineAlignmentCenterGravityTest.java | 69 + .../BaselineAlignmentSpinnerButton.java | 55 + ...selineAlignmentZeroWidthAndWeightTest.java | 62 + .../layout/linear/BaselineButtonsTest.java | 86 + .../layout/linear/FillInWrapTest.java | 54 + .../linear/LinearLayoutEditTextsTest.java | 57 + .../layout/linear/WeightSumTest.java | 57 + .../layout/linear/WeightTest.java | 55 + .../layout/table/AddColumnTest.java | 71 + .../layout/table/CellSpanTest.java | 85 + .../layout/table/FixedWidthTest.java | 66 + .../layout/table/HorizontalGravityTest.java | 74 + .../layout/table/VerticalGravityTest.java | 80 + .../layout/table/WeightTest.java | 63 + .../listview/ListBottomGravityManyTest.java | 49 + .../listview/ListBottomGravityTest.java | 49 + .../listview/ListEmptyViewTest.java | 128 + .../listview/ListFocusableTest.java | 232 + .../listview/ListHeterogeneousTest.java | 74 + .../listview/ListInHorizontalTest.java | 25 + .../listview/ListInVerticalTest.java | 25 + ...ItemRequestRectAboveThinFirstItemTest.java | 102 + .../listview/ListManagedCursorTest.java | 180 + .../ListRetainsFocusAcrossLayoutsTest.java | 88 + .../listview/ListScrollListenerTest.java | 108 + .../listview/ListUnspecifiedMeasure.java | 55 + .../listview/ListViewHeightTest.java | 86 + .../ListInterleaveFocusablesTest.java | 109 + ...ListItemFocusableAboveUnfocusableTest.java | 55 + .../ListItemFocusablesCloseTest.java | 115 + .../ListItemFocusablesFarApartTest.java | 116 + .../ListItemsExpandOnSelectionTest.java | 118 + .../ListLastItemPartiallyVisibleTest.java | 80 + .../ListOfItemsShorterThanScreenTest.java | 162 + .../ListOfItemsTallerThanScreenTest.java | 195 + .../ListOfShortShortTallShortShortTest.java | 137 + .../arrowscroll/ListOfShortTallShortTest.java | 80 + .../arrowscroll/ListOfThinItemsTest.java | 115 + .../arrowscroll/ListWithNoFadingEdgeTest.java | 80 + .../ListWithOffScreenNextSelectableTest.java | 105 + .../ListWithOnItemSelectedActionTest.java | 60 + .../ListWithScreenOfNoSelectablesTest.java | 106 + .../arrowscroll/ListWithSeparatorsTest.java | 75 + ...jacentListsWithAdjacentISVsInsideTest.java | 90 + .../ListButtonsDiagonalAcrossItemsTest.java | 105 + ...ListHorizontalFocusWithinItemWinsTest.java | 74 + .../focus/ListWithEditTextHeaderTest.java | 66 + .../touch/ListGetSelectedViewTest.java | 65 + .../listview/touch/ListOfTouchablesTest.java | 84 + .../listview/touch/ListSetSelectionTest.java | 148 + .../touch/ListTouchBottomGravityManyTest.java | 153 + .../touch/ListTouchBottomGravityTest.java | 94 + .../listview/touch/ListTouchManyTest.java | 192 + .../listview/touch/ListTouchTest.java | 91 + .../menus/MenuLayoutLandscapeTest.java | 230 + .../menus/MenuLayoutPortraitTest.java | 231 + .../menus/MenuWith1ItemTest.java | 84 + ...tonAboveTallInternalSelectionViewTest.java | 66 + .../scroll/RequestRectangleVisibleTest.java | 237 + ...ectangleVisibleWithInternalScrollTest.java | 85 + .../ScrollViewButtonsAndLabelsTest.java | 214 + .../ButtonsWithTallTextViewInBetweenTest.java | 142 + .../scroll/arrowscroll/ShortButtonsTest.java | 109 + .../arrowscroll/TallTextAboveButtonTest.java | 78 + .../settings/RingtonePickerActivityTest.java | 227 + .../android/frameworktest/text/HtmlTest.java | 66 + .../text/SpannableStringBuilderTest.java | 11 + .../text/SpannableStringTest.java | 11 + .../frameworktest/text/SpannableTest.java | 34 + .../touchmode/ChangeTouchModeTest.java | 127 + .../FocusableInTouchModeClickTest.java | 64 + .../StartInTouchWithViewInFocusTest.java | 67 + .../touchmode/TouchModeFocusChangeTest.java | 90 + .../touchmode/TouchModeFocusableTest.java | 91 + .../frameworktest/view/BigCacheTest.java | 83 + .../view/DisabledLongpressTest.java | 89 + .../frameworktest/view/DisabledTest.java | 94 + .../view/GlobalFocusChangeTest.java | 87 + .../frameworktest/view/IncludeTest.java | 78 + .../frameworktest/view/LongpressTest.java | 85 + .../android/frameworktest/view/MergeTest.java | 42 + .../view/RemoteViewsActivityTest.java | 124 + .../frameworktest/view/RunQueueTest.java | 59 + .../view/ViewGroupChildrenTest.java | 268 + .../frameworktest/view/ViewStubTest.java | 85 + .../frameworktest/view/VisibilityTest.java | 179 + .../frameworktest/view/ZeroSizedTest.java | 102 + .../frameworktest/widget/ListViewTest.java | 139 + tests/SslLoad/Android.mk | 10 + tests/SslLoad/AndroidManifest.xml | 13 + .../src/com/android/sslload/SslLoad.java | 123 + tests/StatusBar/Android.mk | 11 + tests/StatusBar/AndroidManifest.xml | 38 + tests/StatusBar/res/drawable/app_gmail.png | Bin 0 -> 5405 bytes tests/StatusBar/res/drawable/app_phone.png | Bin 0 -> 5443 bytes .../res/drawable/ic_statusbar_chat.png | Bin 0 -> 829 bytes .../res/drawable/ic_statusbar_email.png | Bin 0 -> 1077 bytes .../res/drawable/ic_statusbar_missedcall.png | Bin 0 -> 720 bytes tests/StatusBar/res/drawable/icon1.png | Bin 0 -> 616 bytes tests/StatusBar/res/drawable/icon2.png | Bin 0 -> 614 bytes tests/StatusBar/res/drawable/icon3.png | Bin 0 -> 2969 bytes tests/StatusBar/res/drawable/icon4.png | Bin 0 -> 2918 bytes .../res/layout/chrono_notification.xml | 41 + tests/StatusBar/res/raw/ringer.mp3 | Bin 0 -> 42945 bytes tests/StatusBar/res/values/strings.xml | 22 + .../statusbartest/NotificationTestList.java | 517 + .../com/android/statusbartest/PowerTest.java | 129 + .../android/statusbartest/StatusBarTest.java | 164 + .../android/statusbartest/TestActivity.java | 73 + .../com/android/statusbartest/ToastTest.java | 114 + tests/framework-tests/Android.mk | 1 + tests/framework-tests/README | 5 + tests/framework-tests/src/Android.mk | 10 + .../src/android/test/FrameworkTests.java | 28 + .../src/android/text/PackedIntVectorTest.java | 159 + .../android/util/EventLogFunctionalTest.java | 161 + .../src/android/util/EventLogTest.java | 68 + .../http/multipart/MultipartTest.java | 102 + .../internal/os/LoggingPrintStreamTest.java | 133 + .../impl/LockPatternKeyguardViewTest.java | 361 + tools/aapt/AaptAssets.cpp | 5 +- tools/aapt/Bundle.h | 3 + tools/aapt/Command.cpp | 12 + tools/aapt/Images.cpp | 7 + tools/aapt/Main.cpp | 19 +- tools/aapt/Package.cpp | 19 +- tools/aapt/Resource.cpp | 4 + tools/aapt/ResourceTable.cpp | 157 +- tools/aapt/ResourceTable.h | 17 +- tools/aapt/XMLNode.cpp | 30 +- tools/aapt/XMLNode.h | 2 +- tools/layoutlib/Android.mk | 9 +- tools/layoutlib/api/.classpath | 3 +- .../android/layoutlib/api/ILayoutBridge.java | 52 + tools/layoutlib/bridge/.classpath | 6 +- .../bridge/src/android/graphics/Paint.java | 25 +- .../src/android/view/BridgeInflater.java | 1 - .../com/android/layoutlib/bridge/Bridge.java | 206 +- .../layoutlib/bridge/BridgeContext.java | 34 +- .../layoutlib/bridge/BridgeResources.java | 3 +- .../android/layoutlib/bridge/FontLoader.java | 5 +- .../layoutlib/bridge/LayoutResult.java | 2 +- .../layoutlib/bridge/ResourceHelper.java | 4 +- tools/layoutlib/create/.classpath | 2 +- .../tools/layoutlib/create/AsmGenerator.java | 2 +- .../android/tools/layoutlib/create/Main.java | 2 +- .../layoutlib/create/OverrideMethod.java | 16 +- .../layoutlib/create/StubMethodAdapter.java | 17 +- .../create/TransformClassAdapter.java | 10 +- wifi/java/android/net/wifi/IWifiManager.aidl | 6 + .../android/net/wifi/WifiConfiguration.java | 76 + wifi/java/android/net/wifi/WifiManager.java | 50 + wifi/java/android/net/wifi/WifiMonitor.java | 7 +- wifi/java/android/net/wifi/WifiNative.java | 4 + .../android/net/wifi/WifiStateTracker.java | 349 +- 2174 files changed, 1467272 insertions(+), 57613 deletions(-) create mode 100644 api/1.xml create mode 100644 api/2.xml create mode 100644 api/3.xml create mode 100644 api/current.xml create mode 100644 awt/java/awt/color/package.html create mode 100644 awt/java/awt/font/package.html create mode 100644 awt/java/awt/geom/package.html create mode 100644 awt/java/awt/image/package.html create mode 100644 awt/java/awt/image/renderable/package.html create mode 100644 awt/java/awt/package.html delete mode 100644 awt/java/beans/IndexedPropertyChangeEvent.java delete mode 100644 awt/java/beans/PropertyChangeEvent.java delete mode 100644 awt/java/beans/PropertyChangeListener.java delete mode 100644 awt/java/beans/PropertyChangeListenerProxy.java delete mode 100644 awt/java/beans/PropertyChangeSupport.java create mode 100644 awt/javax/imageio/event/package.html create mode 100644 awt/javax/imageio/metadata/package.html create mode 100644 awt/javax/imageio/package.html create mode 100644 awt/javax/imageio/plugins/bmp/package.html create mode 100644 awt/javax/imageio/plugins/jpeg/package.html create mode 100644 awt/javax/imageio/spi/package.html create mode 100644 awt/javax/imageio/stream/package.html create mode 100644 awt/org/apache/harmony/beans/internal/nls/MsgHelp.java rename awt/{org/apache/harmony/beans/internal => resources/org/apache/harmony/beans/internals}/nls/messages.properties (100%) create mode 100644 build/jarjar-rules.txt create mode 100644 cmds/svc/src/com/android/commands/svc/DataCommand.java create mode 100644 cmds/svc/src/com/android/commands/svc/WifiCommand.java create mode 100644 core/java/android/bluetooth/BluetoothA2dp.java create mode 100644 core/java/android/bluetooth/BluetoothClass.java create mode 100644 core/java/android/bluetooth/BluetoothError.java delete mode 100644 core/java/android/bluetooth/DeviceClass.java create mode 100644 core/java/android/bluetooth/IBluetoothA2dp.aidl create mode 100755 core/java/android/content/pm/ConfigurationInfo.java create mode 100644 core/java/android/hardware/Sensor.java create mode 100644 core/java/android/hardware/SensorEvent.java create mode 100644 core/java/android/hardware/SensorEventListener.java create mode 100644 core/java/android/inputmethodservice/AbstractInputMethodService.java create mode 100644 core/java/android/inputmethodservice/ExtractEditText.java create mode 100644 core/java/android/inputmethodservice/IInputMethodSessionWrapper.java create mode 100644 core/java/android/inputmethodservice/IInputMethodWrapper.java create mode 100644 core/java/android/inputmethodservice/InputMethodService.java create mode 100755 core/java/android/inputmethodservice/Keyboard.java create mode 100755 core/java/android/inputmethodservice/KeyboardView.java create mode 100644 core/java/android/inputmethodservice/SoftInputWindow.java create mode 100644 core/java/android/inputmethodservice/package.html create mode 100644 core/java/android/os/AsyncTask.java create mode 100644 core/java/android/os/BatteryStats.java create mode 100644 core/java/android/provider/LiveFolders.java create mode 100644 core/java/android/server/BluetoothA2dpService.java delete mode 100644 core/java/android/speech/recognition/AbstractEmbeddedGrammarListener.java delete mode 100644 core/java/android/speech/recognition/AbstractGrammarListener.java delete mode 100644 core/java/android/speech/recognition/AbstractRecognizerListener.java delete mode 100644 core/java/android/speech/recognition/AbstractSrecGrammarListener.java delete mode 100644 core/java/android/speech/recognition/AudioAlreadyInUseException.java delete mode 100644 core/java/android/speech/recognition/AudioDriverErrorException.java delete mode 100644 core/java/android/speech/recognition/AudioSource.java delete mode 100644 core/java/android/speech/recognition/AudioSourceListener.java delete mode 100644 core/java/android/speech/recognition/AudioStream.java delete mode 100644 core/java/android/speech/recognition/Codec.java delete mode 100644 core/java/android/speech/recognition/DeviceSpeaker.java delete mode 100644 core/java/android/speech/recognition/DeviceSpeakerListener.java delete mode 100644 core/java/android/speech/recognition/EmbeddedGrammar.java delete mode 100644 core/java/android/speech/recognition/EmbeddedGrammarListener.java delete mode 100644 core/java/android/speech/recognition/EmbeddedRecognizer.java delete mode 100644 core/java/android/speech/recognition/Grammar.java delete mode 100644 core/java/android/speech/recognition/GrammarErrorException.java delete mode 100644 core/java/android/speech/recognition/GrammarListener.java delete mode 100644 core/java/android/speech/recognition/GrammarOverflowException.java delete mode 100644 core/java/android/speech/recognition/InvalidURLException.java delete mode 100644 core/java/android/speech/recognition/Logger.java delete mode 100644 core/java/android/speech/recognition/MediaFileReader.java delete mode 100644 core/java/android/speech/recognition/MediaFileReaderListener.java delete mode 100644 core/java/android/speech/recognition/MediaFileWriter.java delete mode 100644 core/java/android/speech/recognition/MediaFileWriterListener.java delete mode 100644 core/java/android/speech/recognition/Microphone.java delete mode 100644 core/java/android/speech/recognition/MicrophoneListener.java delete mode 100644 core/java/android/speech/recognition/NBestRecognitionResult.java delete mode 100644 core/java/android/speech/recognition/ParameterErrorException.java delete mode 100644 core/java/android/speech/recognition/ParametersListener.java delete mode 100644 core/java/android/speech/recognition/ParseErrorException.java delete mode 100644 core/java/android/speech/recognition/RecognitionResult.java delete mode 100644 core/java/android/speech/recognition/Recognizer.java delete mode 100644 core/java/android/speech/recognition/RecognizerListener.java delete mode 100644 core/java/android/speech/recognition/SlotItem.java delete mode 100644 core/java/android/speech/recognition/SrecGrammar.java delete mode 100644 core/java/android/speech/recognition/SrecGrammarListener.java delete mode 100644 core/java/android/speech/recognition/VoicetagItem.java delete mode 100644 core/java/android/speech/recognition/VoicetagItemListener.java delete mode 100644 core/java/android/speech/recognition/WordItem.java delete mode 100644 core/java/android/speech/recognition/impl/AudioStreamImpl.java delete mode 100644 core/java/android/speech/recognition/impl/DeviceSpeakerImpl.java delete mode 100644 core/java/android/speech/recognition/impl/EmbeddedGrammarImpl.java delete mode 100644 core/java/android/speech/recognition/impl/EmbeddedRecognizerImpl.java delete mode 100644 core/java/android/speech/recognition/impl/EntryImpl.java delete mode 100644 core/java/android/speech/recognition/impl/GrammarImpl.java delete mode 100644 core/java/android/speech/recognition/impl/LoggerImpl.java delete mode 100644 core/java/android/speech/recognition/impl/MediaFileReaderImpl.java delete mode 100644 core/java/android/speech/recognition/impl/MediaFileWriterImpl.java delete mode 100644 core/java/android/speech/recognition/impl/MicrophoneImpl.java delete mode 100644 core/java/android/speech/recognition/impl/NBestRecognitionResultImpl.java delete mode 100644 core/java/android/speech/recognition/impl/SrecGrammarImpl.java delete mode 100644 core/java/android/speech/recognition/impl/System.java delete mode 100644 core/java/android/speech/recognition/impl/VoicetagItemImpl.java delete mode 100644 core/java/android/speech/recognition/impl/WordItemImpl.java delete mode 100755 core/java/android/speech/recognition/impl/package.html delete mode 100644 core/java/android/speech/recognition/package.html create mode 100644 core/java/android/speech/srec/MicrophoneInputStream.java create mode 100644 core/java/android/speech/srec/Recognizer.java delete mode 100644 core/java/android/speech/srec/Srec.java create mode 100644 core/java/android/speech/srec/UlawEncoderInputStream.java create mode 100644 core/java/android/speech/srec/package.html create mode 100644 core/java/android/test/suitebuilder/annotation/LargeTest.java create mode 100644 core/java/android/test/suitebuilder/annotation/MediumTest.java create mode 100644 core/java/android/test/suitebuilder/annotation/SmallTest.java create mode 100644 core/java/android/text/InputType.java rename core/java/android/{pim => text/format}/DateFormat.java (82%) rename core/java/android/{pim => text/format}/DateUtils.java (82%) rename core/java/android/{content => text/format}/Formatter.java (71%) rename core/java/android/{pim => text/format}/Time.java (64%) create mode 100644 core/java/android/view/inputmethod/BaseInputConnection.java create mode 100644 core/java/android/view/inputmethod/CompletionInfo.aidl create mode 100644 core/java/android/view/inputmethod/CompletionInfo.java create mode 100644 core/java/android/view/inputmethod/DefaultInputMethod.java create mode 100644 core/java/android/view/inputmethod/EditorInfo.aidl create mode 100644 core/java/android/view/inputmethod/EditorInfo.java create mode 100644 core/java/android/view/inputmethod/ExtractedText.aidl create mode 100644 core/java/android/view/inputmethod/ExtractedText.java create mode 100644 core/java/android/view/inputmethod/ExtractedTextRequest.aidl create mode 100644 core/java/android/view/inputmethod/ExtractedTextRequest.java create mode 100644 core/java/android/view/inputmethod/InputBinding.aidl create mode 100644 core/java/android/view/inputmethod/InputBinding.java create mode 100644 core/java/android/view/inputmethod/InputConnection.java create mode 100644 core/java/android/view/inputmethod/InputConnectionWrapper.java create mode 100644 core/java/android/view/inputmethod/InputMethod.java create mode 100644 core/java/android/view/inputmethod/InputMethodInfo.aidl create mode 100644 core/java/android/view/inputmethod/InputMethodInfo.java create mode 100644 core/java/android/view/inputmethod/InputMethodManager.java create mode 100644 core/java/android/view/inputmethod/InputMethodSession.java create mode 100644 core/java/android/view/inputmethod/MutableInputConnectionWrapper.java create mode 100644 core/java/android/view/inputmethod/package.html create mode 100644 core/java/android/webkit/gears/AndroidWifiDataProvider.java create mode 100644 core/java/android/webkit/gears/NativeDialog.java create mode 100644 core/java/android/webkit/gears/PluginSettings.java create mode 100644 core/java/android/widget/AlphabetIndexer.java create mode 100644 core/java/android/widget/FastScroller.java create mode 100644 core/java/android/widget/SectionIndexer.java mode change 100755 => 100644 core/java/com/android/internal/app/IBatteryStats.aidl create mode 100644 core/java/com/android/internal/os/BatteryStatsImpl.aidl create mode 100644 core/java/com/android/internal/os/BatteryStatsImpl.java create mode 100644 core/java/com/android/internal/os/HandlerCaller.java delete mode 100644 core/java/com/android/internal/provider/Settings.java create mode 100644 core/java/com/android/internal/view/IInputConnectionCallback.aidl create mode 100644 core/java/com/android/internal/view/IInputConnectionWrapper.java create mode 100644 core/java/com/android/internal/view/IInputContext.aidl create mode 100644 core/java/com/android/internal/view/IInputContextCallback.aidl create mode 100644 core/java/com/android/internal/view/IInputMethod.aidl create mode 100644 core/java/com/android/internal/view/IInputMethodCallback.aidl create mode 100644 core/java/com/android/internal/view/IInputMethodClient.aidl create mode 100644 core/java/com/android/internal/view/IInputMethodManager.aidl create mode 100644 core/java/com/android/internal/view/IInputMethodSession.aidl create mode 100644 core/java/com/android/internal/view/InputBindResult.aidl create mode 100644 core/java/com/android/internal/view/InputBindResult.java create mode 100644 core/java/com/android/internal/view/InputConnectionWrapper.java create mode 100644 core/java/com/android/internal/view/package.html create mode 100644 core/java/com/android/internal/widget/DialogTitle.java create mode 100644 core/java/com/android/internal/widget/EditableInputConnection.java create mode 100644 core/java/jarjar-rules.txt create mode 100644 core/jni/android_media_AudioRecord.cpp create mode 100644 core/jni/android_media_AudioTrack.cpp create mode 100644 core/jni/android_server_BluetoothA2dpService.cpp rename core/jni/{android_pim_Time.cpp => android_text_format_Time.cpp} (68%) delete mode 100755 core/res/assets/webkit/film.png create mode 100644 core/res/assets/webkit/play.png create mode 100644 core/res/res/anim/dialog_enter.xml create mode 100644 core/res/res/anim/dialog_exit.xml create mode 100644 core/res/res/anim/input_method_enter.xml create mode 100644 core/res/res/anim/input_method_exit.xml create mode 100644 core/res/res/anim/search_bar_enter.xml create mode 100644 core/res/res/anim/search_bar_exit.xml create mode 100755 core/res/res/drawable/btn_check_buttonless_off.png create mode 100755 core/res/res/drawable/btn_check_buttonless_on.png create mode 100644 core/res/res/drawable/btn_close.xml create mode 100644 core/res/res/drawable/btn_close_normal.png create mode 100644 core/res/res/drawable/btn_close_pressed.png create mode 100644 core/res/res/drawable/btn_keyboard_key.xml create mode 100644 core/res/res/drawable/btn_keyboard_key_longpress.9.png create mode 100644 core/res/res/drawable/btn_keyboard_key_longpress_off.9.png create mode 100644 core/res/res/drawable/btn_keyboard_key_longpress_on.9.png create mode 100644 core/res/res/drawable/btn_keyboard_key_normal.9.png create mode 100644 core/res/res/drawable/btn_keyboard_key_normal_off.9.png create mode 100644 core/res/res/drawable/btn_keyboard_key_normal_on.9.png create mode 100755 core/res/res/drawable/btn_keyboard_key_pressed.9.png create mode 100644 core/res/res/drawable/btn_keyboard_key_pressed_off.9.png create mode 100644 core/res/res/drawable/btn_keyboard_key_pressed_on.9.png create mode 100755 core/res/res/drawable/btn_star_big_buttonless_off.png create mode 100755 core/res/res/drawable/btn_star_big_buttonless_on.png create mode 100644 core/res/res/drawable/btn_star_buttonless.xml create mode 100644 core/res/res/drawable/ic_btn_search.png create mode 100644 core/res/res/drawable/ic_volume_bluetooth_ad2p.png create mode 100644 core/res/res/drawable/ic_volume_bluetooth_in_call.png create mode 100644 core/res/res/drawable/ime_qwerty.png create mode 100644 core/res/res/drawable/keyboard_background.9.png create mode 100644 core/res/res/drawable/keyboard_key_feedback.xml create mode 100644 core/res/res/drawable/keyboard_key_feedback_background.9.png create mode 100755 core/res/res/drawable/keyboard_key_feedback_more_background.9.png create mode 100644 core/res/res/drawable/keyboard_popup_panel_background.9.png delete mode 100755 core/res/res/drawable/stat_notify_calibrate_compass.png create mode 100644 core/res/res/layout/input_method.xml create mode 100644 core/res/res/layout/input_method_extract_view.xml create mode 100644 core/res/res/layout/keyboard_key_preview.xml create mode 100644 core/res/res/layout/keyboard_popup_keyboard.xml create mode 100644 core/res/res/raw-de/loaderror.html create mode 100644 core/res/res/raw-de/nodomain.html rename core/res/{assets/webkit => res/raw}/loaderror.html (100%) rename core/res/{assets/webkit => res/raw}/nodomain.html (100%) delete mode 100644 core/res/res/values-de-rDE/strings.xml create mode 100644 core/res/res/values-de/arrays.xml create mode 100644 core/res/res/values-de/strings.xml create mode 100644 core/res/res/values-en-rAU/arrays.xml create mode 100644 core/res/res/values-en-rAU/strings.xml create mode 100644 core/res/res/values-en-rGB/arrays.xml create mode 100644 core/res/res/values-en-rSG/strings.xml create mode 100644 core/res/res/values-en-rUS/strings.xml delete mode 100644 core/res/res/values-it-rIT/strings.xml create mode 100644 core/res/res/values-ja/arrays.xml create mode 100644 core/res/res/values-ja/strings.xml create mode 100644 core/res/res/values-mcc204-de/strings.xml create mode 100644 core/res/res/values-mcc204-ja/strings.xml create mode 100644 core/res/res/values-mcc204/arrays.xml create mode 100644 core/res/res/values-mcc204/strings.xml create mode 100644 core/res/res/values-mcc230-de/strings.xml create mode 100644 core/res/res/values-mcc230-ja/strings.xml create mode 100644 core/res/res/values-mcc230/arrays.xml create mode 100644 core/res/res/values-mcc230/strings.xml create mode 100644 core/res/res/values-mcc232-de/strings.xml create mode 100644 core/res/res/values-mcc232-ja/strings.xml create mode 100644 core/res/res/values-mcc232/arrays.xml create mode 100644 core/res/res/values-mcc232/strings.xml create mode 100644 core/res/res/values-mcc234-de/strings.xml create mode 100644 core/res/res/values-mcc234-ja/strings.xml create mode 100644 core/res/res/values-mcc234/strings.xml create mode 100644 core/res/res/values-mcc260/arrays.xml create mode 100644 core/res/res/values-mcc260/strings.xml create mode 100644 core/res/res/values-mcc262-de/strings.xml create mode 100644 core/res/res/values-mcc262-ja/strings.xml create mode 100644 core/res/res/values-mcc262/arrays.xml create mode 100644 core/res/res/values-mcc262/strings.xml create mode 100755 data/localization/import-from-xtb delete mode 100755 docs/html/community/groups.jd mode change 100755 => 100644 docs/html/guide/appendix/faq/troubleshooting.jd create mode 100644 docs/html/guide/basics/android-sdk.jd create mode 100644 docs/html/guide/basics/app-framework.jd delete mode 100644 docs/html/guide/basics/index.jd mode change 100755 => 100644 docs/html/guide/basics/what-is-android.jd delete mode 100644 docs/html/guide/developing/aapt.jd delete mode 100644 docs/html/guide/developing/adb.jd delete mode 100755 docs/html/guide/developing/aidl.jd delete mode 100644 docs/html/guide/developing/ddms.jd delete mode 100644 docs/html/guide/developing/develop-and-debug.jd delete mode 100644 docs/html/guide/developing/draw9patch.jd delete mode 100755 docs/html/guide/developing/emulator.jd delete mode 100644 docs/html/guide/developing/hierarchy-viewer.jd delete mode 100644 docs/html/guide/developing/monkey.jd delete mode 100755 docs/html/guide/developing/othertools.jd delete mode 100644 docs/html/guide/developing/tools.jd create mode 100644 docs/html/guide/developing/tools/adt.jd create mode 100644 docs/html/guide/developing/tools/adt_download.jd mode change 100755 => 100644 docs/html/guide/developing/tools/aidl.jd mode change 100755 => 100644 docs/html/guide/developing/tools/emulator.jd mode change 100755 => 100644 docs/html/guide/developing/tools/othertools.jd delete mode 100644 docs/html/guide/developing/traceview.jd create mode 100644 docs/html/guide/publishing/app-signing.jd create mode 100644 docs/html/guide/publishing/preparing.jd create mode 100644 docs/html/guide/publishing/publishing.jd create mode 100644 docs/html/guide/publishing/versioning.jd delete mode 100644 docs/html/guide/topics/data/contentproviders.jd create mode 100644 docs/html/guide/topics/data/index.html create mode 100644 docs/html/guide/topics/drawing/index.html create mode 100644 docs/html/guide/topics/fundamentals.jd create mode 100644 docs/html/guide/topics/graphics/2d-graphics.jd create mode 100644 docs/html/guide/topics/graphics/index.jd create mode 100644 docs/html/guide/topics/graphics/opengl.jd create mode 100644 docs/html/guide/topics/intents/index.html create mode 100644 docs/html/guide/topics/location/geo/mapkey.jd create mode 100644 docs/html/guide/topics/location/index.jd create mode 100644 docs/html/guide/topics/media/index.jd create mode 100644 docs/html/guide/topics/resources/index.jd mode change 100755 => 100644 docs/html/guide/topics/resources/resources-i18n.jd create mode 100644 docs/html/guide/topics/sensors/accelerometer.jd create mode 100644 docs/html/guide/topics/sensors/camera.jd create mode 100644 docs/html/guide/topics/sensors/compass.jd create mode 100644 docs/html/guide/topics/sensors/index.jd create mode 100644 docs/html/guide/topics/views/custom-components.jd create mode 100644 docs/html/guide/topics/views/declaring-layout.jd create mode 100644 docs/html/guide/topics/views/how-android-draws.jd rename docs/html/guide/topics/views/{hierarchy.jd => intro.jd} (98%) create mode 100644 docs/html/guide/topics/wireless/bluetooth.jd create mode 100644 docs/html/guide/topics/wireless/index.jd create mode 100644 docs/html/guide/topics/wireless/wifi.jd create mode 100644 docs/html/guide/tutorials/notepad/index.jd create mode 100644 docs/html/guide/tutorials/views/hello-tabwidget.jd create mode 100644 docs/html/guide/tutorials/views/images/hello-tabwidget.png rename docs/html/guide/tutorials/views/{hello-views-index.jd => index.jd} (90%) mode change 100755 => 100644 docs/html/images/draw9patch-bad.png mode change 100755 => 100644 docs/html/images/draw9patch-norm.png mode change 100755 => 100644 docs/html/images/hierarchyviewer-layout.png mode change 100755 => 100644 docs/html/images/hierarchyviewer-pixelperfect.png create mode 100644 docs/html/images/mediaplayer_state_diagram.gif create mode 100644 docs/html/images/service_lifecycle.png mode change 100755 => 100644 docs/html/images/zippy_bullet.gif mode change 100755 => 100644 docs/html/images/zippy_closed.gif mode change 100755 => 100644 docs/html/images/zippy_open.gif delete mode 100644 docs/html/sdk/1.0_r1/download.jd delete mode 100644 docs/html/sdk/1.0_r1/download_list.jd delete mode 100644 docs/html/sdk/1.0_r1/download_previous.jd create mode 100644 docs/html/sdk/1.0_r1/requirements.jd delete mode 100644 docs/html/sdk/1.0_r1/sdk_toc.cs rename docs/html/sdk/{1.0_r1/terms_body.html => terms.jd} (99%) create mode 100644 graphics/java/android/graphics/RectF.aidl create mode 100644 im/java/android/im/BrandingResourceIDs.java create mode 100644 im/java/android/im/IImPlugin.aidl create mode 100644 im/java/android/im/ImPluginConsts.java create mode 100644 include/media/IMediaMetadataRetriever.h create mode 100644 include/media/IMediaRecorder.h create mode 100644 include/media/MediaMetadataRetrieverInterface.h create mode 100644 include/media/PVMediaRecorder.h create mode 100644 include/media/PVMetadataRetriever.h create mode 100644 include/private/media/VideoFrame.h delete mode 100644 include/ui/BlitHardware.h create mode 100644 include/ui/IOverlay.h create mode 100644 include/ui/Overlay.h create mode 100644 libs/audioflinger/A2dpAudioInterface.cpp create mode 100644 libs/audioflinger/A2dpAudioInterface.h delete mode 100644 libs/ui/BlitHardware.cpp create mode 100644 libs/ui/IOverlay.cpp create mode 100644 libs/ui/Overlay.cpp create mode 100644 location/java/android/location/GpsSatellite.java create mode 100644 location/java/android/location/GpsStatus.java delete mode 100644 location/java/android/location/GpsStatusListener.java create mode 100644 media/java/android/media/AmrInputStream.java create mode 100644 media/java/android/media/AudioFormat.java create mode 100644 media/java/android/media/AudioRecord.java create mode 100644 media/java/android/media/AudioTrack.java create mode 100644 media/jni/android_media_AmrInputStream.cpp create mode 100644 media/libmedia/IMediaMetadataRetriever.cpp create mode 100644 media/libmedia/IMediaRecorder.cpp create mode 100644 media/libmedia/mediarecorder.cpp create mode 100644 media/libmediaplayerservice/MediaRecorderClient.cpp create mode 100644 media/libmediaplayerservice/MediaRecorderClient.h create mode 100644 media/libmediaplayerservice/MetadataRetrieverClient.cpp create mode 100644 media/libmediaplayerservice/MetadataRetrieverClient.h create mode 100644 media/tests/MediaFrameworkTest/Android.mk create mode 100644 media/tests/MediaFrameworkTest/AndroidManifest.xml create mode 100644 media/tests/MediaFrameworkTest/res/drawable/icon.png create mode 100644 media/tests/MediaFrameworkTest/res/layout/movie_view.xml create mode 100644 media/tests/MediaFrameworkTest/res/layout/surface_view.xml create mode 100644 media/tests/MediaFrameworkTest/res/raw/shortmp3.mp3 create mode 100644 media/tests/MediaFrameworkTest/res/raw/testmidi.mid create mode 100644 media/tests/MediaFrameworkTest/res/raw/testmp3.mp3 create mode 100644 media/tests/MediaFrameworkTest/res/values/strings.xml create mode 100755 media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/MediaFrameworkPerfTestRunner.java create mode 100644 media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/MediaFrameworkTest.java create mode 100755 media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/MediaFrameworkTestRunner.java create mode 100755 media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/MediaFrameworkUnitTestRunner.java create mode 100755 media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/MediaNames.java create mode 100644 media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/CameraTest.java create mode 100644 media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/CodecTest.java create mode 100644 media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/MediaMetadataTest.java create mode 100644 media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/MediaPlayerApiTest.java create mode 100644 media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/MediaRecorderTest.java create mode 100644 media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/SimTonesTest.java create mode 100644 media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/TonesAutoTest.java create mode 100644 media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/performance/MediaPlayerPerformance.java create mode 100644 media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaMetadataRetrieverTest.java create mode 100644 media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaPlayerGetCurrentPositionStateUnitTest.java create mode 100644 media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaPlayerGetDurationStateUnitTest.java create mode 100644 media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaPlayerGetVideoHeightStateUnitTest.java create mode 100644 media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaPlayerGetVideoWidthStateUnitTest.java create mode 100644 media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaPlayerIsPlayingStateUnitTest.java create mode 100644 media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaPlayerMethodUnderTest.java create mode 100644 media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaPlayerPauseStateUnitTest.java create mode 100644 media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaPlayerResetStateUnitTest.java create mode 100644 media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaPlayerSeekToStateUnitTest.java create mode 100644 media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaPlayerSetAudioStreamTypeStateUnitTest.java create mode 100644 media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaPlayerSetLoopingStateUnitTest.java create mode 100644 media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaPlayerSetVolumeStateUnitTest.java create mode 100644 media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaPlayerStartStateUnitTest.java create mode 100644 media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaPlayerStateErrors.java create mode 100644 media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaPlayerStateUnitTestTemplate.java create mode 100644 media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaPlayerStopStateUnitTest.java create mode 100644 media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaRecorderMethodUnderTest.java create mode 100644 media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaRecorderPrepareStateUnitTest.java create mode 100644 media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaRecorderResetStateUnitTest.java create mode 100644 media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaRecorderSetAudioEncoderStateUnitTest.java create mode 100644 media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaRecorderSetAudioSourceStateUnitTest.java create mode 100644 media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaRecorderSetOutputFileStateUnitTest.java create mode 100644 media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaRecorderSetOutputFormatStateUnitTest.java create mode 100644 media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaRecorderStartStateUnitTest.java create mode 100644 media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaRecorderStateErrors.java create mode 100644 media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaRecorderStateUnitTestTemplate.java create mode 100644 media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaRecorderStopStateUnitTest.java create mode 100644 opengl/java/android/opengl/GLSurfaceView.java create mode 100644 opengl/tests/Android.mk create mode 100644 opengl/tests/angeles/Android.mk create mode 100644 opengl/tests/angeles/MODULE_LICENSE_BSD_OR_LGPL create mode 100644 opengl/tests/angeles/README.txt create mode 100644 opengl/tests/angeles/app-linux.c create mode 100644 opengl/tests/angeles/app.h create mode 100644 opengl/tests/angeles/cams.h create mode 100644 opengl/tests/angeles/demo.c create mode 100644 opengl/tests/angeles/gpustate.c create mode 100644 opengl/tests/angeles/include/GLES/egl.h create mode 100644 opengl/tests/angeles/include/GLES/egltypes.h create mode 100644 opengl/tests/angeles/include/GLES/gl.h create mode 100644 opengl/tests/angeles/license-BSD.txt create mode 100644 opengl/tests/angeles/license-LGPL.txt create mode 100644 opengl/tests/angeles/license.txt create mode 100644 opengl/tests/angeles/shapes.h create mode 100644 opengl/tests/filter/Android.mk create mode 100644 opengl/tests/filter/filter.c create mode 100644 opengl/tests/finish/Android.mk create mode 100644 opengl/tests/finish/finish.c create mode 100644 opengl/tests/sfsim/Android.mk create mode 100644 opengl/tests/sfsim/egl_surface.cpp create mode 100644 opengl/tests/sfsim/egl_surface.h create mode 100644 opengl/tests/sfsim/sfsim.c create mode 100644 opengl/tests/textures/Android.mk create mode 100644 opengl/tests/textures/textures.c create mode 100644 opengl/tests/tritex/Android.mk create mode 100644 opengl/tests/tritex/tritex.c create mode 100755 opengl/tools/glgen/gen create mode 100644 opengl/tools/glgen/glspec-1.0 create mode 100644 opengl/tools/glgen/glspec-1.0ext create mode 100644 opengl/tools/glgen/glspec-1.1 create mode 100644 opengl/tools/glgen/glspec-1.1ext create mode 100644 opengl/tools/glgen/glspec-1.1extpack create mode 100644 opengl/tools/glgen/glspec-checks create mode 100644 opengl/tools/glgen/src/CFunc.java create mode 100644 opengl/tools/glgen/src/CType.java create mode 100644 opengl/tools/glgen/src/CodeEmitter.java create mode 100644 opengl/tools/glgen/src/GenerateGL.java create mode 100644 opengl/tools/glgen/src/JFunc.java create mode 100644 opengl/tools/glgen/src/JType.java create mode 100644 opengl/tools/glgen/src/JniCodeEmitter.java create mode 100644 opengl/tools/glgen/src/ParameterChecker.java create mode 100644 opengl/tools/glgen/stubs/GL10ExtHeader.java-if create mode 100644 opengl/tools/glgen/stubs/GL10Header.java-if create mode 100644 opengl/tools/glgen/stubs/GL11ExtHeader.java-if create mode 100644 opengl/tools/glgen/stubs/GL11ExtensionPackHeader.java-if create mode 100644 opengl/tools/glgen/stubs/GL11Header.java-if create mode 100644 opengl/tools/glgen/stubs/GL11ImplHeader.java-impl create mode 100644 opengl/tools/glgen/stubs/GLCHeader.cpp create mode 100644 opengl/tools/glgen/stubs/GLHeader.java-if create mode 100644 opengl/tools/glgen/stubs/GLImplHeader.java-impl create mode 100644 opengl/tools/glgen/stubs/glGetString.cpp create mode 100644 opengl/tools/glgen/stubs/glGetString.java-10-if create mode 100644 opengl/tools/glgen/stubs/glGetString.java-if create mode 100644 opengl/tools/glgen/stubs/glGetString.java-impl create mode 100644 opengl/tools/glgen/stubs/glGetString.nativeReg create mode 100644 packages/SettingsProvider/res/values/strings.xml create mode 100644 services/java/com/android/server/DeviceStorageMonitorService.java create mode 100644 services/java/com/android/server/InputMethodManagerService.java delete mode 100644 services/java/com/android/server/am/BatteryStats.java create mode 100644 services/java/com/android/server/am/BatteryStatsService.java create mode 100644 telephony/java/android/telephony/JapanesePhoneNumberFormatter.java create mode 100644 telephony/java/android/telephony/NeighboringCellInfo.aidl create mode 100644 telephony/java/android/telephony/NeighboringCellInfo.java create mode 100644 telephony/java/com/android/internal/telephony/gsm/stk/CommandDetails.java delete mode 100644 telephony/java/com/android/internal/telephony/gsm/stk/CommandListener.java create mode 100644 telephony/java/com/android/internal/telephony/gsm/stk/CommandParamsFactory.java create mode 100644 telephony/java/com/android/internal/telephony/gsm/stk/Input.java create mode 100644 telephony/java/com/android/internal/telephony/gsm/stk/ResponseData.java create mode 100644 telephony/java/com/android/internal/telephony/gsm/stk/RilMessageDecoder.java delete mode 100644 telephony/java/com/android/internal/telephony/gsm/stk/StkAppInstaller.java delete mode 100644 telephony/java/com/android/internal/telephony/gsm/stk/StkAppStateReceiver.java create mode 100644 telephony/java/com/android/internal/telephony/gsm/stk/StkCmdMessage.java create mode 100644 telephony/java/com/android/internal/telephony/gsm/stk/StkLog.java create mode 100644 telephony/java/com/android/internal/telephony/gsm/stk/StkResponseMessage.java create mode 100644 telephony/java/com/android/internal/telephony/gsm/stk/TextMessage.java create mode 100644 telephony/java/com/android/internal/telephony/gsm/stk/ToneSettings.java create mode 100644 telephony/java/com/android/internal/telephony/gsm/stk/ValueParser.java create mode 100644 test-runner/android/test/ActivityInstrumentationTestCase2.java create mode 100644 test-runner/android/test/DatabaseTestUtils.java create mode 100644 test-runner/android/test/InstrumentationCoreTestRunner.java create mode 100755 test-runner/android/test/NoExecTestResult.java create mode 100644 test-runner/android/test/ProviderTestCase2.java create mode 100644 tests/AndroidTests/Android.mk create mode 100644 tests/AndroidTests/AndroidManifest.xml create mode 100644 tests/AndroidTests/DisabledTestApp/Android.mk create mode 100644 tests/AndroidTests/DisabledTestApp/AndroidManifest.xml create mode 100644 tests/AndroidTests/DisabledTestApp/src/com/android/unit_tests/disabled_app/EnabledActivity.java create mode 100644 tests/AndroidTests/EnabledTestApp/Android.mk create mode 100644 tests/AndroidTests/EnabledTestApp/AndroidManifest.xml create mode 100644 tests/AndroidTests/EnabledTestApp/src/com/android/unit_tests/enabled_app/DisabledActivity.java create mode 100644 tests/AndroidTests/EnabledTestApp/src/com/android/unit_tests/enabled_app/DisabledProvider.java create mode 100644 tests/AndroidTests/EnabledTestApp/src/com/android/unit_tests/enabled_app/DisabledReceiver.java create mode 100644 tests/AndroidTests/EnabledTestApp/src/com/android/unit_tests/enabled_app/DisabledService.java create mode 100644 tests/AndroidTests/EnabledTestApp/src/com/android/unit_tests/enabled_app/EnabledActivity.java create mode 100644 tests/AndroidTests/EnabledTestApp/src/com/android/unit_tests/enabled_app/EnabledProvider.java create mode 100644 tests/AndroidTests/EnabledTestApp/src/com/android/unit_tests/enabled_app/EnabledReceiver.java create mode 100644 tests/AndroidTests/EnabledTestApp/src/com/android/unit_tests/enabled_app/EnabledService.java create mode 100644 tests/AndroidTests/MODULE_LICENSE_APACHE2 create mode 100644 tests/AndroidTests/NOTICE create mode 100644 tests/AndroidTests/assets/text.txt create mode 100644 tests/AndroidTests/res/drawable/test128x96.png create mode 100644 tests/AndroidTests/res/drawable/test16x12.png create mode 100644 tests/AndroidTests/res/drawable/test256x192.png create mode 100644 tests/AndroidTests/res/drawable/test320x240.png create mode 100644 tests/AndroidTests/res/drawable/test32x24.png create mode 100644 tests/AndroidTests/res/drawable/test64x48.png create mode 100644 tests/AndroidTests/res/layout/layout_five.xml create mode 100644 tests/AndroidTests/res/layout/layout_four.xml create mode 100644 tests/AndroidTests/res/layout/layout_one.xml create mode 100644 tests/AndroidTests/res/layout/layout_six.xml create mode 100644 tests/AndroidTests/res/layout/layout_tag.xml create mode 100644 tests/AndroidTests/res/layout/layout_three.xml create mode 100644 tests/AndroidTests/res/layout/layout_two.xml create mode 100644 tests/AndroidTests/res/raw/calendarjs.txt create mode 100644 tests/AndroidTests/res/raw/calendarjsgz.jsgz create mode 100644 tests/AndroidTests/res/raw/calendarxml.xml create mode 100644 tests/AndroidTests/res/raw/calendarxmlgz.xmlgz create mode 100644 tests/AndroidTests/res/raw/medium.xml create mode 100644 tests/AndroidTests/res/raw/small.xml create mode 100644 tests/AndroidTests/res/raw/text.txt create mode 100644 tests/AndroidTests/res/raw/youtube.xml create mode 100644 tests/AndroidTests/res/values-12key/configVarying.xml create mode 100644 tests/AndroidTests/res/values-320x200/configVarying.xml create mode 100644 tests/AndroidTests/res/values-480x320/configVarying.xml create mode 100644 tests/AndroidTests/res/values-cs/strings.xml create mode 100644 tests/AndroidTests/res/values-dpad/configVarying.xml create mode 100644 tests/AndroidTests/res/values-finger/configVarying.xml create mode 100644 tests/AndroidTests/res/values-keysexposed/configVarying.xml create mode 100644 tests/AndroidTests/res/values-keyshidden/configVarying.xml create mode 100644 tests/AndroidTests/res/values-mcc111/configVarying.xml create mode 100644 tests/AndroidTests/res/values-mnc222/configVarying.xml create mode 100644 tests/AndroidTests/res/values-nokeys/configVarying.xml create mode 100644 tests/AndroidTests/res/values-nonav/configVarying.xml create mode 100644 tests/AndroidTests/res/values-notouch/configVarying.xml create mode 100644 tests/AndroidTests/res/values-qwerty/configVarying.xml create mode 100644 tests/AndroidTests/res/values-stylus/configVarying.xml create mode 100644 tests/AndroidTests/res/values-trackball/configVarying.xml create mode 100644 tests/AndroidTests/res/values-wheel/configVarying.xml create mode 100644 tests/AndroidTests/res/values-xx-rYY/configVarying.xml create mode 100644 tests/AndroidTests/res/values-xx/configVarying.xml create mode 100644 tests/AndroidTests/res/values/arrays.xml create mode 100644 tests/AndroidTests/res/values/attrs.xml create mode 100644 tests/AndroidTests/res/values/bools.xml create mode 100644 tests/AndroidTests/res/values/configVarying.xml create mode 100644 tests/AndroidTests/res/values/dimens.xml create mode 100644 tests/AndroidTests/res/values/strings.xml create mode 100644 tests/AndroidTests/res/values/styles.xml create mode 100644 tests/AndroidTests/res/xml/calendar.xml create mode 100644 tests/AndroidTests/res/xml/metadata.xml create mode 100644 tests/AndroidTests/res/xml/metadata_app.xml create mode 100644 tests/AndroidTests/res/xml/searchable.xml create mode 100755 tests/AndroidTests/run_test.sh create mode 100644 tests/AndroidTests/src/com/android/unit_tests/AndroidPerformanceTests.java create mode 100644 tests/AndroidTests/src/com/android/unit_tests/AndroidTests.java create mode 100644 tests/AndroidTests/src/com/android/unit_tests/ApacheHttpTests.java create mode 100755 tests/AndroidTests/src/com/android/unit_tests/AppCacheTest.java create mode 100644 tests/AndroidTests/src/com/android/unit_tests/ArrayListTest.java create mode 100644 tests/AndroidTests/src/com/android/unit_tests/BluetoothTest.java create mode 100644 tests/AndroidTests/src/com/android/unit_tests/BrickDeniedTest.java create mode 100644 tests/AndroidTests/src/com/android/unit_tests/BuildTest.java create mode 100644 tests/AndroidTests/src/com/android/unit_tests/CharSequencesTest.java create mode 100644 tests/AndroidTests/src/com/android/unit_tests/CheckinProviderTest.java create mode 100644 tests/AndroidTests/src/com/android/unit_tests/ComponentTest.java create mode 100644 tests/AndroidTests/src/com/android/unit_tests/ContentQueryMapTest.java create mode 100644 tests/AndroidTests/src/com/android/unit_tests/CreateViewTest.java create mode 100644 tests/AndroidTests/src/com/android/unit_tests/CursorWindowTest.java create mode 100644 tests/AndroidTests/src/com/android/unit_tests/DatabaseCursorTest.java create mode 100644 tests/AndroidTests/src/com/android/unit_tests/DatabaseGeneralTest.java create mode 100644 tests/AndroidTests/src/com/android/unit_tests/DatabaseLocaleTest.java create mode 100644 tests/AndroidTests/src/com/android/unit_tests/DatabasePerformanceTests.java create mode 100644 tests/AndroidTests/src/com/android/unit_tests/DatabaseStatementTest.java create mode 100644 tests/AndroidTests/src/com/android/unit_tests/DatabaseStressTest.java create mode 100644 tests/AndroidTests/src/com/android/unit_tests/DatabaseTests.java create mode 100644 tests/AndroidTests/src/com/android/unit_tests/ExpatPerformanceTest.java create mode 100644 tests/AndroidTests/src/com/android/unit_tests/GDataParseTest.java create mode 100644 tests/AndroidTests/src/com/android/unit_tests/GeocoderTest.java create mode 100644 tests/AndroidTests/src/com/android/unit_tests/GoogleHttpClientTest.java create mode 100644 tests/AndroidTests/src/com/android/unit_tests/GoogleLoginServiceTest.java create mode 100644 tests/AndroidTests/src/com/android/unit_tests/GraphicsPerformanceTests.java create mode 100644 tests/AndroidTests/src/com/android/unit_tests/HashMapTest.java create mode 100644 tests/AndroidTests/src/com/android/unit_tests/HashSetTest.java create mode 100644 tests/AndroidTests/src/com/android/unit_tests/HashtableTest.java create mode 100644 tests/AndroidTests/src/com/android/unit_tests/HeapTest.java create mode 100644 tests/AndroidTests/src/com/android/unit_tests/HtmlTest.java create mode 100644 tests/AndroidTests/src/com/android/unit_tests/InflateTest.java create mode 100644 tests/AndroidTests/src/com/android/unit_tests/InstanceofTest.java create mode 100644 tests/AndroidTests/src/com/android/unit_tests/JavaPerformanceTests.java create mode 100644 tests/AndroidTests/src/com/android/unit_tests/JniLibTest.java create mode 100644 tests/AndroidTests/src/com/android/unit_tests/LabelView.java create mode 100644 tests/AndroidTests/src/com/android/unit_tests/LinkedListTest.java create mode 100644 tests/AndroidTests/src/com/android/unit_tests/LinkifyTest.java create mode 100644 tests/AndroidTests/src/com/android/unit_tests/LocalSocketTest.java create mode 100644 tests/AndroidTests/src/com/android/unit_tests/LocationManagerTest.java create mode 100644 tests/AndroidTests/src/com/android/unit_tests/LogTest.java create mode 100644 tests/AndroidTests/src/com/android/unit_tests/MathTest.java create mode 100644 tests/AndroidTests/src/com/android/unit_tests/MenuTest.java create mode 100644 tests/AndroidTests/src/com/android/unit_tests/MonitorTest.java create mode 100644 tests/AndroidTests/src/com/android/unit_tests/ParentalControlTest.java create mode 100644 tests/AndroidTests/src/com/android/unit_tests/PerformanceTests.java create mode 100644 tests/AndroidTests/src/com/android/unit_tests/RegexTest.java create mode 100644 tests/AndroidTests/src/com/android/unit_tests/SMSTest.java create mode 100644 tests/AndroidTests/src/com/android/unit_tests/SSLTest.java create mode 100644 tests/AndroidTests/src/com/android/unit_tests/SafeSaxTest.java create mode 100644 tests/AndroidTests/src/com/android/unit_tests/SearchManagerTest.java create mode 100644 tests/AndroidTests/src/com/android/unit_tests/SerializationTest.java create mode 100644 tests/AndroidTests/src/com/android/unit_tests/SettingsProviderTest.java create mode 100644 tests/AndroidTests/src/com/android/unit_tests/SimplePullParserTest.java create mode 100644 tests/AndroidTests/src/com/android/unit_tests/SmsProviderTest.java create mode 100644 tests/AndroidTests/src/com/android/unit_tests/SpannedTest.java create mode 100644 tests/AndroidTests/src/com/android/unit_tests/StringTest.java create mode 100644 tests/AndroidTests/src/com/android/unit_tests/TestHttpClient.java create mode 100644 tests/AndroidTests/src/com/android/unit_tests/TestHttpServer.java create mode 100644 tests/AndroidTests/src/com/android/unit_tests/TestHttpService.java create mode 100644 tests/AndroidTests/src/com/android/unit_tests/TextLayoutTest.java create mode 100644 tests/AndroidTests/src/com/android/unit_tests/TextUtilsTest.java create mode 100644 tests/AndroidTests/src/com/android/unit_tests/TextViewPerformanceTest.java create mode 100644 tests/AndroidTests/src/com/android/unit_tests/TextViewTest.java create mode 100644 tests/AndroidTests/src/com/android/unit_tests/ThreadBitmapTest.java create mode 100644 tests/AndroidTests/src/com/android/unit_tests/TimeTest.java create mode 100644 tests/AndroidTests/src/com/android/unit_tests/TimeUtilsTest.java create mode 100644 tests/AndroidTests/src/com/android/unit_tests/TraceTest.java create mode 100644 tests/AndroidTests/src/com/android/unit_tests/TreeMapTest.java create mode 100644 tests/AndroidTests/src/com/android/unit_tests/TreeSetTest.java create mode 100644 tests/AndroidTests/src/com/android/unit_tests/UriMatcherTest.java create mode 100644 tests/AndroidTests/src/com/android/unit_tests/UriTest.java create mode 100644 tests/AndroidTests/src/com/android/unit_tests/UrlRulesTest.java create mode 100644 tests/AndroidTests/src/com/android/unit_tests/VectorTest.java create mode 100644 tests/AndroidTests/src/com/android/unit_tests/WebkitTest.java create mode 100644 tests/AndroidTests/src/com/android/unit_tests/activity/AbortReceiver.java create mode 100644 tests/AndroidTests/src/com/android/unit_tests/activity/ActivityManagerTest.java create mode 100644 tests/AndroidTests/src/com/android/unit_tests/activity/ActivityTests.java create mode 100644 tests/AndroidTests/src/com/android/unit_tests/activity/ActivityTestsBase.java create mode 100644 tests/AndroidTests/src/com/android/unit_tests/activity/BroadcastTest.java create mode 100644 tests/AndroidTests/src/com/android/unit_tests/activity/ClearTop.java create mode 100644 tests/AndroidTests/src/com/android/unit_tests/activity/IntentSenderTest.java create mode 100644 tests/AndroidTests/src/com/android/unit_tests/activity/LaunchTest.java create mode 100644 tests/AndroidTests/src/com/android/unit_tests/activity/LaunchpadActivity.java create mode 100644 tests/AndroidTests/src/com/android/unit_tests/activity/LaunchpadTabActivity.java create mode 100644 tests/AndroidTests/src/com/android/unit_tests/activity/LifecycleTest.java create mode 100644 tests/AndroidTests/src/com/android/unit_tests/activity/LocalActivity.java create mode 100644 tests/AndroidTests/src/com/android/unit_tests/activity/LocalDeniedReceiver.java rename telephony/java/com/android/internal/telephony/gsm/stk/CtlvCommandDetails.java => tests/AndroidTests/src/com/android/unit_tests/activity/LocalDeniedService.java (67%) create mode 100644 tests/AndroidTests/src/com/android/unit_tests/activity/LocalDialog.java create mode 100644 tests/AndroidTests/src/com/android/unit_tests/activity/LocalGrantedReceiver.java create mode 100644 tests/AndroidTests/src/com/android/unit_tests/activity/LocalGrantedService.java create mode 100644 tests/AndroidTests/src/com/android/unit_tests/activity/LocalProvider.java create mode 100644 tests/AndroidTests/src/com/android/unit_tests/activity/LocalReceiver.java create mode 100644 tests/AndroidTests/src/com/android/unit_tests/activity/LocalScreen.java create mode 100644 tests/AndroidTests/src/com/android/unit_tests/activity/LocalService.java create mode 100644 tests/AndroidTests/src/com/android/unit_tests/activity/MetaDataTest.java create mode 100644 tests/AndroidTests/src/com/android/unit_tests/activity/RemoteDeniedReceiver.java create mode 100644 tests/AndroidTests/src/com/android/unit_tests/activity/RemoteGrantedReceiver.java create mode 100644 tests/AndroidTests/src/com/android/unit_tests/activity/RemoteReceiver.java create mode 100644 tests/AndroidTests/src/com/android/unit_tests/activity/RemoteSubActivityScreen.java create mode 100644 tests/AndroidTests/src/com/android/unit_tests/activity/ResultReceiver.java create mode 100644 tests/AndroidTests/src/com/android/unit_tests/activity/ServiceTest.java create mode 100644 tests/AndroidTests/src/com/android/unit_tests/activity/SetTimeZonePermissionsTest.java create mode 100644 tests/AndroidTests/src/com/android/unit_tests/activity/SubActivityScreen.java create mode 100644 tests/AndroidTests/src/com/android/unit_tests/activity/SubActivityTest.java create mode 100644 tests/AndroidTests/src/com/android/unit_tests/activity/TestedActivity.java create mode 100644 tests/AndroidTests/src/com/android/unit_tests/activity/TestedScreen.java create mode 100644 tests/AndroidTests/src/com/android/unit_tests/content/ArrayTest.java create mode 100644 tests/AndroidTests/src/com/android/unit_tests/content/AssetTest.java create mode 100644 tests/AndroidTests/src/com/android/unit_tests/content/ConfigTest.java create mode 100644 tests/AndroidTests/src/com/android/unit_tests/content/ContentTests.java create mode 100644 tests/AndroidTests/src/com/android/unit_tests/content/FractionTest.java create mode 100644 tests/AndroidTests/src/com/android/unit_tests/content/IntentFilterTest.java create mode 100644 tests/AndroidTests/src/com/android/unit_tests/content/PluralResourcesTest.java create mode 100644 tests/AndroidTests/src/com/android/unit_tests/content/PrimitiveTest.java create mode 100644 tests/AndroidTests/src/com/android/unit_tests/content/RawResourceTest.java create mode 100644 tests/AndroidTests/src/com/android/unit_tests/content/ResourceNameTest.java create mode 100644 tests/AndroidTests/src/com/android/unit_tests/content/ResourceTests.java create mode 100644 tests/AndroidTests/src/com/android/unit_tests/graphics/BitmapTest.java create mode 100644 tests/AndroidTests/src/com/android/unit_tests/graphics/GraphicsTests.java create mode 100644 tests/AndroidTests/src/com/android/unit_tests/graphics/TypefaceTest.java create mode 100644 tests/AndroidTests/src/com/android/unit_tests/os/AidlTest.aidl create mode 100644 tests/AndroidTests/src/com/android/unit_tests/os/AidlTest.java create mode 100644 tests/AndroidTests/src/com/android/unit_tests/os/BroadcasterTest.java create mode 100644 tests/AndroidTests/src/com/android/unit_tests/os/FileObserverTest.java create mode 100644 tests/AndroidTests/src/com/android/unit_tests/os/FileUtilsTest.java create mode 100644 tests/AndroidTests/src/com/android/unit_tests/os/HandlerTester.java create mode 100644 tests/AndroidTests/src/com/android/unit_tests/os/HandlerThreadTest.java create mode 100644 tests/AndroidTests/src/com/android/unit_tests/os/IAidlTest.aidl create mode 100644 tests/AndroidTests/src/com/android/unit_tests/os/IdleHandlerTest.java create mode 100644 tests/AndroidTests/src/com/android/unit_tests/os/MemoryFileTest.java create mode 100644 tests/AndroidTests/src/com/android/unit_tests/os/MessageQueueTest.java create mode 100644 tests/AndroidTests/src/com/android/unit_tests/os/MessengerService.java create mode 100644 tests/AndroidTests/src/com/android/unit_tests/os/MessengerTest.java create mode 100644 tests/AndroidTests/src/com/android/unit_tests/os/OsTests.java create mode 100644 tests/AndroidTests/src/com/android/unit_tests/os/PowerManagerTest.java create mode 100644 tests/AndroidTests/src/com/android/unit_tests/os/SystemPropertiesTest.java create mode 100644 tests/AndroidTests/src/com/android/unit_tests/os/TestHandlerThread.java create mode 100644 tests/CoreTests/Android.mk create mode 100644 tests/CoreTests/MODULE_LICENSE_APACHE2 create mode 100644 tests/CoreTests/android/Android.mk create mode 100644 tests/CoreTests/android/AndroidManifest.xml create mode 100644 tests/CoreTests/android/content/ObserverNodeTest.java create mode 100644 tests/CoreTests/android/content/SyncStorageEngineTest.java create mode 100644 tests/CoreTests/android/core/AbstractJDBCDriverTest.java create mode 100644 tests/CoreTests/android/core/ArrayListTest.java create mode 100644 tests/CoreTests/android/core/AtParserTest.java create mode 100644 tests/CoreTests/android/core/BooleanTest.java create mode 100644 tests/CoreTests/android/core/BufferedInputStreamTest.java create mode 100644 tests/CoreTests/android/core/BufferedOutputStreamTest.java create mode 100644 tests/CoreTests/android/core/BufferedReaderTest.java create mode 100644 tests/CoreTests/android/core/BufferedWriterTest.java create mode 100644 tests/CoreTests/android/core/ByteArrayInputStreamTest.java create mode 100644 tests/CoreTests/android/core/ByteArrayOutputStreamTest.java create mode 100644 tests/CoreTests/android/core/CharArrayReaderTest.java create mode 100644 tests/CoreTests/android/core/CharArrayWriterTest.java create mode 100644 tests/CoreTests/android/core/ChecksumTest.java create mode 100644 tests/CoreTests/android/core/ClassLoaderTest.java create mode 100644 tests/CoreTests/android/core/ClassTest.java create mode 100644 tests/CoreTests/android/core/CoreTests.java create mode 100644 tests/CoreTests/android/core/CryptoTest.java create mode 100644 tests/CoreTests/android/core/DataInputStreamTest.java create mode 100644 tests/CoreTests/android/core/DataOutputStreamTest.java create mode 100644 tests/CoreTests/android/core/DatagramTest.java create mode 100644 tests/CoreTests/android/core/DeflateTest.java create mode 100644 tests/CoreTests/android/core/EnumTest.java create mode 100644 tests/CoreTests/android/core/FileTest.java create mode 100644 tests/CoreTests/android/core/FloatDoubleTest.java create mode 100644 tests/CoreTests/android/core/GZIPStreamTest.java create mode 100644 tests/CoreTests/android/core/HashMapPerfTest.java create mode 100644 tests/CoreTests/android/core/HashMapTest.java create mode 100644 tests/CoreTests/android/core/HttpConstants.java create mode 100644 tests/CoreTests/android/core/IOUtil.java create mode 100644 tests/CoreTests/android/core/InetAddrTest.java create mode 100644 tests/CoreTests/android/core/InputStreamReaderTest.java create mode 100644 tests/CoreTests/android/core/JavaTests.java create mode 100644 tests/CoreTests/android/core/LineNumberReaderTest.java create mode 100644 tests/CoreTests/android/core/LocaleTest.java create mode 100644 tests/CoreTests/android/core/LowLevelNetRunner.java create mode 100644 tests/CoreTests/android/core/MathTest.java create mode 100644 tests/CoreTests/android/core/MiscRegressionTest.java create mode 100644 tests/CoreTests/android/core/NIOTest.java create mode 100644 tests/CoreTests/android/core/OutputStreamWriterTest.java create mode 100644 tests/CoreTests/android/core/ParseIntTest.java create mode 100644 tests/CoreTests/android/core/PipedStreamTest.java create mode 100644 tests/CoreTests/android/core/PrintWriterTest.java create mode 100644 tests/CoreTests/android/core/PushbackInputStreamTest.java create mode 100644 tests/CoreTests/android/core/PushbackReaderTest.java create mode 100644 tests/CoreTests/android/core/ReflectArrayTest.java create mode 100644 tests/CoreTests/android/core/RegexTest.java create mode 100644 tests/CoreTests/android/core/RequestAPITest.java create mode 100644 tests/CoreTests/android/core/SQLiteJDBCDriverTest.java create mode 100644 tests/CoreTests/android/core/SSLSocketTest.java create mode 100644 tests/CoreTests/android/core/Sha1Test.java create mode 100644 tests/CoreTests/android/core/SocketTest.java create mode 100644 tests/CoreTests/android/core/StreamTokenizerTest.java create mode 100644 tests/CoreTests/android/core/StrictMathTest.java create mode 100644 tests/CoreTests/android/core/StringReaderTest.java create mode 100644 tests/CoreTests/android/core/StringTest.java create mode 100644 tests/CoreTests/android/core/StringWriterTest.java create mode 100644 tests/CoreTests/android/core/TestEventHandler.java create mode 100644 tests/CoreTests/android/core/TestHandler.java create mode 100644 tests/CoreTests/android/core/TestWebData.java create mode 100644 tests/CoreTests/android/core/TestWebServer.java create mode 100644 tests/CoreTests/android/core/TreeMapTest.java create mode 100644 tests/CoreTests/android/core/URITest.java create mode 100644 tests/CoreTests/android/core/URLTest.java create mode 100644 tests/CoreTests/android/core/ZipFileTest.java create mode 100644 tests/CoreTests/android/core/ZipStreamTest.java create mode 100644 tests/CoreTests/android/database/MatrixCursorTest.java create mode 100644 tests/CoreTests/android/graphics/ColorStateListTest.java create mode 100644 tests/CoreTests/android/graphics/drawable/StateListDrawableTest.java create mode 100644 tests/CoreTests/android/location/LocationManagerProximityTest.java create mode 100644 tests/CoreTests/android/location/LocationTest.java create mode 100644 tests/CoreTests/android/res/color/color1.xml create mode 100644 tests/CoreTests/android/res/color/color_no_default.xml create mode 100644 tests/CoreTests/android/res/values/colors.xml create mode 100644 tests/CoreTests/android/test/AndroidTestRunnerTest.java create mode 100644 tests/CoreTests/android/test/InstrumentationTestRunnerTest.java create mode 100644 tests/CoreTests/android/test/StubTestBrowserActivity.java create mode 100644 tests/CoreTests/android/test/TestBrowserActivityTest.java create mode 100644 tests/CoreTests/android/test/TestBrowserControllerImplTest.java create mode 100644 tests/CoreTests/android/test/TestBrowserTests.java create mode 100644 tests/CoreTests/android/test/TestCaseUtilTest.java create mode 100644 tests/CoreTests/android/test/suitebuilder/AssignableFromTest.java create mode 100644 tests/CoreTests/android/test/suitebuilder/InstrumentationTestSuiteBuilderTest.java create mode 100644 tests/CoreTests/android/test/suitebuilder/ListTestCaseNames.java create mode 100644 tests/CoreTests/android/test/suitebuilder/SmokeTestSuiteBuilderTest.java create mode 100644 tests/CoreTests/android/test/suitebuilder/TestSuiteBuilderTest.java create mode 100644 tests/CoreTests/android/test/suitebuilder/UnitTestSuiteBuilderTest.java create mode 100644 tests/CoreTests/android/test/suitebuilder/annotation/HasAnnotationTest.java create mode 100644 tests/CoreTests/android/test/suitebuilder/annotation/HasClassAnnotationTest.java create mode 100644 tests/CoreTests/android/test/suitebuilder/annotation/HasMethodAnnotationTest.java create mode 100644 tests/CoreTests/android/test/suitebuilder/examples/OuterTest.java create mode 100644 tests/CoreTests/android/test/suitebuilder/examples/error/ErrorTest.java create mode 100644 tests/CoreTests/android/test/suitebuilder/examples/error/FailingTest.java create mode 100644 tests/CoreTests/android/test/suitebuilder/examples/instrumentation/InstrumentationTest.java create mode 100644 tests/CoreTests/android/test/suitebuilder/examples/nested/Level1Test.java create mode 100644 tests/CoreTests/android/test/suitebuilder/examples/nested/nested/Level2Test.java create mode 100644 tests/CoreTests/android/test/suitebuilder/examples/simple/AnotherSimpleTest.java create mode 100644 tests/CoreTests/android/test/suitebuilder/examples/simple/SimpleTest.java create mode 100644 tests/CoreTests/android/test/suitebuilder/examples/smoke/NonSmokeTest.java create mode 100644 tests/CoreTests/android/test/suitebuilder/examples/smoke/SmokeTest.java create mode 100644 tests/CoreTests/android/test/suitebuilder/examples/subclass/SubclassTest.java create mode 100644 tests/CoreTests/android/test/suitebuilder/examples/subclass/SuperclassTest.java create mode 100644 tests/CoreTests/android/test/suitebuilder/examples/suppress/PartiallySuppressedTest.java create mode 100644 tests/CoreTests/android/test/suitebuilder/examples/suppress/SuppressedTest.java create mode 100644 tests/CoreTests/android/util/DayOfMonthCursorTest.java create mode 100644 tests/CoreTests/android/util/FloatMathTest.java create mode 100644 tests/CoreTests/android/util/MonthDisplayHelperTest.java create mode 100644 tests/CoreTests/android/util/StateSetTest.java create mode 100644 tests/CoreTests/android/view/FocusFinderTest.java create mode 100644 tests/CoreTests/android/view/MockView.java create mode 100644 tests/CoreTests/android/view/ViewGroupAttributesTest.java create mode 100644 tests/CoreTests/android/webkit/CookieTest.java create mode 100644 tests/CoreTests/com/android/internal/telephony/ATResponseParserTest.java create mode 100644 tests/CoreTests/com/android/internal/telephony/PhoneNumberUtilsTest.java create mode 100644 tests/CoreTests/com/android/internal/telephony/PhoneNumberWatcherTest.java create mode 100644 tests/CoreTests/com/android/internal/telephony/TelephonyTests.java create mode 100644 tests/CoreTests/com/android/internal/telephony/TestPhoneNotifier.java create mode 100644 tests/CoreTests/com/android/internal/telephony/gsm/AdnRecordTest.java create mode 100644 tests/CoreTests/com/android/internal/telephony/gsm/GSMPhoneTest.java create mode 100644 tests/CoreTests/com/android/internal/telephony/gsm/GsmAlphabetTest.java create mode 100644 tests/CoreTests/com/android/internal/telephony/gsm/SMSDispatcherTest.java create mode 100644 tests/CoreTests/com/android/internal/telephony/gsm/SimPhoneBookTest.java create mode 100644 tests/CoreTests/com/android/internal/telephony/gsm/SimSmsTest.java create mode 100644 tests/CoreTests/com/android/internal/telephony/gsm/SimUtilsTest.java create mode 100644 tests/CoreTests/com/android/internal/util/PredicatesTest.java create mode 100755 tests/CoreTests/run_core_test.sh create mode 100755 tests/CoreTests/run_junit.sh create mode 100644 tests/DumpRenderTree/Android.mk create mode 100644 tests/DumpRenderTree/AndroidManifest.xml create mode 100644 tests/DumpRenderTree/src/com/android/dumprendertree/CallbackProxy.java create mode 100644 tests/DumpRenderTree/src/com/android/dumprendertree/EventSender.java create mode 100644 tests/DumpRenderTree/src/com/android/dumprendertree/FileFilter.java create mode 100644 tests/DumpRenderTree/src/com/android/dumprendertree/FileList.java create mode 100644 tests/DumpRenderTree/src/com/android/dumprendertree/HTMLHostActivity.java create mode 100644 tests/DumpRenderTree/src/com/android/dumprendertree/HTMLHostApp.java create mode 100644 tests/DumpRenderTree/src/com/android/dumprendertree/HTMLHostCallbackInterface.java create mode 100644 tests/DumpRenderTree/src/com/android/dumprendertree/LayoutTestController.java create mode 100755 tests/DumpRenderTree/src/com/android/dumprendertree/LayoutTestsAutoRunner.java create mode 100644 tests/DumpRenderTree/src/com/android/dumprendertree/LayoutTestsAutoTest.java create mode 100644 tests/DumpRenderTree/src/com/android/dumprendertree/Menu.java create mode 100644 tests/DumpRenderTree/src/com/android/dumprendertree/WebViewEventSender.java create mode 100644 tests/FrameworkTest/Android.mk create mode 100644 tests/FrameworkTest/AndroidManifest.xml create mode 100644 tests/FrameworkTest/README create mode 100644 tests/FrameworkTest/res/drawable/big_drawable_background.9.png create mode 100644 tests/FrameworkTest/res/drawable/bitmap_drawable.xml create mode 100644 tests/FrameworkTest/res/drawable/black_square.png create mode 100644 tests/FrameworkTest/res/drawable/black_square_stretchable.9.png create mode 100644 tests/FrameworkTest/res/drawable/box.xml create mode 100644 tests/FrameworkTest/res/drawable/drawable_background.9.png create mode 100644 tests/FrameworkTest/res/drawable/sym_now_playing_pause_1.png create mode 100644 tests/FrameworkTest/res/drawable/sym_now_playing_skip_backward_1.png create mode 100644 tests/FrameworkTest/res/drawable/sym_now_playing_skip_forward_1.png create mode 100644 tests/FrameworkTest/res/layout/add_column_in_table.xml create mode 100644 tests/FrameworkTest/res/layout/baseline_0width_and_weight.xml create mode 100644 tests/FrameworkTest/res/layout/baseline_buttons.xml create mode 100644 tests/FrameworkTest/res/layout/baseline_center_gravity.xml create mode 100644 tests/FrameworkTest/res/layout/brightness_limit.xml create mode 100644 tests/FrameworkTest/res/layout/descendant_focusability.xml create mode 100644 tests/FrameworkTest/res/layout/disabled.xml create mode 100644 tests/FrameworkTest/res/layout/drawable_background_minimum_size.xml create mode 100644 tests/FrameworkTest/res/layout/fill_in_wrap.xml create mode 100644 tests/FrameworkTest/res/layout/focus_after_removal.xml create mode 100644 tests/FrameworkTest/res/layout/focus_listener.xml create mode 100644 tests/FrameworkTest/res/layout/framelayout_gravity.xml create mode 100644 tests/FrameworkTest/res/layout/framelayout_margin.xml create mode 100644 tests/FrameworkTest/res/layout/grid_in_horizontal.xml create mode 100644 tests/FrameworkTest/res/layout/grid_in_vertical.xml create mode 100644 tests/FrameworkTest/res/layout/grid_padding.xml create mode 100644 tests/FrameworkTest/res/layout/grid_scroll_listener.xml create mode 100644 tests/FrameworkTest/res/layout/grid_thrasher.xml create mode 100644 tests/FrameworkTest/res/layout/include_button.xml create mode 100644 tests/FrameworkTest/res/layout/include_button_with_size.xml create mode 100644 tests/FrameworkTest/res/layout/include_tag.xml create mode 100644 tests/FrameworkTest/res/layout/inflated_expandablelistview.xml create mode 100644 tests/FrameworkTest/res/layout/linear_layout_buttons.xml create mode 100644 tests/FrameworkTest/res/layout/linear_layout_edittext_then_button.xml create mode 100644 tests/FrameworkTest/res/layout/linear_layout_grid.xml create mode 100644 tests/FrameworkTest/res/layout/linear_layout_listview_height.xml create mode 100644 tests/FrameworkTest/res/layout/linear_layout_spinner_then_button.xml create mode 100644 tests/FrameworkTest/res/layout/linear_layout_textviews.xml create mode 100644 tests/FrameworkTest/res/layout/linear_layout_weight.xml create mode 100644 tests/FrameworkTest/res/layout/list_dividers.xml create mode 100644 tests/FrameworkTest/res/layout/list_filter.xml create mode 100644 tests/FrameworkTest/res/layout/list_in_horizontal.xml create mode 100644 tests/FrameworkTest/res/layout/list_in_vertical.xml create mode 100644 tests/FrameworkTest/res/layout/list_recycler_profiling.xml create mode 100644 tests/FrameworkTest/res/layout/list_scroll_listener.xml create mode 100644 tests/FrameworkTest/res/layout/list_take_focus_from_side.xml create mode 100644 tests/FrameworkTest/res/layout/list_thrasher.xml create mode 100644 tests/FrameworkTest/res/layout/list_with_button_above.xml create mode 100644 tests/FrameworkTest/res/layout/list_with_disappearing_item_bug_item.xml create mode 100644 tests/FrameworkTest/res/layout/list_with_empty_view.xml create mode 100644 tests/FrameworkTest/res/layout/longpress.xml create mode 100644 tests/FrameworkTest/res/layout/mail_message.xml create mode 100644 tests/FrameworkTest/res/layout/merge_child.xml create mode 100644 tests/FrameworkTest/res/layout/merge_tag.xml create mode 100644 tests/FrameworkTest/res/layout/popup_window_visibility.xml create mode 100644 tests/FrameworkTest/res/layout/pre_draw_listener.xml create mode 100644 tests/FrameworkTest/res/layout/remote_view_host.xml create mode 100644 tests/FrameworkTest/res/layout/remote_view_test_bad_1.xml create mode 100644 tests/FrameworkTest/res/layout/remote_view_test_bad_2.xml create mode 100644 tests/FrameworkTest/res/layout/remote_view_test_good.xml create mode 100644 tests/FrameworkTest/res/layout/scroll_to_rect_with_internal_scroll.xml create mode 100644 tests/FrameworkTest/res/layout/scroll_to_rectangle.xml create mode 100644 tests/FrameworkTest/res/layout/scrollview_linear_layout.xml create mode 100644 tests/FrameworkTest/res/layout/scrollview_with_webviews.xml create mode 100644 tests/FrameworkTest/res/layout/table_layout_cell_span.xml create mode 100644 tests/FrameworkTest/res/layout/table_layout_fixed_width.xml create mode 100644 tests/FrameworkTest/res/layout/table_layout_horizontal_gravity.xml create mode 100644 tests/FrameworkTest/res/layout/table_layout_vertical_gravity.xml create mode 100644 tests/FrameworkTest/res/layout/table_layout_weight.xml create mode 100644 tests/FrameworkTest/res/layout/translucent_background.xml create mode 100644 tests/FrameworkTest/res/layout/viewgroupchildren.xml create mode 100644 tests/FrameworkTest/res/layout/viewstub.xml create mode 100644 tests/FrameworkTest/res/layout/visibility.xml create mode 100644 tests/FrameworkTest/res/layout/weight_sum.xml create mode 100644 tests/FrameworkTest/res/layout/with_bitmap_background.xml create mode 100644 tests/FrameworkTest/res/layout/zero_sized.xml create mode 100644 tests/FrameworkTest/res/values/arrays.xml create mode 100644 tests/FrameworkTest/res/values/attrs.xml create mode 100644 tests/FrameworkTest/res/values/colors.xml create mode 100644 tests/FrameworkTest/res/values/strings.xml create mode 100644 tests/FrameworkTest/res/values/styles.xml create mode 100644 tests/FrameworkTest/src/com/android/frameworktest/FrameworkTestApplication.java create mode 100644 tests/FrameworkTest/src/com/android/frameworktest/activity/TranslucentFancyActivity.java create mode 100644 tests/FrameworkTest/src/com/android/frameworktest/drawable/BitmapDrawable.java create mode 100644 tests/FrameworkTest/src/com/android/frameworktest/drawable/DrawableBgMinSize.java create mode 100644 tests/FrameworkTest/src/com/android/frameworktest/expandablelistview/ExpandableListSimple.java create mode 100644 tests/FrameworkTest/src/com/android/frameworktest/expandablelistview/ExpandableListWithHeaders.java create mode 100644 tests/FrameworkTest/src/com/android/frameworktest/expandablelistview/InflatedExpandableListView.java create mode 100644 tests/FrameworkTest/src/com/android/frameworktest/focus/AdjacentVerticalRectLists.java create mode 100644 tests/FrameworkTest/src/com/android/frameworktest/focus/DescendantFocusability.java create mode 100644 tests/FrameworkTest/src/com/android/frameworktest/focus/FocusAfterRemoval.java create mode 100644 tests/FrameworkTest/src/com/android/frameworktest/focus/GoneParentFocusedChild.java create mode 100644 tests/FrameworkTest/src/com/android/frameworktest/focus/HorizontalFocusSearch.java create mode 100644 tests/FrameworkTest/src/com/android/frameworktest/focus/LinearLayoutGrid.java create mode 100644 tests/FrameworkTest/src/com/android/frameworktest/focus/ListOfButtons.java create mode 100644 tests/FrameworkTest/src/com/android/frameworktest/focus/ListOfEditTexts.java create mode 100644 tests/FrameworkTest/src/com/android/frameworktest/focus/ListOfInternalSelectionViews.java create mode 100644 tests/FrameworkTest/src/com/android/frameworktest/focus/ListWithFooterViewAndNewLabels.java create mode 100644 tests/FrameworkTest/src/com/android/frameworktest/focus/ListWithMailMessages.java create mode 100644 tests/FrameworkTest/src/com/android/frameworktest/focus/RequestFocus.java create mode 100644 tests/FrameworkTest/src/com/android/frameworktest/focus/VerticalFocusSearch.java create mode 100644 tests/FrameworkTest/src/com/android/frameworktest/gridview/GridDelete.java create mode 100644 tests/FrameworkTest/src/com/android/frameworktest/gridview/GridInHorizontal.java create mode 100644 tests/FrameworkTest/src/com/android/frameworktest/gridview/GridInVertical.java create mode 100644 tests/FrameworkTest/src/com/android/frameworktest/gridview/GridPadding.java create mode 100644 tests/FrameworkTest/src/com/android/frameworktest/gridview/GridScrollListener.java create mode 100644 tests/FrameworkTest/src/com/android/frameworktest/gridview/GridSetSelection.java create mode 100644 tests/FrameworkTest/src/com/android/frameworktest/gridview/GridSetSelectionMany.java create mode 100644 tests/FrameworkTest/src/com/android/frameworktest/gridview/GridSetSelectionStackFromBottom.java create mode 100644 tests/FrameworkTest/src/com/android/frameworktest/gridview/GridSetSelectionStackFromBottomMany.java create mode 100644 tests/FrameworkTest/src/com/android/frameworktest/gridview/GridSimple.java create mode 100644 tests/FrameworkTest/src/com/android/frameworktest/gridview/GridSingleColumn.java create mode 100644 tests/FrameworkTest/src/com/android/frameworktest/gridview/GridStackFromBottom.java create mode 100644 tests/FrameworkTest/src/com/android/frameworktest/gridview/GridStackFromBottomMany.java create mode 100644 tests/FrameworkTest/src/com/android/frameworktest/gridview/GridThrasher.java create mode 100644 tests/FrameworkTest/src/com/android/frameworktest/gridview/GridVerticalSpacing.java create mode 100644 tests/FrameworkTest/src/com/android/frameworktest/gridview/GridVerticalSpacingStackFromBottom.java create mode 100644 tests/FrameworkTest/src/com/android/frameworktest/layout/frame/FrameLayoutGravity.java create mode 100644 tests/FrameworkTest/src/com/android/frameworktest/layout/frame/FrameLayoutMargin.java create mode 100644 tests/FrameworkTest/src/com/android/frameworktest/layout/linear/BaselineAlignmentCenterGravity.java create mode 100644 tests/FrameworkTest/src/com/android/frameworktest/layout/linear/BaselineAlignmentZeroWidthAndWeight.java create mode 100644 tests/FrameworkTest/src/com/android/frameworktest/layout/linear/BaselineButtons.java create mode 100644 tests/FrameworkTest/src/com/android/frameworktest/layout/linear/ExceptionTextView.java create mode 100644 tests/FrameworkTest/src/com/android/frameworktest/layout/linear/FillInWrap.java create mode 100644 tests/FrameworkTest/src/com/android/frameworktest/layout/linear/HorizontalOrientationVerticalAlignment.java create mode 100644 tests/FrameworkTest/src/com/android/frameworktest/layout/linear/LLEditTextThenButton.java create mode 100644 tests/FrameworkTest/src/com/android/frameworktest/layout/linear/LLOfButtons1.java create mode 100644 tests/FrameworkTest/src/com/android/frameworktest/layout/linear/LLOfButtons2.java create mode 100644 tests/FrameworkTest/src/com/android/frameworktest/layout/linear/LLOfTwoFocusableInTouchMode.java create mode 100644 tests/FrameworkTest/src/com/android/frameworktest/layout/linear/LinearLayoutEditTexts.java create mode 100644 tests/FrameworkTest/src/com/android/frameworktest/layout/linear/Weight.java create mode 100644 tests/FrameworkTest/src/com/android/frameworktest/layout/linear/WeightSum.java create mode 100644 tests/FrameworkTest/src/com/android/frameworktest/layout/table/AddColumn.java create mode 100644 tests/FrameworkTest/src/com/android/frameworktest/layout/table/CellSpan.java create mode 100644 tests/FrameworkTest/src/com/android/frameworktest/layout/table/FixedWidth.java create mode 100644 tests/FrameworkTest/src/com/android/frameworktest/layout/table/HorizontalGravity.java create mode 100644 tests/FrameworkTest/src/com/android/frameworktest/layout/table/VerticalGravity.java create mode 100644 tests/FrameworkTest/src/com/android/frameworktest/layout/table/Weight.java create mode 100644 tests/FrameworkTest/src/com/android/frameworktest/listview/AdjacentListsWithAdjacentISVsInside.java create mode 100644 tests/FrameworkTest/src/com/android/frameworktest/listview/ListBottomGravity.java create mode 100644 tests/FrameworkTest/src/com/android/frameworktest/listview/ListBottomGravityMany.java create mode 100644 tests/FrameworkTest/src/com/android/frameworktest/listview/ListButtonsDiagonalAcrossItems.java create mode 100644 tests/FrameworkTest/src/com/android/frameworktest/listview/ListDividers.java create mode 100644 tests/FrameworkTest/src/com/android/frameworktest/listview/ListEndingWithMultipleSeparators.java create mode 100644 tests/FrameworkTest/src/com/android/frameworktest/listview/ListFilter.java create mode 100644 tests/FrameworkTest/src/com/android/frameworktest/listview/ListGetSelectedView.java create mode 100644 tests/FrameworkTest/src/com/android/frameworktest/listview/ListHeterogeneous.java create mode 100644 tests/FrameworkTest/src/com/android/frameworktest/listview/ListHorizontalFocusWithinItemWins.java create mode 100644 tests/FrameworkTest/src/com/android/frameworktest/listview/ListInHorizontal.java create mode 100644 tests/FrameworkTest/src/com/android/frameworktest/listview/ListInVertical.java create mode 100644 tests/FrameworkTest/src/com/android/frameworktest/listview/ListInterleaveFocusables.java create mode 100644 tests/FrameworkTest/src/com/android/frameworktest/listview/ListItemFocusableAboveUnfocusable.java create mode 100644 tests/FrameworkTest/src/com/android/frameworktest/listview/ListItemFocusablesClose.java create mode 100644 tests/FrameworkTest/src/com/android/frameworktest/listview/ListItemFocusablesFarApart.java create mode 100644 tests/FrameworkTest/src/com/android/frameworktest/listview/ListItemISVAndButton.java create mode 100644 tests/FrameworkTest/src/com/android/frameworktest/listview/ListItemsExpandOnSelection.java create mode 100644 tests/FrameworkTest/src/com/android/frameworktest/listview/ListLastItemPartiallyVisible.java create mode 100644 tests/FrameworkTest/src/com/android/frameworktest/listview/ListManagedCursor.java create mode 100644 tests/FrameworkTest/src/com/android/frameworktest/listview/ListOfItemsShorterThanScreen.java create mode 100644 tests/FrameworkTest/src/com/android/frameworktest/listview/ListOfItemsTallerThanScreen.java create mode 100644 tests/FrameworkTest/src/com/android/frameworktest/listview/ListOfShortShortTallShortShort.java create mode 100644 tests/FrameworkTest/src/com/android/frameworktest/listview/ListOfShortTallShort.java create mode 100644 tests/FrameworkTest/src/com/android/frameworktest/listview/ListOfThinItems.java create mode 100644 tests/FrameworkTest/src/com/android/frameworktest/listview/ListOfTouchables.java create mode 100644 tests/FrameworkTest/src/com/android/frameworktest/listview/ListRecyclerProfiling.java create mode 100644 tests/FrameworkTest/src/com/android/frameworktest/listview/ListScrollListener.java create mode 100644 tests/FrameworkTest/src/com/android/frameworktest/listview/ListSetSelection.java create mode 100644 tests/FrameworkTest/src/com/android/frameworktest/listview/ListSimple.java create mode 100644 tests/FrameworkTest/src/com/android/frameworktest/listview/ListTakeFocusFromSide.java create mode 100644 tests/FrameworkTest/src/com/android/frameworktest/listview/ListThrasher.java create mode 100644 tests/FrameworkTest/src/com/android/frameworktest/listview/ListTopGravity.java create mode 100644 tests/FrameworkTest/src/com/android/frameworktest/listview/ListTopGravityMany.java create mode 100644 tests/FrameworkTest/src/com/android/frameworktest/listview/ListViewHeight.java create mode 100644 tests/FrameworkTest/src/com/android/frameworktest/listview/ListWithDisappearingItemBug.java create mode 100644 tests/FrameworkTest/src/com/android/frameworktest/listview/ListWithEditTextHeader.java create mode 100644 tests/FrameworkTest/src/com/android/frameworktest/listview/ListWithEmptyView.java create mode 100644 tests/FrameworkTest/src/com/android/frameworktest/listview/ListWithHeaders.java create mode 100644 tests/FrameworkTest/src/com/android/frameworktest/listview/ListWithNoFadingEdge.java create mode 100644 tests/FrameworkTest/src/com/android/frameworktest/listview/ListWithOffScreenNextSelectable.java create mode 100644 tests/FrameworkTest/src/com/android/frameworktest/listview/ListWithOnItemSelectedAction.java create mode 100644 tests/FrameworkTest/src/com/android/frameworktest/listview/ListWithScreenOfNoSelectables.java create mode 100644 tests/FrameworkTest/src/com/android/frameworktest/listview/ListWithSeparators.java create mode 100644 tests/FrameworkTest/src/com/android/frameworktest/menus/ListContextMenu.java create mode 100644 tests/FrameworkTest/src/com/android/frameworktest/menus/MenuLayout.java create mode 100644 tests/FrameworkTest/src/com/android/frameworktest/menus/MenuLayoutLandscape.java create mode 100644 tests/FrameworkTest/src/com/android/frameworktest/menus/MenuLayoutPortrait.java create mode 100644 tests/FrameworkTest/src/com/android/frameworktest/menus/MenuScenario.java create mode 100644 tests/FrameworkTest/src/com/android/frameworktest/menus/MenuWith1Item.java create mode 100644 tests/FrameworkTest/src/com/android/frameworktest/performance/InvalidateCycle.java create mode 100644 tests/FrameworkTest/src/com/android/frameworktest/scroll/ButtonAboveTallInternalSelectionView.java create mode 100644 tests/FrameworkTest/src/com/android/frameworktest/scroll/ButtonsWithTallTextViewInBetween.java create mode 100644 tests/FrameworkTest/src/com/android/frameworktest/scroll/RequestRectangleVisible.java create mode 100644 tests/FrameworkTest/src/com/android/frameworktest/scroll/RequestRectangleVisibleWithInternalScroll.java create mode 100644 tests/FrameworkTest/src/com/android/frameworktest/scroll/ScrollViewButtonsAndLabels.java create mode 100644 tests/FrameworkTest/src/com/android/frameworktest/scroll/ShortButtons.java create mode 100644 tests/FrameworkTest/src/com/android/frameworktest/scroll/TallTextAboveButton.java create mode 100644 tests/FrameworkTest/src/com/android/frameworktest/settings/BrightnessLimit.java create mode 100644 tests/FrameworkTest/src/com/android/frameworktest/settings/RingtonePickerActivityLauncher.java create mode 100644 tests/FrameworkTest/src/com/android/frameworktest/util/ExpandableListScenario.java create mode 100644 tests/FrameworkTest/src/com/android/frameworktest/util/GridScenario.java create mode 100644 tests/FrameworkTest/src/com/android/frameworktest/util/InternalSelectionView.java create mode 100644 tests/FrameworkTest/src/com/android/frameworktest/util/KeyUtils.java create mode 100644 tests/FrameworkTest/src/com/android/frameworktest/util/ListItemFactory.java create mode 100644 tests/FrameworkTest/src/com/android/frameworktest/util/ListScenario.java create mode 100644 tests/FrameworkTest/src/com/android/frameworktest/util/ListUtil.java create mode 100644 tests/FrameworkTest/src/com/android/frameworktest/util/ScrollViewScenario.java create mode 100644 tests/FrameworkTest/src/com/android/frameworktest/util/TouchModeFlexibleAsserts.java create mode 100644 tests/FrameworkTest/src/com/android/frameworktest/view/BigCache.java create mode 100644 tests/FrameworkTest/src/com/android/frameworktest/view/Disabled.java create mode 100644 tests/FrameworkTest/src/com/android/frameworktest/view/GlobalFocusChange.java create mode 100644 tests/FrameworkTest/src/com/android/frameworktest/view/Include.java create mode 100644 tests/FrameworkTest/src/com/android/frameworktest/view/Longpress.java create mode 100644 tests/FrameworkTest/src/com/android/frameworktest/view/Merge.java create mode 100644 tests/FrameworkTest/src/com/android/frameworktest/view/PopupWindowVisibility.java create mode 100644 tests/FrameworkTest/src/com/android/frameworktest/view/PreDrawListener.java create mode 100644 tests/FrameworkTest/src/com/android/frameworktest/view/RemoteViewsActivity.java create mode 100644 tests/FrameworkTest/src/com/android/frameworktest/view/RunQueue.java create mode 100644 tests/FrameworkTest/src/com/android/frameworktest/view/StubbedView.java create mode 100644 tests/FrameworkTest/src/com/android/frameworktest/view/ViewGroupChildren.java create mode 100644 tests/FrameworkTest/src/com/android/frameworktest/view/Visibility.java create mode 100644 tests/FrameworkTest/src/com/android/frameworktest/view/ZeroSized.java create mode 100644 tests/FrameworkTest/tests/Android.mk create mode 100644 tests/FrameworkTest/tests/AndroidManifest.xml create mode 100644 tests/FrameworkTest/tests/src/android/content/SearchRecentSuggestionsProviderTest.java create mode 100644 tests/FrameworkTest/tests/src/android/widget/SimpleCursorAdapterTest.java create mode 100644 tests/FrameworkTest/tests/src/com/android/frameworktest/AllTests.java create mode 100644 tests/FrameworkTest/tests/src/com/android/frameworktest/drawable/DrawableBgMinSizeTest.java create mode 100644 tests/FrameworkTest/tests/src/com/android/frameworktest/expandablelistview/ExpandableListBasicTest.java create mode 100644 tests/FrameworkTest/tests/src/com/android/frameworktest/expandablelistview/ExpandableListWithHeadersTest.java create mode 100644 tests/FrameworkTest/tests/src/com/android/frameworktest/focus/DescendantFocusabilityTest.java create mode 100644 tests/FrameworkTest/tests/src/com/android/frameworktest/focus/FocusAfterRemovalTest.java create mode 100644 tests/FrameworkTest/tests/src/com/android/frameworktest/focus/FocusChangeWithInterestingRectHintTest.java create mode 100644 tests/FrameworkTest/tests/src/com/android/frameworktest/focus/GoneParentFocusedChildTest.java create mode 100644 tests/FrameworkTest/tests/src/com/android/frameworktest/focus/HorizontalFocusSearchTest.java create mode 100644 tests/FrameworkTest/tests/src/com/android/frameworktest/focus/LinearLayoutGridTest.java create mode 100644 tests/FrameworkTest/tests/src/com/android/frameworktest/focus/ListOfButtonsTest.java create mode 100644 tests/FrameworkTest/tests/src/com/android/frameworktest/focus/ListWithFooterViewAndNewLabelsTest.java create mode 100644 tests/FrameworkTest/tests/src/com/android/frameworktest/focus/RequestFocusTest.java create mode 100644 tests/FrameworkTest/tests/src/com/android/frameworktest/focus/ScrollingThroughListOfFocusablesTest.java create mode 100644 tests/FrameworkTest/tests/src/com/android/frameworktest/focus/VerticalFocusSearchTest.java create mode 100644 tests/FrameworkTest/tests/src/com/android/frameworktest/gridview/GridInHorizontalTest.java create mode 100644 tests/FrameworkTest/tests/src/com/android/frameworktest/gridview/GridInVerticalTest.java create mode 100644 tests/FrameworkTest/tests/src/com/android/frameworktest/gridview/GridPaddingTest.java create mode 100644 tests/FrameworkTest/tests/src/com/android/frameworktest/gridview/GridScrollListenerTest.java create mode 100644 tests/FrameworkTest/tests/src/com/android/frameworktest/gridview/GridSetSelectionBaseTest.java create mode 100644 tests/FrameworkTest/tests/src/com/android/frameworktest/gridview/GridSetSelectionManyTest.java create mode 100644 tests/FrameworkTest/tests/src/com/android/frameworktest/gridview/GridSetSelectionStackFromBottomManyTest.java create mode 100644 tests/FrameworkTest/tests/src/com/android/frameworktest/gridview/GridSetSelectionStackFromBottomTest.java create mode 100644 tests/FrameworkTest/tests/src/com/android/frameworktest/gridview/GridSetSelectionTest.java create mode 100644 tests/FrameworkTest/tests/src/com/android/frameworktest/gridview/GridSingleColumnTest.java create mode 100644 tests/FrameworkTest/tests/src/com/android/frameworktest/gridview/GridStackFromBottomManyTest.java create mode 100644 tests/FrameworkTest/tests/src/com/android/frameworktest/gridview/GridStackFromBottomTest.java create mode 100644 tests/FrameworkTest/tests/src/com/android/frameworktest/gridview/touch/GridTouchSetSelectionTest.java create mode 100644 tests/FrameworkTest/tests/src/com/android/frameworktest/gridview/touch/GridTouchStackFromBottomManyTest.java create mode 100644 tests/FrameworkTest/tests/src/com/android/frameworktest/gridview/touch/GridTouchStackFromBottomTest.java create mode 100644 tests/FrameworkTest/tests/src/com/android/frameworktest/gridview/touch/GridTouchVerticalSpacingStackFromBottomTest.java create mode 100644 tests/FrameworkTest/tests/src/com/android/frameworktest/gridview/touch/GridTouchVerticalSpacingTest.java create mode 100644 tests/FrameworkTest/tests/src/com/android/frameworktest/layout/frame/FrameLayoutGravityTest.java create mode 100644 tests/FrameworkTest/tests/src/com/android/frameworktest/layout/frame/FrameLayoutMarginTest.java create mode 100644 tests/FrameworkTest/tests/src/com/android/frameworktest/layout/linear/BaselineAlignmentCenterGravityTest.java create mode 100644 tests/FrameworkTest/tests/src/com/android/frameworktest/layout/linear/BaselineAlignmentSpinnerButton.java create mode 100644 tests/FrameworkTest/tests/src/com/android/frameworktest/layout/linear/BaselineAlignmentZeroWidthAndWeightTest.java create mode 100644 tests/FrameworkTest/tests/src/com/android/frameworktest/layout/linear/BaselineButtonsTest.java create mode 100644 tests/FrameworkTest/tests/src/com/android/frameworktest/layout/linear/FillInWrapTest.java create mode 100644 tests/FrameworkTest/tests/src/com/android/frameworktest/layout/linear/LinearLayoutEditTextsTest.java create mode 100644 tests/FrameworkTest/tests/src/com/android/frameworktest/layout/linear/WeightSumTest.java create mode 100644 tests/FrameworkTest/tests/src/com/android/frameworktest/layout/linear/WeightTest.java create mode 100644 tests/FrameworkTest/tests/src/com/android/frameworktest/layout/table/AddColumnTest.java create mode 100644 tests/FrameworkTest/tests/src/com/android/frameworktest/layout/table/CellSpanTest.java create mode 100644 tests/FrameworkTest/tests/src/com/android/frameworktest/layout/table/FixedWidthTest.java create mode 100644 tests/FrameworkTest/tests/src/com/android/frameworktest/layout/table/HorizontalGravityTest.java create mode 100644 tests/FrameworkTest/tests/src/com/android/frameworktest/layout/table/VerticalGravityTest.java create mode 100644 tests/FrameworkTest/tests/src/com/android/frameworktest/layout/table/WeightTest.java create mode 100644 tests/FrameworkTest/tests/src/com/android/frameworktest/listview/ListBottomGravityManyTest.java create mode 100644 tests/FrameworkTest/tests/src/com/android/frameworktest/listview/ListBottomGravityTest.java create mode 100644 tests/FrameworkTest/tests/src/com/android/frameworktest/listview/ListEmptyViewTest.java create mode 100644 tests/FrameworkTest/tests/src/com/android/frameworktest/listview/ListFocusableTest.java create mode 100644 tests/FrameworkTest/tests/src/com/android/frameworktest/listview/ListHeterogeneousTest.java create mode 100644 tests/FrameworkTest/tests/src/com/android/frameworktest/listview/ListInHorizontalTest.java create mode 100644 tests/FrameworkTest/tests/src/com/android/frameworktest/listview/ListInVerticalTest.java create mode 100644 tests/FrameworkTest/tests/src/com/android/frameworktest/listview/ListItemRequestRectAboveThinFirstItemTest.java create mode 100644 tests/FrameworkTest/tests/src/com/android/frameworktest/listview/ListManagedCursorTest.java create mode 100644 tests/FrameworkTest/tests/src/com/android/frameworktest/listview/ListRetainsFocusAcrossLayoutsTest.java create mode 100644 tests/FrameworkTest/tests/src/com/android/frameworktest/listview/ListScrollListenerTest.java create mode 100644 tests/FrameworkTest/tests/src/com/android/frameworktest/listview/ListUnspecifiedMeasure.java create mode 100644 tests/FrameworkTest/tests/src/com/android/frameworktest/listview/ListViewHeightTest.java create mode 100644 tests/FrameworkTest/tests/src/com/android/frameworktest/listview/arrowscroll/ListInterleaveFocusablesTest.java create mode 100644 tests/FrameworkTest/tests/src/com/android/frameworktest/listview/arrowscroll/ListItemFocusableAboveUnfocusableTest.java create mode 100644 tests/FrameworkTest/tests/src/com/android/frameworktest/listview/arrowscroll/ListItemFocusablesCloseTest.java create mode 100644 tests/FrameworkTest/tests/src/com/android/frameworktest/listview/arrowscroll/ListItemFocusablesFarApartTest.java create mode 100644 tests/FrameworkTest/tests/src/com/android/frameworktest/listview/arrowscroll/ListItemsExpandOnSelectionTest.java create mode 100644 tests/FrameworkTest/tests/src/com/android/frameworktest/listview/arrowscroll/ListLastItemPartiallyVisibleTest.java create mode 100644 tests/FrameworkTest/tests/src/com/android/frameworktest/listview/arrowscroll/ListOfItemsShorterThanScreenTest.java create mode 100644 tests/FrameworkTest/tests/src/com/android/frameworktest/listview/arrowscroll/ListOfItemsTallerThanScreenTest.java create mode 100644 tests/FrameworkTest/tests/src/com/android/frameworktest/listview/arrowscroll/ListOfShortShortTallShortShortTest.java create mode 100644 tests/FrameworkTest/tests/src/com/android/frameworktest/listview/arrowscroll/ListOfShortTallShortTest.java create mode 100644 tests/FrameworkTest/tests/src/com/android/frameworktest/listview/arrowscroll/ListOfThinItemsTest.java create mode 100644 tests/FrameworkTest/tests/src/com/android/frameworktest/listview/arrowscroll/ListWithNoFadingEdgeTest.java create mode 100644 tests/FrameworkTest/tests/src/com/android/frameworktest/listview/arrowscroll/ListWithOffScreenNextSelectableTest.java create mode 100644 tests/FrameworkTest/tests/src/com/android/frameworktest/listview/arrowscroll/ListWithOnItemSelectedActionTest.java create mode 100644 tests/FrameworkTest/tests/src/com/android/frameworktest/listview/arrowscroll/ListWithScreenOfNoSelectablesTest.java create mode 100644 tests/FrameworkTest/tests/src/com/android/frameworktest/listview/arrowscroll/ListWithSeparatorsTest.java create mode 100644 tests/FrameworkTest/tests/src/com/android/frameworktest/listview/focus/AdjacentListsWithAdjacentISVsInsideTest.java create mode 100644 tests/FrameworkTest/tests/src/com/android/frameworktest/listview/focus/ListButtonsDiagonalAcrossItemsTest.java create mode 100644 tests/FrameworkTest/tests/src/com/android/frameworktest/listview/focus/ListHorizontalFocusWithinItemWinsTest.java create mode 100644 tests/FrameworkTest/tests/src/com/android/frameworktest/listview/focus/ListWithEditTextHeaderTest.java create mode 100644 tests/FrameworkTest/tests/src/com/android/frameworktest/listview/touch/ListGetSelectedViewTest.java create mode 100644 tests/FrameworkTest/tests/src/com/android/frameworktest/listview/touch/ListOfTouchablesTest.java create mode 100644 tests/FrameworkTest/tests/src/com/android/frameworktest/listview/touch/ListSetSelectionTest.java create mode 100644 tests/FrameworkTest/tests/src/com/android/frameworktest/listview/touch/ListTouchBottomGravityManyTest.java create mode 100644 tests/FrameworkTest/tests/src/com/android/frameworktest/listview/touch/ListTouchBottomGravityTest.java create mode 100644 tests/FrameworkTest/tests/src/com/android/frameworktest/listview/touch/ListTouchManyTest.java create mode 100644 tests/FrameworkTest/tests/src/com/android/frameworktest/listview/touch/ListTouchTest.java create mode 100644 tests/FrameworkTest/tests/src/com/android/frameworktest/menus/MenuLayoutLandscapeTest.java create mode 100644 tests/FrameworkTest/tests/src/com/android/frameworktest/menus/MenuLayoutPortraitTest.java create mode 100644 tests/FrameworkTest/tests/src/com/android/frameworktest/menus/MenuWith1ItemTest.java create mode 100644 tests/FrameworkTest/tests/src/com/android/frameworktest/scroll/ButtonAboveTallInternalSelectionViewTest.java create mode 100644 tests/FrameworkTest/tests/src/com/android/frameworktest/scroll/RequestRectangleVisibleTest.java create mode 100644 tests/FrameworkTest/tests/src/com/android/frameworktest/scroll/RequestRectangleVisibleWithInternalScrollTest.java create mode 100644 tests/FrameworkTest/tests/src/com/android/frameworktest/scroll/ScrollViewButtonsAndLabelsTest.java create mode 100644 tests/FrameworkTest/tests/src/com/android/frameworktest/scroll/arrowscroll/ButtonsWithTallTextViewInBetweenTest.java create mode 100644 tests/FrameworkTest/tests/src/com/android/frameworktest/scroll/arrowscroll/ShortButtonsTest.java create mode 100644 tests/FrameworkTest/tests/src/com/android/frameworktest/scroll/arrowscroll/TallTextAboveButtonTest.java create mode 100644 tests/FrameworkTest/tests/src/com/android/frameworktest/settings/RingtonePickerActivityTest.java create mode 100644 tests/FrameworkTest/tests/src/com/android/frameworktest/text/HtmlTest.java create mode 100644 tests/FrameworkTest/tests/src/com/android/frameworktest/text/SpannableStringBuilderTest.java create mode 100644 tests/FrameworkTest/tests/src/com/android/frameworktest/text/SpannableStringTest.java create mode 100644 tests/FrameworkTest/tests/src/com/android/frameworktest/text/SpannableTest.java create mode 100644 tests/FrameworkTest/tests/src/com/android/frameworktest/touchmode/ChangeTouchModeTest.java create mode 100644 tests/FrameworkTest/tests/src/com/android/frameworktest/touchmode/FocusableInTouchModeClickTest.java create mode 100644 tests/FrameworkTest/tests/src/com/android/frameworktest/touchmode/StartInTouchWithViewInFocusTest.java create mode 100644 tests/FrameworkTest/tests/src/com/android/frameworktest/touchmode/TouchModeFocusChangeTest.java create mode 100644 tests/FrameworkTest/tests/src/com/android/frameworktest/touchmode/TouchModeFocusableTest.java create mode 100644 tests/FrameworkTest/tests/src/com/android/frameworktest/view/BigCacheTest.java create mode 100644 tests/FrameworkTest/tests/src/com/android/frameworktest/view/DisabledLongpressTest.java create mode 100644 tests/FrameworkTest/tests/src/com/android/frameworktest/view/DisabledTest.java create mode 100644 tests/FrameworkTest/tests/src/com/android/frameworktest/view/GlobalFocusChangeTest.java create mode 100644 tests/FrameworkTest/tests/src/com/android/frameworktest/view/IncludeTest.java create mode 100644 tests/FrameworkTest/tests/src/com/android/frameworktest/view/LongpressTest.java create mode 100644 tests/FrameworkTest/tests/src/com/android/frameworktest/view/MergeTest.java create mode 100644 tests/FrameworkTest/tests/src/com/android/frameworktest/view/RemoteViewsActivityTest.java create mode 100644 tests/FrameworkTest/tests/src/com/android/frameworktest/view/RunQueueTest.java create mode 100644 tests/FrameworkTest/tests/src/com/android/frameworktest/view/ViewGroupChildrenTest.java create mode 100644 tests/FrameworkTest/tests/src/com/android/frameworktest/view/ViewStubTest.java create mode 100644 tests/FrameworkTest/tests/src/com/android/frameworktest/view/VisibilityTest.java create mode 100644 tests/FrameworkTest/tests/src/com/android/frameworktest/view/ZeroSizedTest.java create mode 100644 tests/FrameworkTest/tests/src/com/android/frameworktest/widget/ListViewTest.java create mode 100644 tests/SslLoad/Android.mk create mode 100644 tests/SslLoad/AndroidManifest.xml create mode 100644 tests/SslLoad/src/com/android/sslload/SslLoad.java create mode 100644 tests/StatusBar/Android.mk create mode 100644 tests/StatusBar/AndroidManifest.xml create mode 100644 tests/StatusBar/res/drawable/app_gmail.png create mode 100644 tests/StatusBar/res/drawable/app_phone.png create mode 100644 tests/StatusBar/res/drawable/ic_statusbar_chat.png create mode 100644 tests/StatusBar/res/drawable/ic_statusbar_email.png create mode 100644 tests/StatusBar/res/drawable/ic_statusbar_missedcall.png create mode 100644 tests/StatusBar/res/drawable/icon1.png create mode 100644 tests/StatusBar/res/drawable/icon2.png create mode 100644 tests/StatusBar/res/drawable/icon3.png create mode 100644 tests/StatusBar/res/drawable/icon4.png create mode 100644 tests/StatusBar/res/layout/chrono_notification.xml create mode 100644 tests/StatusBar/res/raw/ringer.mp3 create mode 100644 tests/StatusBar/res/values/strings.xml create mode 100644 tests/StatusBar/src/com/android/statusbartest/NotificationTestList.java create mode 100644 tests/StatusBar/src/com/android/statusbartest/PowerTest.java create mode 100644 tests/StatusBar/src/com/android/statusbartest/StatusBarTest.java create mode 100644 tests/StatusBar/src/com/android/statusbartest/TestActivity.java create mode 100644 tests/StatusBar/src/com/android/statusbartest/ToastTest.java create mode 100644 tests/framework-tests/Android.mk create mode 100644 tests/framework-tests/README create mode 100644 tests/framework-tests/src/Android.mk create mode 100644 tests/framework-tests/src/android/test/FrameworkTests.java create mode 100644 tests/framework-tests/src/android/text/PackedIntVectorTest.java create mode 100644 tests/framework-tests/src/android/util/EventLogFunctionalTest.java create mode 100644 tests/framework-tests/src/android/util/EventLogTest.java create mode 100644 tests/framework-tests/src/com/android/internal/http/multipart/MultipartTest.java create mode 100644 tests/framework-tests/src/com/android/internal/os/LoggingPrintStreamTest.java create mode 100644 tests/framework-tests/src/com/android/internal/policy/impl/LockPatternKeyguardViewTest.java diff --git a/Android.mk b/Android.mk index 6b3b77a984ad3..18051aaa8a86a 100644 --- a/Android.mk +++ b/Android.mk @@ -30,6 +30,7 @@ framework-res-source-path := APPS/framework-res_intermediates/src # ============================================================ include $(CLEAR_VARS) +# FRAMEWORKS_BASE_SUBDIRS comes from build/core/pathmap.mk LOCAL_SRC_FILES := $(call find-other-java-files,$(FRAMEWORKS_BASE_SUBDIRS)) # The following filters out code we are temporarily not including at all. @@ -66,6 +67,7 @@ LOCAL_SRC_FILES += \ core/java/android/app/ITransientNotification.aidl \ core/java/android/app/IWallpaperService.aidl \ core/java/android/app/IWallpaperServiceCallback.aidl \ + core/java/android/bluetooth/IBluetoothA2dp.aidl \ core/java/android/bluetooth/IBluetoothDevice.aidl \ core/java/android/bluetooth/IBluetoothDeviceCallback.aidl \ core/java/android/bluetooth/IBluetoothHeadset.aidl \ @@ -96,6 +98,14 @@ LOCAL_SRC_FILES += \ core/java/android/view/IWindowManager.aidl \ core/java/android/view/IWindowSession.aidl \ core/java/com/android/internal/app/IBatteryStats.aidl \ + core/java/com/android/internal/view/IInputContext.aidl \ + core/java/com/android/internal/view/IInputContextCallback.aidl \ + core/java/com/android/internal/view/IInputMethod.aidl \ + core/java/com/android/internal/view/IInputMethodCallback.aidl \ + core/java/com/android/internal/view/IInputMethodClient.aidl \ + core/java/com/android/internal/view/IInputMethodManager.aidl \ + core/java/com/android/internal/view/IInputMethodSession.aidl \ + im/java/android/im/IImPlugin.aidl \ location/java/android/location/IGpsStatusListener.aidl \ location/java/android/location/ILocationListener.aidl \ location/java/android/location/ILocationManager.aidl \ @@ -110,6 +120,7 @@ LOCAL_SRC_FILES += \ telephony/java/com/android/internal/telephony/gsm/ISms.aidl \ wifi/java/android/net/wifi/IWifiManager.aidl +# FRAMEWORKS_BASE_JAVA_SRC_DIRS comes from build/core/pathmap.mk LOCAL_AIDL_INCLUDES += $(FRAMEWORKS_BASE_JAVA_SRC_DIRS) LOCAL_INTERMEDIATE_SOURCES := \ @@ -126,6 +137,8 @@ LOCAL_MODULE_CLASS := JAVA_LIBRARIES # List of classes and interfaces which should be loaded by the Zygote. LOCAL_JAVA_RESOURCE_FILES += $(LOCAL_PATH)/preloaded-classes +#LOCAL_JARJAR_RULES := $(LOCAL_PATH)/jarjar-rules.txt + LOCAL_DX_FLAGS := --core-library include $(BUILD_JAVA_LIBRARY) @@ -134,7 +147,7 @@ include $(BUILD_JAVA_LIBRARY) # the source for this library. framework_res_R_stamp := \ $(call intermediates-dir-for,APPS,framework-res,,COMMON)/src/R.stamp -$(full_classes_jar): $(framework_res_R_stamp) +$(full_classes_compiled_jar): $(framework_res_R_stamp) # Make sure that framework-res is installed when framework is. $(LOCAL_INSTALLED_MODULE): | $(dir $(LOCAL_INSTALLED_MODULE))framework-res.apk @@ -159,9 +172,16 @@ aidl_files := \ frameworks/base/core/java/android/view/MotionEvent.aidl \ frameworks/base/core/java/android/view/Surface.aidl \ frameworks/base/core/java/android/view/WindowManager.aidl \ + frameworks/base/core/java/com/android/internal/view/IInputContext.aidl \ + frameworks/base/core/java/com/android/internal/view/IInputMethod.aidl \ + frameworks/base/core/java/com/android/internal/view/IInputMethodCallback.aidl \ + frameworks/base/core/java/com/android/internal/view/IInputMethodClient.aidl \ + frameworks/base/core/java/com/android/internal/view/IInputMethodManager.aidl \ + frameworks/base/core/java/com/android/internal/view/IInputMethodSession.aidl \ frameworks/base/graphics/java/android/graphics/Bitmap.aidl \ frameworks/base/graphics/java/android/graphics/Rect.aidl \ frameworks/base/graphics/java/android/graphics/Region.aidl \ + frameworks/base/im/java/android/im/IImPlugin.aidl \ frameworks/base/location/java/android/location/Criteria.aidl \ frameworks/base/location/java/android/location/Location.aidl \ frameworks/base/telephony/java/android/telephony/ServiceState.aidl \ @@ -261,10 +281,16 @@ framework_docs_LOCAL_JAVA_LIBRARIES := \ framework_docs_LOCAL_MODULE_CLASS := JAVA_LIBRARIES framework_docs_LOCAL_DROIDDOC_HTML_DIR := docs/html framework_docs_LOCAL_DROIDDOC_OPTIONS := \ - -error 1 -error 2 -error 3 -error 4 -error 6 -error 8 \ - -overview $(LOCAL_PATH)/core/java/overview.html \ - -hdf android.buglink 1 \ - -hdf android.whichdoc framework + -error 1 -error 2 -warning 3 -error 4 -error 6 -error 8 \ + -overview $(LOCAL_PATH)/core/java/overview.html + +framework_docs_LOCAL_ADDITIONAL_JAVA_DIR:=$(call intermediates-dir-for,JAVA_LIBRARIES,framework) + +web_docs_sample_code_flags := \ + -hdf android.hasSamples 1 \ + -samplecode samples/ApiDemos guide/samples/ApiDemos "API Demos" \ + -samplecode samples/LunarLander guide/samples/LunarLander "Lunar Lander" \ + -samplecode samples/NotePad guide/samples/NotePad "Note Pad" sample_dir := development/samples @@ -278,7 +304,7 @@ web_docs_sample_code_flags := \ guide/samples/NotePad "Note Pad" -# ==== static html ================================== +# ==== static html in the sdk ================================== include $(CLEAR_VARS) LOCAL_SRC_FILES:=$(framework_docs_LOCAL_SRC_FILES) @@ -287,19 +313,23 @@ LOCAL_JAVA_LIBRARIES:=$(framework_docs_LOCAL_JAVA_LIBRARIES) LOCAL_MODULE_CLASS:=$(framework_docs_LOCAL_MODULE_CLASS) LOCAL_DROIDDOC_SOURCE_PATH:=$(framework_docs_LOCAL_DROIDDOC_SOURCE_PATH) LOCAL_DROIDDOC_HTML_DIR:=$(framework_docs_LOCAL_DROIDDOC_HTML_DIR) -LOCAL_MODULE:=framework +LOCAL_ADDITIONAL_JAVA_DIR:=$(framework_docs_LOCAL_ADDITIONAL_JAVA_DIR) -framework_keep_file := $(OUT_DOCS)/$(LOCAL_MODULE)-keep.txt +LOCAL_MODULE := offline-sdk LOCAL_DROIDDOC_OPTIONS:=\ $(framework_docs_LOCAL_DROIDDOC_OPTIONS) \ -title "Android SDK" \ - -keeplist $(framework_keep_file) \ -proofread $(OUT_DOCS)/$(LOCAL_MODULE)-proofread.txt \ -todo $(OUT_DOCS)/$(LOCAL_MODULE)-docs-todo.html \ -stubs $(TARGET_OUT_COMMON_INTERMEDIATES)/JAVA_LIBRARIES/android_stubs_current_intermediates/src \ -apixml $(INTERNAL_PLATFORM_API_FILE) \ -sdkvalues $(OUT_DOCS) \ + -warning 3 \ + -hdf android.whichdoc offline + +LOCAL_DROIDDOC_CUSTOM_TEMPLATE_DIR:=build/tools/droiddoc/templates-sdk +LOCAL_DROIDDOC_CUSTOM_ASSET_DIR:=assets-sdk include $(BUILD_DROIDDOC) @@ -311,34 +341,37 @@ $(static_doc_index_redirect): \ $(full_target): $(static_doc_index_redirect) $(full_target): $(framework_built) -$(framework_keep_file): $(full_target) $(INTERNAL_PLATFORM_API_FILE): $(full_target) $(call dist-for-goals,sdk,$(INTERNAL_PLATFORM_API_FILE)) -# ==== codesite ezt templates ======================= +# ==== docs for the web (on the google app engine server) ======================= include $(CLEAR_VARS) LOCAL_SRC_FILES:=$(framework_docs_LOCAL_SRC_FILES) LOCAL_INTERMEDIATE_SOURCES:=$(framework_docs_LOCAL_INTERMEDIATE_SOURCES) -LOCAL_JAVA_LIBRARIES:=$(framework_docs_LOCAL_JAVA_LIBRARIES) framework +LOCAL_STATIC_JAVA_LIBRARIES:=$(framework_docs_LOCAL_STATIC_JAVA_LIBRARIES) +LOCAL_JAVA_LIBRARIES:=$(framework_docs_LOCAL_JAVA_LIBRARIES) LOCAL_MODULE_CLASS:=$(framework_docs_LOCAL_MODULE_CLASS) LOCAL_DROIDDOC_SOURCE_PATH:=$(framework_docs_LOCAL_DROIDDOC_SOURCE_PATH) LOCAL_DROIDDOC_HTML_DIR:=$(framework_docs_LOCAL_DROIDDOC_HTML_DIR) -LOCAL_ADDITIONAL_JAVA_DIR:=$(call intermediates-dir-for,JAVA_LIBRARIES,framework) +LOCAL_ADDITIONAL_JAVA_DIR:=$(framework_docs_LOCAL_ADDITIONAL_JAVA_DIR) -LOCAL_MODULE:=codesite -LOCAL_DROIDDOC_OPTIONS:=\ - $(framework_docs_LOCAL_DROIDDOC_OPTIONS) \ - $(web_docs_sample_code_flags) \ - -toroot /android/ +LOCAL_MODULE := online-sdk + +LOCAL_DROIDDOC_OPTIONS:= \ + $(framework_docs_LOCAL_DROIDDOC_OPTIONS) \ + $(web_docs_sample_code_flags) \ + -toroot / \ + -hdf android.whichdoc online -LOCAL_DROIDDOC_CUSTOM_TEMPLATE_DIR:=$(SRC_DROIDDOC_DIR)/templates-codesite -LOCAL_DROIDDOC_CUSTOM_ASSET_DIR:=assets-google +LOCAL_DROIDDOC_CUSTOM_TEMPLATE_DIR:=build/tools/droiddoc/templates-sdk +LOCAL_DROIDDOC_CUSTOM_ASSET_DIR:=assets-sdk include $(BUILD_DROIDDOC) -# ==== docs for the web (on the google app engine server) ======================= + +# ==== docs that have all of the stuff that's @hidden ======================= include $(CLEAR_VARS) LOCAL_SRC_FILES:=$(framework_docs_LOCAL_SRC_FILES) @@ -349,18 +382,17 @@ LOCAL_DROIDDOC_SOURCE_PATH:=$(framework_docs_LOCAL_DROIDDOC_SOURCE_PATH) LOCAL_DROIDDOC_HTML_DIR:=$(framework_docs_LOCAL_DROIDDOC_HTML_DIR) LOCAL_ADDITIONAL_JAVA_DIR:=$(call intermediates-dir-for,JAVA_LIBRARIES,framework) -LOCAL_MODULE:=gae +LOCAL_MODULE := hidden LOCAL_DROIDDOC_OPTIONS:=\ - $(framework_docs_LOCAL_DROIDDOC_OPTIONS) \ - $(web_docs_sample_code_flags) \ - -toroot /gae/ + $(framework_docs_LOCAL_DROIDDOC_OPTIONS) \ + -title "Android SDK - Including hidden APIs." +# -hidden -LOCAL_DROIDDOC_CUSTOM_TEMPLATE_DIR:=$(SRC_DROIDDOC_DIR)/templates -LOCAL_DROIDDOC_CUSTOM_ASSET_DIR:=assets +LOCAL_DROIDDOC_CUSTOM_TEMPLATE_DIR:=build/tools/droiddoc/templates-sdk +LOCAL_DROIDDOC_CUSTOM_ASSET_DIR:=assets-sdk include $(BUILD_DROIDDOC) - # Build ext.jar # ============================================================ @@ -385,24 +417,8 @@ LOCAL_MODULE := ext include $(BUILD_JAVA_LIBRARY) -# ==== the documentation =================================== -include $(CLEAR_VARS) - -LOCAL_SRC_FILES := $(ext_src_files) docs/overview-ext.html - -LOCAL_NO_STANDARD_LIBRARIES := true -LOCAL_JAVA_LIBRARIES := core - -LOCAL_MODULE := ext -LOCAL_MODULE_CLASS := JAVA_LIBRARIES -LOCAL_DROIDDOC_OPTIONS := -overview $(LOCAL_PATH)/docs/overview-ext.html - -include $(BUILD_DROIDDOC) - # Include subdirectory makefiles # ============================================================ -ifneq ($(SDK_ONLY),true) - include $(call first-makefiles-under,$(LOCAL_PATH)) -endif +include $(call first-makefiles-under,$(LOCAL_PATH)) diff --git a/api/1.xml b/api/1.xml new file mode 100644 index 0000000000000..b196ac776ed99 --- /dev/null +++ b/api/1.xml @@ -0,0 +1,311265 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/api/2.xml b/api/2.xml new file mode 100644 index 0000000000000..b9736fe735974 --- /dev/null +++ b/api/2.xml @@ -0,0 +1,311400 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/api/3.xml b/api/3.xml new file mode 100644 index 0000000000000..e13cfdecf9601 --- /dev/null +++ b/api/3.xml @@ -0,0 +1,311400 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/api/current.xml b/api/current.xml new file mode 100644 index 0000000000000..880b6e82136cb --- /dev/null +++ b/api/current.xml @@ -0,0 +1,325107 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/awt/java/awt/AWTEvent.java b/awt/java/awt/AWTEvent.java index 1ed9a374facd4..a8dc83aafe5ff 100644 --- a/awt/java/awt/AWTEvent.java +++ b/awt/java/awt/AWTEvent.java @@ -18,6 +18,7 @@ * @author Dmitry A. Durnev, Michael Danilov * @version $Revision$ */ + package java.awt; import java.util.EventObject; @@ -27,190 +28,252 @@ import java.util.EventListener; import java.awt.event.*; /** - * The abstract AWT events is base class for all AWT events. - * This class and its subclasses supercede the original java.awt.Event class. + * The abstract class AWTEvent is the base class for all AWT events. This class + * and its subclasses supersede the original java.awt.Event class. + * + * @since Android 1.0 */ public abstract class AWTEvent extends EventObject { - - /** The Constant serialVersionUID. */ + + /** + * The Constant serialVersionUID. + */ private static final long serialVersionUID = -1825314779160409405L; - /** The Constant COMPONENT_EVENT_MASK indicates the event relates to a component. */ + /** + * The Constant COMPONENT_EVENT_MASK indicates the event relates to a + * component. + */ public static final long COMPONENT_EVENT_MASK = 1; - /** The Constant CONTAINER_EVENT_MASK indicates the event relates to a container. */ + /** + * The Constant CONTAINER_EVENT_MASK indicates the event relates to a + * container. + */ public static final long CONTAINER_EVENT_MASK = 2; - /** The Constant FOCUS_EVENT_MASK indicates the event relates to the focus. */ + /** + * The Constant FOCUS_EVENT_MASK indicates the event relates to the focus. + */ public static final long FOCUS_EVENT_MASK = 4; - /** The Constant KEY_EVENT_MASK indicates the event relates to a key. */ + /** + * The Constant KEY_EVENT_MASK indicates the event relates to a key. + */ public static final long KEY_EVENT_MASK = 8; - /** The Constant MOUSE_EVENT_MASK indicates the event relates to the mouse. */ + /** + * The Constant MOUSE_EVENT_MASK indicates the event relates to the mouse. + */ public static final long MOUSE_EVENT_MASK = 16; - /** The Constant MOUSE_MOTION_EVENT_MASK indicates the event relates to a mouse motion. */ + /** + * The Constant MOUSE_MOTION_EVENT_MASK indicates the event relates to a + * mouse motion. + */ public static final long MOUSE_MOTION_EVENT_MASK = 32; - /** The Constant WINDOW_EVENT_MASK indicates the event relates to a window. */ + /** + * The Constant WINDOW_EVENT_MASK indicates the event relates to a window. + */ public static final long WINDOW_EVENT_MASK = 64; - /** The Constant ACTION_EVENT_MASK indicates the event relates to an action. */ + /** + * The Constant ACTION_EVENT_MASK indicates the event relates to an action. + */ public static final long ACTION_EVENT_MASK = 128; - /** The Constant ADJUSTMENT_EVENT_MASK indicates the event relates to an adjustment. */ + /** + * The Constant ADJUSTMENT_EVENT_MASK indicates the event relates to an + * adjustment. + */ public static final long ADJUSTMENT_EVENT_MASK = 256; - /** The Constant ITEM_EVENT_MASK indicates the event relates to an item. */ + /** + * The Constant ITEM_EVENT_MASK indicates the event relates to an item. + */ public static final long ITEM_EVENT_MASK = 512; - /** The Constant TEXT_EVENT_MASK indicates the event relates to text. */ + /** + * The Constant TEXT_EVENT_MASK indicates the event relates to text. + */ public static final long TEXT_EVENT_MASK = 1024; - /** The Constant INPUT_METHOD_EVENT_MASK indicates the event relates to an input method. */ + /** + * The Constant INPUT_METHOD_EVENT_MASK indicates the event relates to an + * input method. + */ public static final long INPUT_METHOD_EVENT_MASK = 2048; - /** The Constant PAINT_EVENT_MASK indicates the event relates to a paint method. */ + /** + * The Constant PAINT_EVENT_MASK indicates the event relates to a paint + * method. + */ public static final long PAINT_EVENT_MASK = 8192; - /** The Constant INVOCATION_EVENT_MASK indicates the event relates to a method invocation. */ + /** + * The Constant INVOCATION_EVENT_MASK indicates the event relates to a + * method invocation. + */ public static final long INVOCATION_EVENT_MASK = 16384; - /** The Constant HIERARCHY_EVENT_MASK indicates the event relates to a hierarchy. */ + /** + * The Constant HIERARCHY_EVENT_MASK indicates the event relates to a + * hierarchy. + */ public static final long HIERARCHY_EVENT_MASK = 32768; - /** - * The Constant HIERARCHY_BOUNDS_EVENT_MASK indicates the event relates to hierarchy bounds. + /** + * The Constant HIERARCHY_BOUNDS_EVENT_MASK indicates the event relates to + * hierarchy bounds. */ public static final long HIERARCHY_BOUNDS_EVENT_MASK = 65536; - /** The Constant MOUSE_WHEEL_EVENT_MASK indicates the event relates to the mouse wheel. */ + /** + * The Constant MOUSE_WHEEL_EVENT_MASK indicates the event relates to the + * mouse wheel. + */ public static final long MOUSE_WHEEL_EVENT_MASK = 131072; - /** The Constant WINDOW_STATE_EVENT_MASK indicates the event relates to a window state. */ + /** + * The Constant WINDOW_STATE_EVENT_MASK indicates the event relates to a + * window state. + */ public static final long WINDOW_STATE_EVENT_MASK = 262144; - /** The Constant WINDOW_FOCUS_EVENT_MASK indicates the event relates to a window focus. */ + /** + * The Constant WINDOW_FOCUS_EVENT_MASK indicates the event relates to a + * window focus. + */ public static final long WINDOW_FOCUS_EVENT_MASK = 524288; - /** The Constant RESERVED_ID_MAX indicates the maximum value for reserved - * AWT event IDs. + /** + * The Constant RESERVED_ID_MAX indicates the maximum value for reserved AWT + * event IDs. */ public static final int RESERVED_ID_MAX = 1999; - /** The Constant eventsMap. */ + /** + * The Constant eventsMap. + */ private static final Hashtable eventsMap = new Hashtable(); - /** The converter. */ + /** + * The converter. + */ private static EventConverter converter; - /** The ID of the event. */ + /** + * The ID of the event. + */ protected int id; - /** - * The consumed indicates whether or not the event is sent back down to - * the peer once the source has processed it (false means it's sent to the peer, + /** + * The consumed indicates whether or not the event is sent back down to the + * peer once the source has processed it (false means it's sent to the peer, * true means it's not). - */ + */ protected boolean consumed; - /** The dispatched by kfm. */ + /** + * The dispatched by kfm. + */ boolean dispatchedByKFM; - - /** The is posted. */ + + /** + * The is posted. + */ transient boolean isPosted; static { - eventsMap.put(new Integer(KeyEvent.KEY_TYPED), - new EventDescriptor(KEY_EVENT_MASK, KeyListener.class)); - eventsMap.put(new Integer(KeyEvent.KEY_PRESSED), - new EventDescriptor(KEY_EVENT_MASK, KeyListener.class)); - eventsMap.put(new Integer(KeyEvent.KEY_RELEASED), - new EventDescriptor(KEY_EVENT_MASK, KeyListener.class)); - eventsMap.put(new Integer(MouseEvent.MOUSE_CLICKED), - new EventDescriptor(MOUSE_EVENT_MASK, MouseListener.class)); - eventsMap.put(new Integer(MouseEvent.MOUSE_PRESSED), - new EventDescriptor(MOUSE_EVENT_MASK, MouseListener.class)); - eventsMap.put(new Integer(MouseEvent.MOUSE_RELEASED), - new EventDescriptor(MOUSE_EVENT_MASK, MouseListener.class)); - eventsMap.put(new Integer(MouseEvent.MOUSE_MOVED), - new EventDescriptor(MOUSE_MOTION_EVENT_MASK, MouseMotionListener.class)); - eventsMap.put(new Integer(MouseEvent.MOUSE_ENTERED), - new EventDescriptor(MOUSE_EVENT_MASK, MouseListener.class)); - eventsMap.put(new Integer(MouseEvent.MOUSE_EXITED), - new EventDescriptor(MOUSE_EVENT_MASK, MouseListener.class)); - eventsMap.put(new Integer(MouseEvent.MOUSE_DRAGGED), - new EventDescriptor(MOUSE_MOTION_EVENT_MASK, MouseMotionListener.class)); - eventsMap.put(new Integer(MouseEvent.MOUSE_WHEEL), - new EventDescriptor(MOUSE_WHEEL_EVENT_MASK, MouseWheelListener.class)); - eventsMap.put(new Integer(ComponentEvent.COMPONENT_MOVED), - new EventDescriptor(COMPONENT_EVENT_MASK, ComponentListener.class)); - eventsMap.put(new Integer(ComponentEvent.COMPONENT_RESIZED), - new EventDescriptor(COMPONENT_EVENT_MASK, ComponentListener.class)); - eventsMap.put(new Integer(ComponentEvent.COMPONENT_SHOWN), - new EventDescriptor(COMPONENT_EVENT_MASK, ComponentListener.class)); - eventsMap.put(new Integer(ComponentEvent.COMPONENT_HIDDEN), - new EventDescriptor(COMPONENT_EVENT_MASK, ComponentListener.class)); - eventsMap.put(new Integer(FocusEvent.FOCUS_GAINED), - new EventDescriptor(FOCUS_EVENT_MASK, FocusListener.class)); - eventsMap.put(new Integer(FocusEvent.FOCUS_LOST), - new EventDescriptor(FOCUS_EVENT_MASK, FocusListener.class)); - eventsMap.put(new Integer(PaintEvent.PAINT), - new EventDescriptor(PAINT_EVENT_MASK, null)); - eventsMap.put(new Integer(PaintEvent.UPDATE), - new EventDescriptor(PAINT_EVENT_MASK, null)); - eventsMap.put(new Integer(WindowEvent.WINDOW_OPENED), - new EventDescriptor(WINDOW_EVENT_MASK, WindowListener.class)); - eventsMap.put(new Integer(WindowEvent.WINDOW_CLOSING), - new EventDescriptor(WINDOW_EVENT_MASK, WindowListener.class)); - eventsMap.put(new Integer(WindowEvent.WINDOW_CLOSED), - new EventDescriptor(WINDOW_EVENT_MASK, WindowListener.class)); - eventsMap.put(new Integer(WindowEvent.WINDOW_DEICONIFIED), - new EventDescriptor(WINDOW_EVENT_MASK, WindowListener.class)); - eventsMap.put(new Integer(WindowEvent.WINDOW_ICONIFIED), - new EventDescriptor(WINDOW_EVENT_MASK, WindowListener.class)); - eventsMap.put(new Integer(WindowEvent.WINDOW_STATE_CHANGED), - new EventDescriptor(WINDOW_STATE_EVENT_MASK, WindowStateListener.class)); - eventsMap.put(new Integer(WindowEvent.WINDOW_LOST_FOCUS), - new EventDescriptor(WINDOW_FOCUS_EVENT_MASK, WindowFocusListener.class)); - eventsMap.put(new Integer(WindowEvent.WINDOW_GAINED_FOCUS), - new EventDescriptor(WINDOW_FOCUS_EVENT_MASK, WindowFocusListener.class)); - eventsMap.put(new Integer(WindowEvent.WINDOW_DEACTIVATED), - new EventDescriptor(WINDOW_EVENT_MASK, WindowListener.class)); - eventsMap.put(new Integer(WindowEvent.WINDOW_ACTIVATED), - new EventDescriptor(WINDOW_EVENT_MASK, WindowListener.class)); - eventsMap.put(new Integer(HierarchyEvent.HIERARCHY_CHANGED), - new EventDescriptor(HIERARCHY_EVENT_MASK, HierarchyListener.class)); - eventsMap.put(new Integer(HierarchyEvent.ANCESTOR_MOVED), - new EventDescriptor(HIERARCHY_BOUNDS_EVENT_MASK, HierarchyBoundsListener.class)); - eventsMap.put(new Integer(HierarchyEvent.ANCESTOR_RESIZED), - new EventDescriptor(HIERARCHY_BOUNDS_EVENT_MASK, HierarchyBoundsListener.class)); - eventsMap.put(new Integer(ContainerEvent.COMPONENT_ADDED), - new EventDescriptor(CONTAINER_EVENT_MASK, ContainerListener.class)); - eventsMap.put(new Integer(ContainerEvent.COMPONENT_REMOVED), - new EventDescriptor(CONTAINER_EVENT_MASK, ContainerListener.class)); - eventsMap.put(new Integer(InputMethodEvent.INPUT_METHOD_TEXT_CHANGED), - new EventDescriptor(INPUT_METHOD_EVENT_MASK, InputMethodListener.class)); - eventsMap.put(new Integer(InputMethodEvent.CARET_POSITION_CHANGED), - new EventDescriptor(INPUT_METHOD_EVENT_MASK, InputMethodListener.class)); - eventsMap.put(new Integer(InvocationEvent.INVOCATION_DEFAULT), - new EventDescriptor(INVOCATION_EVENT_MASK, null)); - eventsMap.put(new Integer(ItemEvent.ITEM_STATE_CHANGED), - new EventDescriptor(ITEM_EVENT_MASK, ItemListener.class)); - eventsMap.put(new Integer(TextEvent.TEXT_VALUE_CHANGED), - new EventDescriptor(TEXT_EVENT_MASK, TextListener.class)); - eventsMap.put(new Integer(ActionEvent.ACTION_PERFORMED), - new EventDescriptor(ACTION_EVENT_MASK, ActionListener.class)); - eventsMap.put(new Integer(AdjustmentEvent.ADJUSTMENT_VALUE_CHANGED), - new EventDescriptor(ADJUSTMENT_EVENT_MASK, AdjustmentListener.class)); + eventsMap.put(new Integer(KeyEvent.KEY_TYPED), new EventDescriptor(KEY_EVENT_MASK, + KeyListener.class)); + eventsMap.put(new Integer(KeyEvent.KEY_PRESSED), new EventDescriptor(KEY_EVENT_MASK, + KeyListener.class)); + eventsMap.put(new Integer(KeyEvent.KEY_RELEASED), new EventDescriptor(KEY_EVENT_MASK, + KeyListener.class)); + eventsMap.put(new Integer(MouseEvent.MOUSE_CLICKED), new EventDescriptor(MOUSE_EVENT_MASK, + MouseListener.class)); + eventsMap.put(new Integer(MouseEvent.MOUSE_PRESSED), new EventDescriptor(MOUSE_EVENT_MASK, + MouseListener.class)); + eventsMap.put(new Integer(MouseEvent.MOUSE_RELEASED), new EventDescriptor(MOUSE_EVENT_MASK, + MouseListener.class)); + eventsMap.put(new Integer(MouseEvent.MOUSE_MOVED), new EventDescriptor( + MOUSE_MOTION_EVENT_MASK, MouseMotionListener.class)); + eventsMap.put(new Integer(MouseEvent.MOUSE_ENTERED), new EventDescriptor(MOUSE_EVENT_MASK, + MouseListener.class)); + eventsMap.put(new Integer(MouseEvent.MOUSE_EXITED), new EventDescriptor(MOUSE_EVENT_MASK, + MouseListener.class)); + eventsMap.put(new Integer(MouseEvent.MOUSE_DRAGGED), new EventDescriptor( + MOUSE_MOTION_EVENT_MASK, MouseMotionListener.class)); + eventsMap.put(new Integer(MouseEvent.MOUSE_WHEEL), new EventDescriptor( + MOUSE_WHEEL_EVENT_MASK, MouseWheelListener.class)); + eventsMap.put(new Integer(ComponentEvent.COMPONENT_MOVED), new EventDescriptor( + COMPONENT_EVENT_MASK, ComponentListener.class)); + eventsMap.put(new Integer(ComponentEvent.COMPONENT_RESIZED), new EventDescriptor( + COMPONENT_EVENT_MASK, ComponentListener.class)); + eventsMap.put(new Integer(ComponentEvent.COMPONENT_SHOWN), new EventDescriptor( + COMPONENT_EVENT_MASK, ComponentListener.class)); + eventsMap.put(new Integer(ComponentEvent.COMPONENT_HIDDEN), new EventDescriptor( + COMPONENT_EVENT_MASK, ComponentListener.class)); + eventsMap.put(new Integer(FocusEvent.FOCUS_GAINED), new EventDescriptor(FOCUS_EVENT_MASK, + FocusListener.class)); + eventsMap.put(new Integer(FocusEvent.FOCUS_LOST), new EventDescriptor(FOCUS_EVENT_MASK, + FocusListener.class)); + eventsMap.put(new Integer(PaintEvent.PAINT), new EventDescriptor(PAINT_EVENT_MASK, null)); + eventsMap.put(new Integer(PaintEvent.UPDATE), new EventDescriptor(PAINT_EVENT_MASK, null)); + eventsMap.put(new Integer(WindowEvent.WINDOW_OPENED), new EventDescriptor( + WINDOW_EVENT_MASK, WindowListener.class)); + eventsMap.put(new Integer(WindowEvent.WINDOW_CLOSING), new EventDescriptor( + WINDOW_EVENT_MASK, WindowListener.class)); + eventsMap.put(new Integer(WindowEvent.WINDOW_CLOSED), new EventDescriptor( + WINDOW_EVENT_MASK, WindowListener.class)); + eventsMap.put(new Integer(WindowEvent.WINDOW_DEICONIFIED), new EventDescriptor( + WINDOW_EVENT_MASK, WindowListener.class)); + eventsMap.put(new Integer(WindowEvent.WINDOW_ICONIFIED), new EventDescriptor( + WINDOW_EVENT_MASK, WindowListener.class)); + eventsMap.put(new Integer(WindowEvent.WINDOW_STATE_CHANGED), new EventDescriptor( + WINDOW_STATE_EVENT_MASK, WindowStateListener.class)); + eventsMap.put(new Integer(WindowEvent.WINDOW_LOST_FOCUS), new EventDescriptor( + WINDOW_FOCUS_EVENT_MASK, WindowFocusListener.class)); + eventsMap.put(new Integer(WindowEvent.WINDOW_GAINED_FOCUS), new EventDescriptor( + WINDOW_FOCUS_EVENT_MASK, WindowFocusListener.class)); + eventsMap.put(new Integer(WindowEvent.WINDOW_DEACTIVATED), new EventDescriptor( + WINDOW_EVENT_MASK, WindowListener.class)); + eventsMap.put(new Integer(WindowEvent.WINDOW_ACTIVATED), new EventDescriptor( + WINDOW_EVENT_MASK, WindowListener.class)); + eventsMap.put(new Integer(HierarchyEvent.HIERARCHY_CHANGED), new EventDescriptor( + HIERARCHY_EVENT_MASK, HierarchyListener.class)); + eventsMap.put(new Integer(HierarchyEvent.ANCESTOR_MOVED), new EventDescriptor( + HIERARCHY_BOUNDS_EVENT_MASK, HierarchyBoundsListener.class)); + eventsMap.put(new Integer(HierarchyEvent.ANCESTOR_RESIZED), new EventDescriptor( + HIERARCHY_BOUNDS_EVENT_MASK, HierarchyBoundsListener.class)); + eventsMap.put(new Integer(ContainerEvent.COMPONENT_ADDED), new EventDescriptor( + CONTAINER_EVENT_MASK, ContainerListener.class)); + eventsMap.put(new Integer(ContainerEvent.COMPONENT_REMOVED), new EventDescriptor( + CONTAINER_EVENT_MASK, ContainerListener.class)); + eventsMap.put(new Integer(InputMethodEvent.INPUT_METHOD_TEXT_CHANGED), new EventDescriptor( + INPUT_METHOD_EVENT_MASK, InputMethodListener.class)); + eventsMap.put(new Integer(InputMethodEvent.CARET_POSITION_CHANGED), new EventDescriptor( + INPUT_METHOD_EVENT_MASK, InputMethodListener.class)); + eventsMap.put(new Integer(InvocationEvent.INVOCATION_DEFAULT), new EventDescriptor( + INVOCATION_EVENT_MASK, null)); + eventsMap.put(new Integer(ItemEvent.ITEM_STATE_CHANGED), new EventDescriptor( + ITEM_EVENT_MASK, ItemListener.class)); + eventsMap.put(new Integer(TextEvent.TEXT_VALUE_CHANGED), new EventDescriptor( + TEXT_EVENT_MASK, TextListener.class)); + eventsMap.put(new Integer(ActionEvent.ACTION_PERFORMED), new EventDescriptor( + ACTION_EVENT_MASK, ActionListener.class)); + eventsMap.put(new Integer(AdjustmentEvent.ADJUSTMENT_VALUE_CHANGED), new EventDescriptor( + ADJUSTMENT_EVENT_MASK, AdjustmentListener.class)); converter = new EventConverter(); } - + /** * Instantiates a new AWT event from the specified Event object. * - * @param event the Event object. + * @param event + * the Event object. */ public AWTEvent(Event event) { this(event.target, event.id); @@ -219,8 +282,10 @@ public abstract class AWTEvent extends EventObject { /** * Instantiates a new AWT event with the specified object and type. * - * @param source the source Object. - * @param id the event's type. + * @param source + * the source Object. + * @param id + * the event's type. */ public AWTEvent(Object source, int id) { super(source); @@ -240,7 +305,8 @@ public abstract class AWTEvent extends EventObject { /** * Sets a new source for the AWTEvent. * - * @param newSource the new source Object for the AWTEvent. + * @param newSource + * the new source Object for the AWTEvent. */ public void setSource(Object newSource) { source = newSource; @@ -253,33 +319,32 @@ public abstract class AWTEvent extends EventObject { */ @Override public String toString() { - /* The format is based on 1.5 release behavior - * which can be revealed by the following code: - * - * AWTEvent event = new AWTEvent(new Component(){}, 1){}; - * System.out.println(event); + /* + * The format is based on 1.5 release behavior which can be revealed by + * the following code: AWTEvent event = new AWTEvent(new Component(){}, + * 1){}; System.out.println(event); */ String name = ""; //$NON-NLS-1$ - + if (source instanceof Component && (source != null)) { - Component comp = (Component) getSource(); + Component comp = (Component)getSource(); name = comp.getName(); if (name == null) { name = ""; //$NON-NLS-1$ } } - + return (getClass().getName() + "[" + paramString() + "]" //$NON-NLS-1$ //$NON-NLS-2$ + " on " + (name.length() > 0 ? name : source)); //$NON-NLS-1$ } /** - * Returns a string representation of the AWTEvent state. - * + * Returns a string representation of the AWTEvent state. + * * @return a string representation of the AWTEvent state. */ public String paramString() { - //nothing to implement: all event types must override this method + // nothing to implement: all event types must override this method return ""; //$NON-NLS-1$ } @@ -296,73 +361,77 @@ public abstract class AWTEvent extends EventObject { * Consumes the AWTEvent. */ protected void consume() { - consumed = true; + consumed = true; } /** * Convert AWTEvent object to a corresponding (deprecated) Event object. * - * @return new Event object which is a converted AWTEvent object or null - * if the conversion is not possible + * @return new Event object which is a converted AWTEvent object or null if + * the conversion is not possible */ Event getEvent() { - + if (id == ActionEvent.ACTION_PERFORMED) { - ActionEvent ae = (ActionEvent) this; + ActionEvent ae = (ActionEvent)this; return converter.convertActionEvent(ae); } else if (id == AdjustmentEvent.ADJUSTMENT_VALUE_CHANGED) { - AdjustmentEvent ae = (AdjustmentEvent) this; + AdjustmentEvent ae = (AdjustmentEvent)this; return converter.convertAdjustmentEvent(ae); -//???AWT -// } else if (id == ComponentEvent.COMPONENT_MOVED -// && source instanceof Window) { -// //the only type of Component events is COMPONENT_MOVED on window -// ComponentEvent ce = (ComponentEvent) this; -// return converter.convertComponentEvent(ce); + // ???AWT + // } else if (id == ComponentEvent.COMPONENT_MOVED + // && source instanceof Window) { + // //the only type of Component events is COMPONENT_MOVED on window + // ComponentEvent ce = (ComponentEvent) this; + // return converter.convertComponentEvent(ce); } else if (id >= FocusEvent.FOCUS_FIRST && id <= FocusEvent.FOCUS_LAST) { - //nothing to convert + // nothing to convert -//???AWT -// } else if (id == ItemEvent.ITEM_STATE_CHANGED) { -// ItemEvent ie = (ItemEvent) this; -// return converter.convertItemEvent(ie); + // ???AWT + // } else if (id == ItemEvent.ITEM_STATE_CHANGED) { + // ItemEvent ie = (ItemEvent) this; + // return converter.convertItemEvent(ie); } else if (id == KeyEvent.KEY_PRESSED || id == KeyEvent.KEY_RELEASED) { - KeyEvent ke = (KeyEvent) this; + KeyEvent ke = (KeyEvent)this; return converter.convertKeyEvent(ke); } else if (id >= MouseEvent.MOUSE_FIRST && id <= MouseEvent.MOUSE_LAST) { - MouseEvent me = (MouseEvent) this; + MouseEvent me = (MouseEvent)this; return converter.convertMouseEvent(me); - } else if (id == WindowEvent.WINDOW_CLOSING - || id == WindowEvent.WINDOW_ICONIFIED + } else if (id == WindowEvent.WINDOW_CLOSING || id == WindowEvent.WINDOW_ICONIFIED || id == WindowEvent.WINDOW_DEICONIFIED) { - //nothing to convert + // nothing to convert } else { return null; } return new Event(source, id, null); } - /** - * The Class EventDescriptor. + * The class EventDescriptor. */ static final class EventDescriptor { - /** The event mask. */ + /** + * The event mask. + */ final long eventMask; - /** The listener type. */ + /** + * The listener type. + */ final Class listenerType; /** * Instantiates a new event descriptor. * - * @param eventMask the event mask - * @param listenerType the listener type + * @param eventMask + * the event mask. + * @param listenerType + * the listener type. */ EventDescriptor(long eventMask, Class listenerType) { this.eventMask = eventMask; @@ -370,24 +439,28 @@ public abstract class AWTEvent extends EventObject { } } - + /** - * The Class EventTypeLookup. + * The class EventTypeLookup. */ static final class EventTypeLookup { - - /** The last event. */ + + /** + * The last event. + */ private AWTEvent lastEvent = null; - - /** The last event descriptor. */ + + /** + * The last event descriptor. + */ private EventDescriptor lastEventDescriptor = null; /** * Gets the event descriptor. * - * @param event the event - * - * @return the event descriptor + * @param event + * the event. + * @return the event descriptor. */ EventDescriptor getEventDescriptor(AWTEvent event) { synchronized (this) { @@ -403,9 +476,9 @@ public abstract class AWTEvent extends EventObject { /** * Gets the event mask. * - * @param event the event - * - * @return the event mask + * @param event + * the event. + * @return the event mask. */ long getEventMask(AWTEvent event) { final EventDescriptor ed = getEventDescriptor(event); @@ -414,65 +487,62 @@ public abstract class AWTEvent extends EventObject { } /** - * The Class EventConverter. + * The class EventConverter. */ static final class EventConverter { - - /** The Constant OLD_MOD_MASK. */ - static final int OLD_MOD_MASK = Event.ALT_MASK | Event.CTRL_MASK - | Event.META_MASK | Event.SHIFT_MASK; + + /** + * The constant OLD_MOD_MASK. + */ + static final int OLD_MOD_MASK = Event.ALT_MASK | Event.CTRL_MASK | Event.META_MASK + | Event.SHIFT_MASK; /** * Convert action event. * - * @param ae the ae - * - * @return the event + * @param ae + * the ae. + * @return the event. */ Event convertActionEvent(ActionEvent ae) { Event evt = new Event(ae.getSource(), ae.getID(), ae.getActionCommand()); evt.when = ae.getWhen(); evt.modifiers = ae.getModifiers() & OLD_MOD_MASK; - /* if (source instanceof Button) { - arg = ((Button) source).getLabel(); - } else if (source instanceof Checkbox) { - arg = new Boolean(((Checkbox) source).getState()); - } else if (source instanceof CheckboxMenuItem) { - arg = ((CheckboxMenuItem) source).getLabel(); - } else if (source instanceof Choice) { - arg = ((Choice) source).getSelectedItem(); - } else if (source instanceof List) { - arg = ((List) source).getSelectedItem(); - } else if (source instanceof MenuItem) { - arg = ((MenuItem) source).getLabel(); - } else if (source instanceof TextField) { - arg = ((TextField) source).getText(); - } -*/ + /* + * if (source instanceof Button) { arg = ((Button) + * source).getLabel(); } else if (source instanceof Checkbox) { arg + * = new Boolean(((Checkbox) source).getState()); } else if (source + * instanceof CheckboxMenuItem) { arg = ((CheckboxMenuItem) + * source).getLabel(); } else if (source instanceof Choice) { arg = + * ((Choice) source).getSelectedItem(); } else if (source instanceof + * List) { arg = ((List) source).getSelectedItem(); } else if + * (source instanceof MenuItem) { arg = ((MenuItem) + * source).getLabel(); } else if (source instanceof TextField) { arg + * = ((TextField) source).getText(); } + */ return evt; } - /** * Convert adjustment event. * - * @param ae the ae - * - * @return the event + * @param ae + * the ae. + * @return the event. */ Event convertAdjustmentEvent(AdjustmentEvent ae) { - //TODO: Event.SCROLL_BEGIN/SCROLL_END - return new Event(ae.source, ae.id + ae.getAdjustmentType() - 1, - new Integer(ae.getValue())); + // TODO: Event.SCROLL_BEGIN/SCROLL_END + return new Event(ae.source, ae.id + ae.getAdjustmentType() - 1, new Integer(ae + .getValue())); } /** * Convert component event. * - * @param ce the ce - * - * @return the event + * @param ce + * the ce. + * @return the event. */ Event convertComponentEvent(ComponentEvent ce) { Component comp = ce.getComponent(); @@ -482,35 +552,27 @@ public abstract class AWTEvent extends EventObject { return evt; } - //???AWT + // ???AWT /* - Event convertItemEvent(ItemEvent ie) { - int oldId = ie.id + ie.getStateChange() - 1; - Object source = ie.source; - int idx = -1; - if (source instanceof List) { - List list = (List) source; - idx = list.getSelectedIndex(); - } - else if (source instanceof Choice) { - Choice choice = (Choice) source; - idx = choice.getSelectedIndex(); - } - Object arg = idx >= 0 ? new Integer(idx) : null; - return new Event(source, oldId, arg); - } - */ - + * Event convertItemEvent(ItemEvent ie) { int oldId = ie.id + + * ie.getStateChange() - 1; Object source = ie.source; int idx = -1; if + * (source instanceof List) { List list = (List) source; idx = + * list.getSelectedIndex(); } else if (source instanceof Choice) { + * Choice choice = (Choice) source; idx = choice.getSelectedIndex(); } + * Object arg = idx >= 0 ? new Integer(idx) : null; return new + * Event(source, oldId, arg); } + */ + /** * Convert key event. * - * @param ke the ke - * - * @return the event + * @param ke + * the ke. + * @return the event. */ Event convertKeyEvent(KeyEvent ke) { int oldId = ke.id; - //leave only old Event's modifiers + // leave only old Event's modifiers int mod = ke.getModifiers() & OLD_MOD_MASK; Component comp = ke.getComponent(); @@ -518,7 +580,7 @@ public abstract class AWTEvent extends EventObject { int keyCode = ke.getKeyCode(); int key = convertKey(keyChar, keyCode); if (key >= Event.HOME && key <= Event.INSERT) { - oldId += 2; //non-ASCII key -> action key + oldId += 2; // non-ASCII key -> action key } return new Event(comp, ke.getWhen(), oldId, 0, 0, key, mod); } @@ -526,9 +588,9 @@ public abstract class AWTEvent extends EventObject { /** * Convert mouse event. * - * @param me the me - * - * @return the event + * @param me + * the me. + * @return the event. */ Event convertMouseEvent(MouseEvent me) { int id = me.id; @@ -537,7 +599,7 @@ public abstract class AWTEvent extends EventObject { evt.x = me.getX(); evt.y = me.getY(); int mod = me.getModifiers(); - //in Event modifiers mean button number for mouse events: + // in Event modifiers mean button number for mouse events: evt.modifiers = mod & (Event.ALT_MASK | Event.META_MASK); if (id == MouseEvent.MOUSE_PRESSED) { evt.clickCount = me.getClickCount(); @@ -546,68 +608,69 @@ public abstract class AWTEvent extends EventObject { } return null; } - + /** * Convert key. * - * @param keyChar the key char - * @param keyCode the key code - * - * @return the int + * @param keyChar + * the key char. + * @param keyCode + * the key code. + * @return the int. */ int convertKey(char keyChar, int keyCode) { int key; - //F1 - F12 + // F1 - F12 if (keyCode >= KeyEvent.VK_F1 && keyCode <= KeyEvent.VK_F12) { key = Event.F1 + keyCode - KeyEvent.VK_F1; } else { switch (keyCode) { - default: //non-action key - key = keyChar; - break; - //action keys: - case KeyEvent.VK_HOME: - key = Event.HOME; - break; - case KeyEvent.VK_END: - key = Event.END; - break; - case KeyEvent.VK_PAGE_UP: - key = Event.PGUP; - break; - case KeyEvent.VK_PAGE_DOWN: - key = Event.PGDN; - break; - case KeyEvent.VK_UP: - key = Event.UP; - break; - case KeyEvent.VK_DOWN: - key = Event.DOWN; - break; - case KeyEvent.VK_LEFT: - key = Event.LEFT; - break; - case KeyEvent.VK_RIGHT: - key = Event.RIGHT; - break; - case KeyEvent.VK_PRINTSCREEN: - key = Event.PRINT_SCREEN; - break; - case KeyEvent.VK_SCROLL_LOCK: - key = Event.SCROLL_LOCK; - break; - case KeyEvent.VK_CAPS_LOCK: - key = Event.CAPS_LOCK; - break; - case KeyEvent.VK_NUM_LOCK: - key = Event.NUM_LOCK; - break; - case KeyEvent.VK_PAUSE: - key = Event.PAUSE; - break; - case KeyEvent.VK_INSERT: - key = Event.INSERT; - break; + default: // non-action key + key = keyChar; + break; + // action keys: + case KeyEvent.VK_HOME: + key = Event.HOME; + break; + case KeyEvent.VK_END: + key = Event.END; + break; + case KeyEvent.VK_PAGE_UP: + key = Event.PGUP; + break; + case KeyEvent.VK_PAGE_DOWN: + key = Event.PGDN; + break; + case KeyEvent.VK_UP: + key = Event.UP; + break; + case KeyEvent.VK_DOWN: + key = Event.DOWN; + break; + case KeyEvent.VK_LEFT: + key = Event.LEFT; + break; + case KeyEvent.VK_RIGHT: + key = Event.RIGHT; + break; + case KeyEvent.VK_PRINTSCREEN: + key = Event.PRINT_SCREEN; + break; + case KeyEvent.VK_SCROLL_LOCK: + key = Event.SCROLL_LOCK; + break; + case KeyEvent.VK_CAPS_LOCK: + key = Event.CAPS_LOCK; + break; + case KeyEvent.VK_NUM_LOCK: + key = Event.NUM_LOCK; + break; + case KeyEvent.VK_PAUSE: + key = Event.PAUSE; + break; + case KeyEvent.VK_INSERT: + key = Event.INSERT; + break; } } return key; diff --git a/awt/java/awt/AWTException.java b/awt/java/awt/AWTException.java index 70ce6e175d9f7..6590b73d1dff9 100644 --- a/awt/java/awt/AWTException.java +++ b/awt/java/awt/AWTException.java @@ -18,26 +18,30 @@ * @author Michael Danilov * @version $Revision$ */ -package java.awt; +package java.awt; /** - * The AWTException class is used to provide notification and information - * about AWT errors. + * The AWTException class is used to provide notification and information about + * AWT errors. + * + * @since Android 1.0 */ public class AWTException extends Exception { - - /** The Constant serialVersionUID. */ + + /** + * The Constant serialVersionUID. + */ private static final long serialVersionUID = -1900414231151323879L; /** * Instantiates a new AWT exception with the specified message. * - * @param msg the specific message for current exception. + * @param msg + * the specific message for current exception. */ public AWTException(String msg) { super(msg); } } - diff --git a/awt/java/awt/AWTKeyStroke.java b/awt/java/awt/AWTKeyStroke.java index 5e7de4e3fcdc1..f01f6f00ec94e 100644 --- a/awt/java/awt/AWTKeyStroke.java +++ b/awt/java/awt/AWTKeyStroke.java @@ -18,7 +18,9 @@ * @author Dmitry A. Durnev * @version $Revision$ */ + package java.awt; + import java.awt.event.InputEvent; import java.awt.event.KeyEvent; import java.io.ObjectStreamException; @@ -36,7 +38,7 @@ import org.apache.harmony.awt.internal.nls.Messages; * The AWTKeyStroke holds all of the information for the complete act of * typing a character. This includes the events that are generated when * the key is pressed, released, or typed (pressed and released generating - * a unicode character result) which are associated with the event + * a Unicode character result) which are associated with the event * objects KeyEvent.KEY_PRESSED, KeyEvent.KEY_RELEASED, or KeyEvent.KEY_TYPED. * It also holds information about which modifiers (such as control or * shift) were used in conjunction with the keystroke. The following masks @@ -57,19 +59,41 @@ import org.apache.harmony.awt.internal.nls.Messages; * The AWTKeyStroke is unique, and applications should not create their own * instances of AWTKeyStroke. All applications should use getAWTKeyStroke * methods for obtaining instances of AWTKeyStroke. + * + * @since Android 1.0 */ public class AWTKeyStroke implements Serializable { - - /** The Constant serialVersionUID. */ + + /** + * The Constant serialVersionUID. + */ private static final long serialVersionUID = -6430539691155161871L; - /** The Constant cache. */ - private static final Map cache = new HashMap(); //Map - - /** The Constant keyEventTypesMap. */ - private static final Map keyEventTypesMap = new HashMap(); //Map + /** + * The Constant cache. + */ + private static final Map cache = new HashMap(); // Map - private static Constructor subConstructor; + // < + // AWTKeyStroke + // , + // ? + // extends + // AWTKeyStroke + // > + + /** + * The Constant keyEventTypesMap. + */ + private static final Map keyEventTypesMap = new HashMap(); // Map + + // < + // int + // , + // String + // > + + private static Constructor subConstructor; static { keyEventTypesMap.put(new Integer(KeyEvent.KEY_PRESSED), "pressed"); //$NON-NLS-1$ @@ -77,53 +101,66 @@ public class AWTKeyStroke implements Serializable { keyEventTypesMap.put(new Integer(KeyEvent.KEY_TYPED), "typed"); //$NON-NLS-1$ } - /** The key char. */ + /** + * The key char. + */ private char keyChar; - - /** The key code. */ + + /** + * The key code. + */ private int keyCode; - - /** The modifiers. */ + + /** + * The modifiers. + */ private int modifiers; - - /** The on key release. */ + + /** + * The on key release. + */ private boolean onKeyRelease; - + /** - * Instantiates a new AWTKeyStroke. - * getAWTKeyStroke method should be used by applications code. - * - * @param keyChar the key char - * @param keyCode the key code - * @param modifiers the modifiers - * @param onKeyRelease true if AWTKeyStroke is for a key release, overwise false. - */ - protected AWTKeyStroke(char keyChar, int keyCode, int modifiers, - boolean onKeyRelease) - { - setAWTKeyStroke(keyChar, keyCode, modifiers, onKeyRelease); + * Instantiates a new AWTKeyStroke. getAWTKeyStroke method should be used by + * applications code. + * + * @param keyChar + * the key char. + * @param keyCode + * the key code. + * @param modifiers + * the modifiers. + * @param onKeyRelease + * true if AWTKeyStroke is for a key release, false otherwise. + */ + protected AWTKeyStroke(char keyChar, int keyCode, int modifiers, boolean onKeyRelease) { + setAWTKeyStroke(keyChar, keyCode, modifiers, onKeyRelease); } - /** Sets the awt key stroke. - * - * @param keyChar the key char - * @param keyCode the key code - * @param modifiers the modifiers - * @param onKeyRelease the on key release - */ - private void setAWTKeyStroke( char keyChar, int keyCode, int modifiers, - boolean onKeyRelease) - { + /** + * Sets the AWT key stroke. + * + * @param keyChar + * the key char. + * @param keyCode + * the key code. + * @param modifiers + * the modifiers. + * @param onKeyRelease + * the on key release. + */ + private void setAWTKeyStroke(char keyChar, int keyCode, int modifiers, boolean onKeyRelease) { this.keyChar = keyChar; this.keyCode = keyCode; this.modifiers = modifiers; this.onKeyRelease = onKeyRelease; } - + /** * Instantiates a new AWTKeyStroke with default parameters: - * KeyEvent.CHAR_UNDEFINED key char, KeyEvent.VK_UNDEFINED key code, - * without modifiers and false key realised value. + * KeyEvent.CHAR_UNDEFINED key char, KeyEvent.VK_UNDEFINED key code, without + * modifiers and false key realized value. */ protected AWTKeyStroke() { this(KeyEvent.CHAR_UNDEFINED, KeyEvent.VK_UNDEFINED, 0, false); @@ -132,42 +169,44 @@ public class AWTKeyStroke implements Serializable { /** * Returns the unique number value for AWTKeyStroke object. * - * @return the int unique value of the AWTKeyStroke object. + * @return the integer unique value of the AWTKeyStroke object. */ @Override public int hashCode() { - return modifiers + ( keyCode != KeyEvent.VK_UNDEFINED ? - keyCode : keyChar) + (onKeyRelease ? -1 : 0); + return modifiers + (keyCode != KeyEvent.VK_UNDEFINED ? keyCode : keyChar) + + (onKeyRelease ? -1 : 0); } /** * Gets the set of modifiers for the AWTKeyStroke object. * - * @return the int value which contains modifiers. + * @return the integer value which contains modifiers. */ public final int getModifiers() { return modifiers; } /** - * Compares the AWTKeyStroke object to the specified object. + * Compares this AWTKeyStroke object to the specified object. * - * @return true, if objects are identical, overwise false. + * @param anObject + * the specified AWTKeyStroke object to compare with this + * instance. + * @return true if objects are identical, false otherwise. */ @Override public final boolean equals(Object anObject) { if (anObject instanceof AWTKeyStroke) { AWTKeyStroke key = (AWTKeyStroke)anObject; - return ((key.keyCode == keyCode) && (key.keyChar == keyChar) && - (key.modifiers == modifiers) && - (key.onKeyRelease == onKeyRelease)); + return ((key.keyCode == keyCode) && (key.keyChar == keyChar) + && (key.modifiers == modifiers) && (key.onKeyRelease == onKeyRelease)); } return false; } /** - * Returns the string representation of the AWTKeyStroke. - * This string should contain key stroke properties. + * Returns the string representation of the AWTKeyStroke. This string should + * contain key stroke properties. * * @return the string representation of the AWTKeyStroke. */ @@ -175,9 +214,10 @@ public class AWTKeyStroke implements Serializable { public String toString() { int type = getKeyEventType(); return InputEvent.getModifiersExText(getModifiers()) + " " + //$NON-NLS-1$ - keyEventTypesMap.get(new Integer(type)) + " " + //$NON-NLS-1$ - (type == KeyEvent.KEY_TYPED ? new String(new char[] {keyChar}) : - KeyEvent.getKeyText(keyCode)); + keyEventTypesMap.get(new Integer(type)) + " " + //$NON-NLS-1$ + (type == KeyEvent.KEY_TYPED ? new String(new char[] { + keyChar + }) : KeyEvent.getKeyText(keyCode)); } /** @@ -201,16 +241,18 @@ public class AWTKeyStroke implements Serializable { /** * Gets the AWT key stroke. * - * @param keyChar the key char - * @param keyCode the key code - * @param modifiers the modifiers - * @param onKeyRelease the on key release - * - * @return the AWT key stroke + * @param keyChar + * the key char. + * @param keyCode + * the key code. + * @param modifiers + * the modifiers. + * @param onKeyRelease + * the on key release. + * @return the AWT key stroke. */ - private static AWTKeyStroke getAWTKeyStroke(char keyChar, int keyCode, - int modifiers, - boolean onKeyRelease) { + private static AWTKeyStroke getAWTKeyStroke(char keyChar, int keyCode, int modifiers, + boolean onKeyRelease) { AWTKeyStroke key = newInstance(keyChar, keyCode, modifiers, onKeyRelease); AWTKeyStroke value = cache.get(key); @@ -224,28 +266,30 @@ public class AWTKeyStroke implements Serializable { /** * New instance. * - * @param keyChar the key char - * @param keyCode the key code - * @param modifiers the modifiers - * @param onKeyRelease the on key release - * - * @return the AWT key stroke + * @param keyChar + * the key char. + * @param keyCode + * the key code. + * @param modifiers + * the modifiers. + * @param onKeyRelease + * the on key release. + * @return the AWT key stroke. */ - private static AWTKeyStroke newInstance(char keyChar, int keyCode, - int modifiers, - boolean onKeyRelease) { + private static AWTKeyStroke newInstance(char keyChar, int keyCode, int modifiers, + boolean onKeyRelease) { AWTKeyStroke key; - //???AWT -// if (subConstructor == null) { - key = new AWTKeyStroke(); - //???AWT -// } else { -// try { -// key = (AWTKeyStroke) subConstructor.newInstance(); -// } catch (Exception e) { -// throw new RuntimeException(e); -// } -// } + // ???AWT + // if (subConstructor == null) { + key = new AWTKeyStroke(); + // ???AWT + // } else { + // try { + // key = (AWTKeyStroke) subConstructor.newInstance(); + // } catch (Exception e) { + // throw new RuntimeException(e); + // } + // } int allModifiers = getAllModifiers(modifiers); key.setAWTKeyStroke(keyChar, keyCode, allModifiers, onKeyRelease); return key; @@ -254,21 +298,22 @@ public class AWTKeyStroke implements Serializable { /** * Adds the mask. * - * @param mod the mod - * @param mask the mask - * - * @return the int + * @param mod + * the mod. + * @param mask + * the mask. + * @return the int. */ private static int addMask(int mod, int mask) { return ((mod & mask) != 0) ? (mod | mask) : mod; } /** - * return all (old & new) modifiers corresponding to. - * - * @param mod old or new modifiers + * Return all (old & new) modifiers corresponding to. * - * @return old and new modifiers together + * @param mod + * old or new modifiers. + * @return old and new modifiers together. */ static int getAllModifiers(int mod) { int allMod = mod; @@ -289,27 +334,23 @@ public class AWTKeyStroke implements Serializable { } /** - * Returns an instance of AWTKeyStroke for parsed string. - * - * The string must have the following syntax: + * Returns an instance of AWTKeyStroke for parsed string. The string must + * have the following syntax: *

* <modifiers>* (<typedID> | <pressedReleasedID>) *

- * modifiers := shift | control | ctrl | meta | alt | altGraph - *
- * typedID := typed - *
- * typedKey := string of length 1 giving the Unicode character. - *
- * pressedReleasedID := (pressed | released) - *
+ * modifiers := shift | control | ctrl | meta | alt | altGraph
+ * typedID := typed
+ * typedKey := string of length 1 giving the Unicode character.
+ * pressedReleasedID := (pressed | released)
* key := KeyEvent key code name, i.e. the name following "VK_". *

- * @param s the String which contains key stroke parameters. * + * @param s + * the String which contains key stroke parameters. * @return the AWTKeyStroke for string. - * - * @throws IllegalArgumentException if string has incorrect format or null. + * @throws IllegalArgumentException + * if string has incorrect format or null. */ public static AWTKeyStroke getAWTKeyStroke(String s) { if (s == null) { @@ -351,16 +392,15 @@ public class AWTKeyStroke implements Serializable { throw new IllegalArgumentException(Messages.getString("awt.66")); //$NON-NLS-1$ } - return getAWTKeyStroke(keyChar, keyCode, modifiers, - release == Boolean.TRUE); + return getAWTKeyStroke(keyChar, keyCode, modifiers, release == Boolean.TRUE); } /** * Gets the next token. * - * @param tokenizer the tokenizer - * - * @return the next token + * @param tokenizer + * the tokenizer. + * @return the next token. */ private static String getNextToken(StringTokenizer tokenizer) { try { @@ -374,9 +414,9 @@ public class AWTKeyStroke implements Serializable { /** * Gets the key code. * - * @param s the s - * - * @return the key code + * @param s + * the s. + * @return the key code. */ static int getKeyCode(String s) { try { @@ -394,8 +434,8 @@ public class AWTKeyStroke implements Serializable { /** * Gets an instance of the AWTKeyStroke for specified character. * - * @param keyChar the keyboard character value. - * + * @param keyChar + * the keyboard character value. * @return a AWTKeyStroke for specified character. */ public static AWTKeyStroke getAWTKeyStroke(char keyChar) { @@ -403,120 +443,121 @@ public class AWTKeyStroke implements Serializable { } /** - * Returns an instance of AWTKeyStroke for a given key code, set - * of modifiers, and specified key released flag value. - * The key codes are defined in java.awt.event.KeyEvent class. - * The set of modifiers is given as a bitwise combination - * of masks taken from the following list: + * Returns an instance of AWTKeyStroke for a given key code, set of + * modifiers, and specified key released flag value. The key codes are + * defined in java.awt.event.KeyEvent class. The set of modifiers is given + * as a bitwise combination of masks taken from the following list: *

    - *
  • java.awt.event.InputEvent.ALT_GRAPH_DOWN_MASK
  • - *
  • java.awt.event.InputEvent.ALT_DOWN_MASK
  • - *
  • java.awt.event.InputEvent.CTRL_DOWN_MASK
  • - *
  • java.awt.event.InputEvent.META_DOWN_MASK
  • - *
  • java.awt.event.InputEvent.SHIFT_DOWN_MASK
  • - *
  • java.awt.event.InputEvent.ALT_GRAPH_MASK
  • - *
  • java.awt.event.InputEvent.ALT_MASK
  • - *
  • java.awt.event.InputEvent.CTRL_MASK
  • - *
  • java.awt.event.InputEvent.META_MASK
  • - *
  • java.awt.event.InputEvent.SHIFT_MASK
  • + *
  • java.awt.event.InputEvent.ALT_GRAPH_DOWN_MASK
  • + * java.awt.event.InputEvent.ALT_DOWN_MASK
  • + * java.awt.event.InputEvent.CTRL_DOWN_MASK
  • + * java.awt.event.InputEvent.META_DOWN_MASK
  • + * java.awt.event.InputEvent.SHIFT_DOWN_MASK
  • + * java.awt.event.InputEvent.ALT_GRAPH_MASK
  • + * java.awt.event.InputEvent.ALT_MASK
  • + * java.awt.event.InputEvent.CTRL_MASK
  • + * java.awt.event.InputEvent.META_MASK
  • + * java.awt.event.InputEvent.SHIFT_MASK
  • *
- *
- * - * @param keyCode the specified key code of keyboard. - * @param modifiers the bit set of modifiers. + *
* + * @param keyCode + * the specified key code of keyboard. + * @param modifiers + * the bit set of modifiers. + * @param onKeyRelease + * the value which represents whether this AWTKeyStroke shall + * represents a key release. * @return the AWTKeyStroke. */ - public static AWTKeyStroke getAWTKeyStroke(int keyCode, int modifiers, - boolean onKeyRelease) { - return getAWTKeyStroke(KeyEvent.CHAR_UNDEFINED, keyCode, modifiers, - onKeyRelease); + public static AWTKeyStroke getAWTKeyStroke(int keyCode, int modifiers, boolean onKeyRelease) { + return getAWTKeyStroke(KeyEvent.CHAR_UNDEFINED, keyCode, modifiers, onKeyRelease); } /** - * Returns AWTKeyStroke for a specified character and set of modifiers. - * The set of modifiers is given as a bitwise combination - * of masks taken from the following list: + * Returns AWTKeyStroke for a specified character and set of modifiers. The + * set of modifiers is given as a bitwise combination of masks taken from + * the following list: *
    - *
  • java.awt.event.InputEvent.ALT_GRAPH_DOWN_MASK
  • - *
  • java.awt.event.InputEvent.ALT_DOWN_MASK
  • - *
  • java.awt.event.InputEvent.CTRL_DOWN_MASK
  • - *
  • java.awt.event.InputEvent.META_DOWN_MASK
  • - *
  • java.awt.event.InputEvent.SHIFT_DOWN_MASK
  • - *
  • java.awt.event.InputEvent.ALT_GRAPH_MASK
  • - *
  • java.awt.event.InputEvent.ALT_MASK
  • - *
  • java.awt.event.InputEvent.CTRL_MASK
  • - *
  • java.awt.event.InputEvent.META_MASK
  • - *
  • java.awt.event.InputEvent.SHIFT_MASK
  • + *
  • java.awt.event.InputEvent.ALT_GRAPH_DOWN_MASK
  • + * java.awt.event.InputEvent.ALT_DOWN_MASK
  • + * java.awt.event.InputEvent.CTRL_DOWN_MASK
  • + * java.awt.event.InputEvent.META_DOWN_MASK
  • + * java.awt.event.InputEvent.SHIFT_DOWN_MASK
  • + * java.awt.event.InputEvent.ALT_GRAPH_MASK
  • + * java.awt.event.InputEvent.ALT_MASK
  • + * java.awt.event.InputEvent.CTRL_MASK
  • + * java.awt.event.InputEvent.META_MASK
  • + * java.awt.event.InputEvent.SHIFT_MASK
  • *
* - * @param keyChar the Character object which represents keyboard character value. - * @param modifiers the bit set of modifiers. - * + * @param keyChar + * the Character object which represents keyboard character + * value. + * @param modifiers + * the bit set of modifiers. * @return the AWTKeyStroke object. - * - * @throws IllegalArgumentException if keyChar value is null. + * @throws IllegalArgumentException + * if keyChar value is null. */ public static AWTKeyStroke getAWTKeyStroke(Character keyChar, int modifiers) { if (keyChar == null) { // awt.01='{0}' parameter is null throw new IllegalArgumentException(Messages.getString("awt.01", "keyChar")); //$NON-NLS-1$ //$NON-NLS-2$ } - return getAWTKeyStroke(keyChar.charValue(), KeyEvent.VK_UNDEFINED, - modifiers, false); + return getAWTKeyStroke(keyChar.charValue(), KeyEvent.VK_UNDEFINED, modifiers, false); } /** - * Returns an instance of AWTKeyStroke for a specified key code and - * set of modifiers. - * The key codes are defined in java.awt.event.KeyEvent class. - * The set of modifiers is given as a bitwise combination - * of masks taken from the following list: + * Returns an instance of AWTKeyStroke for a specified key code and set of + * modifiers. The key codes are defined in java.awt.event.KeyEvent class. + * The set of modifiers is given as a bitwise combination of masks taken + * from the following list: *
    - *
  • java.awt.event.InputEvent.ALT_GRAPH_DOWN_MASK
  • - *
  • java.awt.event.InputEvent.ALT_DOWN_MASK
  • - *
  • java.awt.event.InputEvent.CTRL_DOWN_MASK
  • - *
  • java.awt.event.InputEvent.META_DOWN_MASK
  • - *
  • java.awt.event.InputEvent.SHIFT_DOWN_MASK
  • - *
  • java.awt.event.InputEvent.ALT_GRAPH_MASK
  • - *
  • java.awt.event.InputEvent.ALT_MASK
  • - *
  • java.awt.event.InputEvent.CTRL_MASK
  • - *
  • java.awt.event.InputEvent.META_MASK
  • - *
  • java.awt.event.InputEvent.SHIFT_MASK
  • + *
  • java.awt.event.InputEvent.ALT_GRAPH_DOWN_MASK
  • + * java.awt.event.InputEvent.ALT_DOWN_MASK
  • + * java.awt.event.InputEvent.CTRL_DOWN_MASK
  • + * java.awt.event.InputEvent.META_DOWN_MASK
  • + * java.awt.event.InputEvent.SHIFT_DOWN_MASK
  • + * java.awt.event.InputEvent.ALT_GRAPH_MASK
  • + * java.awt.event.InputEvent.ALT_MASK
  • + * java.awt.event.InputEvent.CTRL_MASK
  • + * java.awt.event.InputEvent.META_MASK
  • + * java.awt.event.InputEvent.SHIFT_MASK
  • *
- * - * @param keyCode the specified key code of keyboard. - * @param modifiers the bit set of modifiers. * - * @return the AWTKeyStroke + * @param keyCode + * the specified key code of keyboard. + * @param modifiers + * the bit set of modifiers. + * @return the AWTKeyStroke. */ public static AWTKeyStroke getAWTKeyStroke(int keyCode, int modifiers) { return getAWTKeyStroke(keyCode, modifiers, false); } /** - * Gets the AWTKeyStroke for a key event. This method obtains the key char + * Gets the AWTKeyStroke for a key event. This method obtains the key char * and key code from the specified key event. * - * @param anEvent the key event which identifies the desired AWTKeyStroke. - * + * @param anEvent + * the key event which identifies the desired AWTKeyStroke. * @return the AWTKeyStroke for the key event. */ public static AWTKeyStroke getAWTKeyStrokeForEvent(KeyEvent anEvent) { int id = anEvent.getID(); char undef = KeyEvent.CHAR_UNDEFINED; - char keyChar = (id == KeyEvent.KEY_TYPED ? anEvent.getKeyChar() : - undef); - int keyCode = (keyChar == undef ? anEvent.getKeyCode() : - KeyEvent.VK_UNDEFINED); + char keyChar = (id == KeyEvent.KEY_TYPED ? anEvent.getKeyChar() : undef); + int keyCode = (keyChar == undef ? anEvent.getKeyCode() : KeyEvent.VK_UNDEFINED); return getAWTKeyStroke(keyChar, keyCode, anEvent.getModifiersEx(), - id == KeyEvent.KEY_RELEASED); + id == KeyEvent.KEY_RELEASED); } /** * Gets the key event type for the AWTKeyStroke object. * - * @return the key event type: KeyEvent.KEY_PRESSED, KeyEvent.KEY_TYPED, or KeyEvent.KEY_RELEASED + * @return the key event type: KeyEvent.KEY_PRESSED, KeyEvent.KEY_TYPED, or + * KeyEvent.KEY_RELEASED. */ public final int getKeyEventType() { if (keyCode == KeyEvent.VK_UNDEFINED) { @@ -526,11 +567,11 @@ public class AWTKeyStroke implements Serializable { } /** - * Retuns true if the key event is associated with the AWTKeyStroke is - * KEY_RELEASED, overwise false. + * Returns true if the key event is associated with the AWTKeyStroke is + * KEY_RELEASED, false otherwise. * - * @return true, if if the key event associated with the AWTKeyStroke is - * KEY_RELEASED, overwise false. + * @return true, if if the key event associated with the AWTKeyStroke is + * KEY_RELEASED, false otherwise. */ public final boolean isOnKeyRelease() { return onKeyRelease; @@ -539,50 +580,44 @@ public class AWTKeyStroke implements Serializable { /** * Read resolve. * - * @return the object - * - * @throws ObjectStreamException the object stream exception + * @return the object. + * @throws ObjectStreamException + * the object stream exception. */ protected Object readResolve() throws ObjectStreamException { - return getAWTKeyStroke(this.keyChar, this.keyCode, - this.modifiers, this.onKeyRelease); + return getAWTKeyStroke(this.keyChar, this.keyCode, this.modifiers, this.onKeyRelease); } /** * Register subclass. * - * @param subclass the subclass + * @param subclass + * the subclass. */ protected static void registerSubclass(Class subclass) { - //???AWT + // ???AWT /* - if (subclass == null) { - // awt.01='{0}' parameter is null - throw new IllegalArgumentException(Messages.getString("awt.01", "subclass")); //$NON-NLS-1$ //$NON-NLS-2$ - } - if (! AWTKeyStroke.class.isAssignableFrom(subclass)) { - // awt.67=subclass is not derived from AWTKeyStroke - throw new ClassCastException(Messages.getString("awt.67")); //$NON-NLS-1$ - } - try { - subConstructor = subclass.getDeclaredConstructor(); - subConstructor.setAccessible(true); - } catch (SecurityException e) { - throw new RuntimeException(e); - } catch (NoSuchMethodException e) { - // awt.68=subclass could not be instantiated - throw new IllegalArgumentException(Messages.getString("awt.68")); //$NON-NLS-1$ - } - cache.clear(); //flush the cache - */ + * if (subclass == null) { // awt.01='{0}' parameter is null throw new + * IllegalArgumentException(Messages.getString("awt.01", "subclass")); + * //$NON-NLS-1$ //$NON-NLS-2$ } if (! + * AWTKeyStroke.class.isAssignableFrom(subclass)) { // awt.67=subclass + * is not derived from AWTKeyStroke throw new + * ClassCastException(Messages.getString("awt.67")); //$NON-NLS-1$ } try + * { subConstructor = subclass.getDeclaredConstructor(); + * subConstructor.setAccessible(true); } catch (SecurityException e) { + * throw new RuntimeException(e); } catch (NoSuchMethodException e) { // + * awt.68=subclass could not be instantiated throw new + * IllegalArgumentException(Messages.getString("awt.68")); //$NON-NLS-1$ + * } cache.clear(); //flush the cache + */ } /** * Parses the modifier. * - * @param strMod the str mod - * - * @return the long + * @param strMod + * the str mod. + * @return the long. */ private static long parseModifier(String strMod) { long modifiers = 0l; @@ -609,9 +644,9 @@ public class AWTKeyStroke implements Serializable { /** * Parses the typed id. * - * @param strTyped the str typed - * - * @return true, if successful + * @param strTyped + * the str typed. + * @return true, if successful. */ private static boolean parseTypedID(String strTyped) { if (strTyped.equals("typed")) { //$NON-NLS-1$ @@ -624,9 +659,9 @@ public class AWTKeyStroke implements Serializable { /** * Parses the typed key. * - * @param strChar the str char - * - * @return the char + * @param strChar + * the str char. + * @return the char. */ private static char parseTypedKey(String strChar) { char keyChar = KeyEvent.CHAR_UNDEFINED; @@ -642,9 +677,9 @@ public class AWTKeyStroke implements Serializable { /** * Parses the pressed released id. * - * @param str the str - * - * @return the boolean + * @param str + * the str. + * @return the boolean. */ private static Boolean parsePressedReleasedID(String str) { @@ -659,9 +694,9 @@ public class AWTKeyStroke implements Serializable { /** * Parses the key. * - * @param strCode the str code - * - * @return the int + * @param strCode + * the str code. + * @return the int. */ private static int parseKey(String strCode) { int keyCode = KeyEvent.VK_UNDEFINED; @@ -675,4 +710,3 @@ public class AWTKeyStroke implements Serializable { return keyCode; } } - diff --git a/awt/java/awt/AWTPermission.java b/awt/java/awt/AWTPermission.java index 25326abb1a6b2..4bd835777d612 100644 --- a/awt/java/awt/AWTPermission.java +++ b/awt/java/awt/AWTPermission.java @@ -18,24 +18,31 @@ * @author Pavel Dolgov * @version $Revision$ */ + package java.awt; import java.security.BasicPermission; /** - * The AWTPermission specifies the name of the permission and the - * corresponding action list. + * The AWTPermission specifies the name of the permission and the corresponding + * action list. + * + * @since Android 1.0 */ public final class AWTPermission extends BasicPermission { - - /** The Constant serialVersionUID. */ + + /** + * The Constant serialVersionUID. + */ private static final long serialVersionUID = 8890392402588814465L; /** * Instantiates a new AWTPermission with defined name and actions. * - * @param name the name of a new AWTPermission. - * @param actions the actions of a new AWTPermission. + * @param name + * the name of a new AWTPermission. + * @param actions + * the actions of a new AWTPermission. */ public AWTPermission(String name, String actions) { super(name, actions); @@ -44,11 +51,11 @@ public final class AWTPermission extends BasicPermission { /** * Instantiates a new AWT permission with the defined name. * - * @param name the name of a new AWTPermission. + * @param name + * the name of a new AWTPermission. */ public AWTPermission(String name) { super(name); } } - diff --git a/awt/java/awt/ActiveEvent.java b/awt/java/awt/ActiveEvent.java index 41337524a6028..704462390a017 100644 --- a/awt/java/awt/ActiveEvent.java +++ b/awt/java/awt/ActiveEvent.java @@ -18,18 +18,21 @@ * @author Michael Danilov * @version $Revision$ */ + package java.awt; /** - * This interface defines events that know how to dispatch themselves. - * Such event can be placed upon the event queue and its dispatch method - * will be called when the event is dispatched. + * This interface defines events that know how to dispatch themselves. Such + * event can be placed upon the event queue and its dispatch method will be + * called when the event is dispatched. + * + * @since Android 1.0 */ public interface ActiveEvent { /** - * Dispatches the event to the listeners of the event's source, - * or does whatever it is this event is supposed to do. + * Dispatches the event to the listeners of the event's source, or does + * whatever it is this event is supposed to do. */ public void dispatch(); diff --git a/awt/java/awt/Adjustable.java b/awt/java/awt/Adjustable.java index 3241cad1dbeba..baf80f7c7c6fd 100644 --- a/awt/java/awt/Adjustable.java +++ b/awt/java/awt/Adjustable.java @@ -18,32 +18,35 @@ * @author Pavel Dolgov * @version $Revision$ */ + package java.awt; import java.awt.event.AdjustmentListener; /** - * The Adjustable interface represents an adjustable numeric value - * contained within a bounded range of values, such as the current - * location in scrollable region or the value of a gauge. + * The Adjustable interface represents an adjustable numeric value contained + * within a bounded range of values, such as the current location in scrollable + * region or the value of a gauge. + * + * @since Android 1.0 */ public interface Adjustable { - /** - * The Constant HORIZONTAL indicates that the Adjustable's orientation - * is horizontal. + /** + * The Constant HORIZONTAL indicates that the Adjustable's orientation is + * horizontal. */ public static final int HORIZONTAL = 0; - /** - * The Constant VERTICAL indicates that the Adjustable's orientation - * is vertical. + /** + * The Constant VERTICAL indicates that the Adjustable's orientation is + * vertical. */ public static final int VERTICAL = 1; - /** - * The Constant NO_ORIENTATION indicates that the Adjustable - * has no orientation. + /** + * The Constant NO_ORIENTATION indicates that the Adjustable has no + * orientation. */ public static final int NO_ORIENTATION = 2; @@ -57,14 +60,16 @@ public interface Adjustable { /** * Sets the value to the Adjustable object. * - * @param a0 the new value of the Adjustable object. + * @param a0 + * the new value of the Adjustable object. */ public void setValue(int a0); /** * Adds the AdjustmentListener to current Adjustment. * - * @param a0 the AdjustmentListener object. + * @param a0 + * the AdjustmentListener object. */ public void addAdjustmentListener(AdjustmentListener a0); @@ -85,7 +90,7 @@ public interface Adjustable { /** * Gets the minimum value of the Adjustable. * - * @return the minimum value of the Adjustable. + * @return the minimum value of the Adjustable. */ public int getMinimum(); @@ -113,44 +118,49 @@ public interface Adjustable { /** * Removes the adjustment listener of the Adjustable. * - * @param a0 the specified AdjustmentListener to be removed. + * @param a0 + * the specified AdjustmentListener to be removed. */ public void removeAdjustmentListener(AdjustmentListener a0); /** * Sets the block increment for the Adjustable. * - * @param a0 the new block increment. + * @param a0 + * the new block increment. */ public void setBlockIncrement(int a0); /** * Sets the maximum value of the Adjustable. * - * @param a0 the new maximum of the Adjustable. + * @param a0 + * the new maximum of the Adjustable. */ public void setMaximum(int a0); /** * Sets the minimum value of the Adjustable. * - * @param a0 the new minimum of the Adjustable. + * @param a0 + * the new minimum of the Adjustable. */ public void setMinimum(int a0); /** * Sets the unit increment of the Adjustable. * - * @param a0 the new unit increment of the Adjustable. + * @param a0 + * the new unit increment of the Adjustable. */ public void setUnitIncrement(int a0); /** * Sets the visible amount of the Adjustable. * - * @param a0 the new visible amount of the Adjustable. + * @param a0 + * the new visible amount of the Adjustable. */ public void setVisibleAmount(int a0); } - diff --git a/awt/java/awt/AlphaComposite.java b/awt/java/awt/AlphaComposite.java index d26753c316a76..8389eb4621fe2 100644 --- a/awt/java/awt/AlphaComposite.java +++ b/awt/java/awt/AlphaComposite.java @@ -18,6 +18,7 @@ * @author Igor V. Stolyarov * @version $Revision$ */ + package java.awt; import java.awt.Composite; @@ -28,148 +29,181 @@ import java.awt.image.ColorModel; import org.apache.harmony.awt.gl.ICompositeContext; import org.apache.harmony.awt.internal.nls.Messages; - /** - * The AlphaComposite class defines a basic alpha compositing rules for - * combining source and destination colors to achieve blending and - * transparency effects with graphics and images. + * The AlphaComposite class defines a basic alpha compositing rules for + * combining source and destination colors to achieve blending and transparency + * effects with graphics and images. + * + * @since Android 1.0 */ public final class AlphaComposite implements Composite { - /** - * The Constant CLEAR indicates that both the color and the alpha of - * the destination are cleared (Porter-Duff Clear rule). + /** + * The Constant CLEAR indicates that both the color and the alpha of the + * destination are cleared (Porter-Duff Clear rule). */ public static final int CLEAR = 1; - /** - * The Constant SRC indicates that the source is copied to the destination + /** + * The Constant SRC indicates that the source is copied to the destination * (Porter-Duff Source rule). */ public static final int SRC = 2; - /** The Constant DST indicates that the destination is left untouched + /** + * The Constant DST indicates that the destination is left untouched * (Porter-Duff Destination rule). */ public static final int DST = 9; - /** - * The Constant SRC_OVER indicates that the source is composited over - * the destination (Porter-Duff Source Over Destination rule). + /** + * The Constant SRC_OVER indicates that the source is composited over the + * destination (Porter-Duff Source Over Destination rule). */ public static final int SRC_OVER = 3; /** - * The Constant DST_OVER indicates that The destination is composited over - * the source and the result replaces the destination - * (Porter-Duff Destination Over Source rule). + * The Constant DST_OVER indicates that The destination is composited over + * the source and the result replaces the destination (Porter-Duff + * Destination Over Source rule). */ public static final int DST_OVER = 4; /** - * The Constant SRC_IN indicates that the part of the source lying - * inside of the destination replaces the destination (Porter-Duff - * Source In Destination rule). + * The Constant SRC_IN indicates that the part of the source lying inside of + * the destination replaces the destination (Porter-Duff Source In + * Destination rule). */ public static final int SRC_IN = 5; - /** - * The Constant DST_IN indicates that the part of the destination - * lying inside of the source replaces the destination - * (Porter-Duff Destination In Source rule). + /** + * The Constant DST_IN indicates that the part of the destination lying + * inside of the source replaces the destination (Porter-Duff Destination In + * Source rule). */ public static final int DST_IN = 6; /** - * The Constant SRC_OUT indicates that the part of the source lying - * outside of the destination replaces the destination (Porter-Duff - * Source Held Out By Destination rule). + * The Constant SRC_OUT indicates that the part of the source lying outside + * of the destination replaces the destination (Porter-Duff Source Held Out + * By Destination rule). */ public static final int SRC_OUT = 7; - /** - * The Constant DST_OUT indicates that the part of the destination - * lying outside of the source replaces the destination (Porter-Duff - * Destination Held Out By Source rule). + /** + * The Constant DST_OUT indicates that the part of the destination lying + * outside of the source replaces the destination (Porter-Duff Destination + * Held Out By Source rule). */ public static final int DST_OUT = 8; - /** - * The Constant SRC_ATOP indicates that the part of the source lying - * inside of the destination is composited onto the destination - * (Porter-Duff Source Atop Destination rule). + /** + * The Constant SRC_ATOP indicates that the part of the source lying inside + * of the destination is composited onto the destination (Porter-Duff Source + * Atop Destination rule). */ public static final int SRC_ATOP = 10; - /** - * The Constant DST_ATOP indicates that the part of the destination - * lying inside of the source is composited over the source and replaces - * the destination (Porter-Duff Destination Atop Source rule). + /** + * The Constant DST_ATOP indicates that the part of the destination lying + * inside of the source is composited over the source and replaces the + * destination (Porter-Duff Destination Atop Source rule). */ public static final int DST_ATOP = 11; /** - * The Constant XOR indicates that the part of the source that lies - * outside of the destination is combined with the part of the destination - * that lies outside of the source (Porter-Duff Source Xor Destination rule). + * The Constant XOR indicates that the part of the source that lies outside + * of the destination is combined with the part of the destination that lies + * outside of the source (Porter-Duff Source Xor Destination rule). */ public static final int XOR = 12; - /** AlphaComposite object with the opaque CLEAR rule and an alpha of 1.0f. */ + /** + * AlphaComposite object with the opaque CLEAR rule and an alpha of 1.0f. + */ public static final AlphaComposite Clear = new AlphaComposite(CLEAR); - /** AlphaComposite object with the opaque SRC rule and an alpha of 1.0f. */ + /** + * AlphaComposite object with the opaque SRC rule and an alpha of 1.0f. + */ public static final AlphaComposite Src = new AlphaComposite(SRC); - /** AlphaComposite object with the opaque DST rule and an alpha of 1.0f. */ + /** + * AlphaComposite object with the opaque DST rule and an alpha of 1.0f. + */ public static final AlphaComposite Dst = new AlphaComposite(DST); - /** AlphaComposite object with the opaque SRC_OVER rule and an alpha of 1.0f. */ + /** + * AlphaComposite object with the opaque SRC_OVER rule and an alpha of 1.0f. + */ public static final AlphaComposite SrcOver = new AlphaComposite(SRC_OVER); - /** AlphaComposite object with the opaque DST_OVER rule and an alpha of 1.0f. */ + /** + * AlphaComposite object with the opaque DST_OVER rule and an alpha of 1.0f. + */ public static final AlphaComposite DstOver = new AlphaComposite(DST_OVER); - /** AlphaComposite object with the opaque SRC_IN rule and an alpha of 1.0f. */ + /** + * AlphaComposite object with the opaque SRC_IN rule and an alpha of 1.0f. + */ public static final AlphaComposite SrcIn = new AlphaComposite(SRC_IN); - /** AlphaComposite object with the opaque DST_IN rule and an alpha of 1.0f. */ + /** + * AlphaComposite object with the opaque DST_IN rule and an alpha of 1.0f. + */ public static final AlphaComposite DstIn = new AlphaComposite(DST_IN); - /** AlphaComposite object with the opaque SRC_OUT rule and an alpha of 1.0f. */ + /** + * AlphaComposite object with the opaque SRC_OUT rule and an alpha of 1.0f. + */ public static final AlphaComposite SrcOut = new AlphaComposite(SRC_OUT); - /** AlphaComposite object with the opaque DST_OUT rule and an alpha of 1.0f. */ + /** + * AlphaComposite object with the opaque DST_OUT rule and an alpha of 1.0f. + */ public static final AlphaComposite DstOut = new AlphaComposite(DST_OUT); - /** AlphaComposite object with the opaque SRC_ATOP rule and an alpha of 1.0f. */ + /** + * AlphaComposite object with the opaque SRC_ATOP rule and an alpha of 1.0f. + */ public static final AlphaComposite SrcAtop = new AlphaComposite(SRC_ATOP); - /** AlphaComposite object with the opaque DST_ATOP rule and an alpha of 1.0f. */ + /** + * AlphaComposite object with the opaque DST_ATOP rule and an alpha of 1.0f. + */ public static final AlphaComposite DstAtop = new AlphaComposite(DST_ATOP); - /** AlphaComposite object with the opaque XOR rule and an alpha of 1.0f. */ + /** + * AlphaComposite object with the opaque XOR rule and an alpha of 1.0f. + */ public static final AlphaComposite Xor = new AlphaComposite(XOR); - /** The rule. */ + /** + * The rule. + */ private int rule; - - /** The alpha. */ + + /** + * The alpha. + */ private float alpha; /** - * Instantiates a new alpha composite. - * Creates a context for the compositing operation. The context contains state that is used in performing the compositing operation. + * Instantiates a new alpha composite. Creates a context for the compositing + * operation. The context contains state that is used in performing the + * compositing operation. * - * @param rule the rule - * @param alpha the alpha + * @param rule + * the rule. + * @param alpha + * the alpha. */ - private AlphaComposite(int rule, float alpha){ - if(rule < CLEAR || rule > XOR) { + private AlphaComposite(int rule, float alpha) { + if (rule < CLEAR || rule > XOR) { // awt.11D=Unknown rule throw new IllegalArgumentException(Messages.getString("awt.11D")); //$NON-NLS-1$ } - if(alpha < 0.0f || alpha > 1.0f) { + if (alpha < 0.0f || alpha > 1.0f) { // awt.11E=Wrong alpha value throw new IllegalArgumentException(Messages.getString("awt.11E")); //$NON-NLS-1$ } @@ -181,41 +215,44 @@ public final class AlphaComposite implements Composite { /** * Instantiates a new alpha composite. * - * @param rule the rule + * @param rule + * the rule. */ - private AlphaComposite(int rule){ + private AlphaComposite(int rule) { this(rule, 1.0f); } /** * Creates a CompositeContext object with the specified source ColorModel, - * destination ColorModel and RenderingHints parameters for a composing + * destination ColorModel and RenderingHints parameters for a composing * operation. * - * @param srcColorModel the source's ColorModel. - * @param dstColorModel the destination's ColorModel. - * @param hints the RenderingHints object. - * - * @return the CompositeContext object. - * - * @see java.awt.Composite#createContext(java.awt.image.ColorModel, java.awt.image.ColorModel, java.awt.RenderingHints) + * @param srcColorModel + * the source's ColorModel. + * @param dstColorModel + * the destination's ColorModel. + * @param hints + * the RenderingHints object. + * @return the CompositeContext object. + * @see java.awt.Composite#createContext(java.awt.image.ColorModel, + * java.awt.image.ColorModel, java.awt.RenderingHints) */ - public CompositeContext createContext(ColorModel srcColorModel, - ColorModel dstColorModel, RenderingHints hints) { + public CompositeContext createContext(ColorModel srcColorModel, ColorModel dstColorModel, + RenderingHints hints) { return new ICompositeContext(this, srcColorModel, dstColorModel); } /** * Compares the AlphaComposite object with the specified object. * - * @param obj the Object to be compared. - * + * @param obj + * the Object to be compared. * @return true, if the AlphaComposite object is equal to the specified - * object. + * object. */ @Override public boolean equals(Object obj) { - if(!(obj instanceof AlphaComposite)) { + if (!(obj instanceof AlphaComposite)) { return false; } AlphaComposite other = (AlphaComposite)obj; @@ -247,11 +284,11 @@ public final class AlphaComposite implements Composite { } /** - * Gets the alpha value of this AlphaComposite object; returns 1.0 if - * this AlphaComposite object doesn't have alpha value. + * Gets the alpha value of this AlphaComposite object; returns 1.0 if this + * AlphaComposite object doesn't have alpha value. * - * @return the alpha value of this AlphaComposite object or 1.0 if - * this AlphaComposite object doesn't have alpha value. + * @return the alpha value of this AlphaComposite object or 1.0 if this + * AlphaComposite object doesn't have alpha value. */ public float getAlpha() { return alpha; @@ -260,13 +297,14 @@ public final class AlphaComposite implements Composite { /** * Gets the AlphaComposite instance with the specified rule and alpha value. * - * @param rule the compositing rule. - * @param alpha the alpha value. - * - * @return AlphaComposite instance. + * @param rule + * the compositing rule. + * @param alpha + * the alpha value. + * @return the AlphaComposite instance. */ public static AlphaComposite getInstance(int rule, float alpha) { - if(alpha == 1.0f) { + if (alpha == 1.0f) { return getInstance(rule); } return new AlphaComposite(rule, alpha); @@ -275,41 +313,40 @@ public final class AlphaComposite implements Composite { /** * Gets the AlphaComposite instance with the specified rule. * - * @param rule the compositing rule. - * - * @return AlphaComposite instance. + * @param rule + * the compositing rule. + * @return the AlphaComposite instance. */ public static AlphaComposite getInstance(int rule) { - switch(rule){ - case CLEAR: - return Clear; - case SRC: - return Src; - case DST: - return Dst; - case SRC_OVER: - return SrcOver; - case DST_OVER: - return DstOver; - case SRC_IN: - return SrcIn; - case DST_IN: - return DstIn; - case SRC_OUT: - return SrcOut; - case DST_OUT: - return DstOut; - case SRC_ATOP: - return SrcAtop; - case DST_ATOP: - return DstAtop; - case XOR: - return Xor; - default: - // awt.11D=Unknown rule - throw new IllegalArgumentException(Messages.getString("awt.11D")); //$NON-NLS-1$ + switch (rule) { + case CLEAR: + return Clear; + case SRC: + return Src; + case DST: + return Dst; + case SRC_OVER: + return SrcOver; + case DST_OVER: + return DstOver; + case SRC_IN: + return SrcIn; + case DST_IN: + return DstIn; + case SRC_OUT: + return SrcOut; + case DST_OUT: + return DstOut; + case SRC_ATOP: + return SrcAtop; + case DST_ATOP: + return DstAtop; + case XOR: + return Xor; + default: + // awt.11D=Unknown rule + throw new IllegalArgumentException(Messages.getString("awt.11D")); //$NON-NLS-1$ } } } - diff --git a/awt/java/awt/BasicStroke.java b/awt/java/awt/BasicStroke.java index 955dc6b3331dc..245781570a73b 100644 --- a/awt/java/awt/BasicStroke.java +++ b/awt/java/awt/BasicStroke.java @@ -18,6 +18,7 @@ * @author Denis M. Kishenko * @version $Revision$ */ + package java.awt; import java.awt.geom.GeneralPath; @@ -27,139 +28,188 @@ import org.apache.harmony.awt.internal.nls.Messages; import org.apache.harmony.misc.HashCode; /** - * The BasicStroke class specifies a set of rendering attributes for the outlines - * of graphics primitives. The BasicStroke attributes describe the shape of the - * pen which draws the outline of a Shape and the decorations applied at the ends - * and joins of path segments of the Shape. The BasicStroke has the following - * rendering attributes: + * The BasicStroke class specifies a set of rendering attributes for the + * outlines of graphics primitives. The BasicStroke attributes describe the + * shape of the pen which draws the outline of a Shape and the decorations + * applied at the ends and joins of path segments of the Shape. The BasicStroke + * has the following rendering attributes: *

*

    - *
  • line width -the pen width which draws the outlines.
  • - *
  • end caps - indicates the decoration applied to the ends of unclosed - * subpaths and dash segments. The BasicStroke defines three different decorations: - * CAP_BUTT, CAP_ROUND, and CAP_SQUARE.
  • - *
  • line joins - indicates the decoration applied at the intersection of - * two path segments and at the intersection of the endpoints of a subpath. - * The BasicStroke defines three decorations: JOIN_BEVEL, JOIN_MITER, - * and JOIN_ROUND.
  • - *
  • miter limit - the limit to trim a line join that has a JOIN_MITER + *
  • line width -the pen width which draws the outlines.
  • + *
  • end caps - indicates the decoration applied to the ends of unclosed + * subpaths and dash segments. The BasicStroke defines three different + * decorations: CAP_BUTT, CAP_ROUND, and CAP_SQUARE.
  • + *
  • line joins - indicates the decoration applied at the intersection of two + * path segments and at the intersection of the endpoints of a subpath. The + * BasicStroke defines three decorations: JOIN_BEVEL, JOIN_MITER, and + * JOIN_ROUND.
  • + *
  • miter limit - the limit to trim a line join that has a JOIN_MITER * decoration.
  • - *
  • dash attributes - the definition of how to make a dash pattern by - * alternating between opaque and transparent sections
  • + *
  • dash attributes - the definition of how to make a dash pattern by + * alternating between opaque and transparent sections
  • *
+ *

+ * + * @since Android 1.0 */ public class BasicStroke implements Stroke { - /** - * The Constant CAP_BUTT indicates the ends of unclosed subpaths - * and dash segments have no added decoration. + /** + * The Constant CAP_BUTT indicates the ends of unclosed subpaths and dash + * segments have no added decoration. */ public static final int CAP_BUTT = 0; - - /** - * The Constant CAP_ROUND indicates the ends of unclosed subpaths - * and dash segments have a round decoration. + + /** + * The Constant CAP_ROUND indicates the ends of unclosed subpaths and dash + * segments have a round decoration. */ public static final int CAP_ROUND = 1; - - /** - * The Constant CAP_SQUARE indicates the ends of unclosed subpaths - * and dash segments have a square projection. + + /** + * The Constant CAP_SQUARE indicates the ends of unclosed subpaths and dash + * segments have a square projection. */ public static final int CAP_SQUARE = 2; - /** - * The Constant JOIN_MITER indicates that path segments are joined by + /** + * The Constant JOIN_MITER indicates that path segments are joined by * extending their outside edges until they meet. */ public static final int JOIN_MITER = 0; - - /** - * The Constant JOIN_ROUND indicates that path segments are joined by + + /** + * The Constant JOIN_ROUND indicates that path segments are joined by * rounding off the corner at a radius of half the line width. */ public static final int JOIN_ROUND = 1; - - /** - * The Constant JOIN_BEVEL indicates that path segments are joined by - * connecting the outer corners of their wide outlines with - * a straight segment. + + /** + * The Constant JOIN_BEVEL indicates that path segments are joined by + * connecting the outer corners of their wide outlines with a straight + * segment. */ public static final int JOIN_BEVEL = 2; - - /** Constants for calculating. */ - static final int MAX_LEVEL = 20; // Maximal deepness of curve subdivision - - /** The Constant CURVE_DELTA. */ - static final double CURVE_DELTA = 2.0; // Width tolerance - - /** The Constant CORNER_ANGLE. */ + + /** + * Constants for calculating. + */ + static final int MAX_LEVEL = 20; // Maximal deepness of curve subdivision + + /** + * The Constant CURVE_DELTA. + */ + static final double CURVE_DELTA = 2.0; // Width tolerance + + /** + * The Constant CORNER_ANGLE. + */ static final double CORNER_ANGLE = 4.0; // Minimum corner angle - - /** The Constant CORNER_ZERO. */ + + /** + * The Constant CORNER_ZERO. + */ static final double CORNER_ZERO = 0.01; // Zero angle - - /** The Constant CUBIC_ARC. */ + + /** + * The Constant CUBIC_ARC. + */ static final double CUBIC_ARC = 4.0 / 3.0 * (Math.sqrt(2.0) - 1); - /** Stroke width. */ + /** + * Stroke width. + */ float width; - - /** Stroke cap type. */ + + /** + * Stroke cap type. + */ int cap; - - /** Stroke join type. */ + + /** + * Stroke join type. + */ int join; - - /** Stroke miter limit. */ + + /** + * Stroke miter limit. + */ float miterLimit; - - /** Stroke dashes array. */ + + /** + * Stroke dashes array. + */ float dash[]; - - /** Stroke dash phase. */ + + /** + * Stroke dash phase. + */ float dashPhase; - /** The temporary pre-calculated values. */ + /** + * The temporary pre-calculated values. + */ double curveDelta; - - /** The corner delta. */ + + /** + * The corner delta. + */ double cornerDelta; - - /** The zero delta. */ + + /** + * The zero delta. + */ double zeroDelta; - /** The w2. */ + /** + * The w2. + */ double w2; - - /** The fmy. */ + + /** + * The fmy. + */ double fmx, fmy; - - /** The smy. */ + + /** + * The smy. + */ double scx, scy, smx, smy; - - /** The cy. */ + + /** + * The cy. + */ double mx, my, cx, cy; - /** The temporary indicators. */ + /** + * The temporary indicators. + */ boolean isMove; - - /** The is first. */ + + /** + * The is first. + */ boolean isFirst; - - /** The check move. */ + + /** + * The check move. + */ boolean checkMove; - - /** The temporary and destination work paths. */ + + /** + * The temporary and destination work paths. + */ BufferedPath dst, lp, rp, sp; - - /** Stroke dasher class. */ + + /** + * Stroke dasher class. + */ Dasher dasher; /** - * Instantiates a new BasicStroke with default width, cap, join, limit, - * dash attributes parameters. The default parameters are a solid line of - * width 1.0, CAP_SQUARE, JOIN_MITER, a miter limit of 10.0, null dash attributes, + * Instantiates a new BasicStroke with default width, cap, join, limit, dash + * attributes parameters. The default parameters are a solid line of width + * 1.0, CAP_SQUARE, JOIN_MITER, a miter limit of 10.0, null dash attributes, * and a dash phase of 0.0f. */ public BasicStroke() { @@ -167,17 +217,24 @@ public class BasicStroke implements Stroke { } /** - * Instantiates a new BasicStroke with the specified width, - * caps, joins, limit, dash attributes, dash phase parameters. + * Instantiates a new BasicStroke with the specified width, caps, joins, + * limit, dash attributes, dash phase parameters. * - * @param width the width of BasikStroke. - * @param cap the end decoration of BasikStroke. - * @param join the join segments decoration. - * @param miterLimit the limit to trim the miter join. - * @param dash the array with the dashing pattern. - * @param dashPhase the offset to start the dashing pattern. - */ - public BasicStroke(float width, int cap, int join, float miterLimit, float[] dash, float dashPhase) { + * @param width + * the width of BasikStroke. + * @param cap + * the end decoration of BasikStroke. + * @param join + * the join segments decoration. + * @param miterLimit + * the limit to trim the miter join. + * @param dash + * the array with the dashing pattern. + * @param dashPhase + * the offset to start the dashing pattern. + */ + public BasicStroke(float width, int cap, int join, float miterLimit, float[] dash, + float dashPhase) { if (width < 0.0f) { // awt.133=Negative width throw new IllegalArgumentException(Messages.getString("awt.133")); //$NON-NLS-1$ @@ -204,7 +261,7 @@ public class BasicStroke implements Stroke { throw new IllegalArgumentException(Messages.getString("awt.138")); //$NON-NLS-1$ } ZERO: { - for(int i = 0; i < dash.length; i++) { + for (int i = 0; i < dash.length; i++) { if (dash[i] < 0.0) { // awt.139=Negative dash[{0}] throw new IllegalArgumentException(Messages.getString("awt.139", i)); //$NON-NLS-1$ @@ -226,35 +283,43 @@ public class BasicStroke implements Stroke { } /** - * Instantiates a new BasicStroke with specified width, cap, join, limit - * and default dash attributes parameters. + * Instantiates a new BasicStroke with specified width, cap, join, limit and + * default dash attributes parameters. * - * @param width the width of BasikStroke. - * @param cap the end decoration of BasikStroke. - * @param join the join segments decoration. - * @param miterLimit the limit to trim the miter join. + * @param width + * the width of BasikStroke. + * @param cap + * the end decoration of BasikStroke. + * @param join + * the join segments decoration. + * @param miterLimit + * the limit to trim the miter join. */ public BasicStroke(float width, int cap, int join, float miterLimit) { this(width, cap, join, miterLimit, null, 0.0f); } /** - * Instantiates a new BasicStroke with specified width, cap, join - * and default limit and dash attributes parameters. + * Instantiates a new BasicStroke with specified width, cap, join and + * default limit and dash attributes parameters. * - * @param width the width of BasikStroke. - * @param cap the end decoration of BasikStroke. - * @param join the join segments decoration. + * @param width + * the width of BasikStroke. + * @param cap + * the end decoration of BasikStroke. + * @param join + * the join segments decoration. */ public BasicStroke(float width, int cap, int join) { this(width, cap, join, 10.0f, null, 0.0f); } /** - * Instantiates a new BasicStroke with specified width and default cap, join, - * limit, dash attributes parameters. + * Instantiates a new BasicStroke with specified width and default cap, + * join, limit, dash attributes parameters. * - * @param width the width of BasicStroke. + * @param width + * the width of BasicStroke. */ public BasicStroke(float width) { this(width, CAP_SQUARE, JOIN_MITER, 10.0f, null, 0.0f); @@ -288,7 +353,8 @@ public class BasicStroke implements Stroke { } /** - * Gets the miter limit of the BasicStroke (the limit to trim the miter join). + * Gets the miter limit of the BasicStroke (the limit to trim the miter + * join). * * @return the miter limit of the BasicStroke. */ @@ -338,10 +404,10 @@ public class BasicStroke implements Stroke { /** * Compares this BasicStroke object with the specified Object. * - * @param obj the Object to be compared. - * - * @return true, if the Object is a BasicStroke with the same data - * values as this BasicStroke; false otherwise. + * @param obj + * the Object to be compared. + * @return true, if the Object is a BasicStroke with the same data values as + * this BasicStroke; false otherwise. */ @Override public boolean equals(Object obj) { @@ -350,13 +416,9 @@ public class BasicStroke implements Stroke { } if (obj instanceof BasicStroke) { BasicStroke bs = (BasicStroke)obj; - return - bs.width == width && - bs.cap == cap && - bs.join == join && - bs.miterLimit == miterLimit && - bs.dashPhase == dashPhase && - java.util.Arrays.equals(bs.dash, dash); + return bs.width == width && bs.cap == cap && bs.join == join + && bs.miterLimit == miterLimit && bs.dashPhase == dashPhase + && java.util.Arrays.equals(bs.dash, dash); } return false; } @@ -364,9 +426,9 @@ public class BasicStroke implements Stroke { /** * Calculates allowable curve derivation. * - * @param width the width - * - * @return the curve delta + * @param width + * the width. + * @return the curve delta. */ double getCurveDelta(double width) { double a = width + CURVE_DELTA; @@ -378,9 +440,9 @@ public class BasicStroke implements Stroke { /** * Calculates the value to detect a small angle. * - * @param width the width - * - * @return the corner delta + * @param width + * the width. + * @return the corner delta. */ double getCornerDelta(double width) { return width * width * Math.sin(Math.PI * CORNER_ANGLE / 180.0); @@ -389,22 +451,21 @@ public class BasicStroke implements Stroke { /** * Calculates value to detect a zero angle. * - * @param width the width - * - * @return the zero delta + * @param width + * the width. + * @return the zero delta. */ double getZeroDelta(double width) { return width * width * Math.sin(Math.PI * CORNER_ZERO / 180.0); } /** - * Creates a Shape from the outline of the specified shape - * drawn with this BasicStroke. - * - * @param s the specified Shape to be stroked. + * Creates a Shape from the outline of the specified shape drawn with this + * BasicStroke. * + * @param s + * the specified Shape to be stroked. * @return the Shape of the stroked outline. - * * @see java.awt.Stroke#createStrokedShape(java.awt.Shape) */ public Shape createStrokedShape(Shape s) { @@ -429,7 +490,8 @@ public class BasicStroke implements Stroke { /** * Generates a shape with a solid (not dashed) outline. * - * @param p - the PathIterator of source shape + * @param p + * the PathIterator of source shape. */ void createSolidShape(PathIterator p) { double coords[] = new double[6]; @@ -439,36 +501,37 @@ public class BasicStroke implements Stroke { checkMove = true; boolean isClosed = true; - while(!p.isDone()) { - switch(p.currentSegment(coords)) { - case PathIterator.SEG_MOVETO: - if (!isClosed) { - closeSolidShape(); - } - rp.clean(); - mx = cx = coords[0]; - my = cy = coords[1]; - isMove = true; - isClosed = false; - break; - case PathIterator.SEG_LINETO: - addLine(cx, cy, cx = coords[0], cy = coords[1], true); - break; - case PathIterator.SEG_QUADTO: - addQuad(cx, cy, coords[0], coords[1], cx = coords[2], cy = coords[3]); - break; - case PathIterator.SEG_CUBICTO: - addCubic(cx, cy, coords[0], coords[1], coords[2], coords[3], cx = coords[4], cy = coords[5]); - break; - case PathIterator.SEG_CLOSE: - addLine(cx, cy, mx, my, false); - addJoin(lp, mx, my, lp.xMove, lp.yMove, true); - addJoin(rp, mx, my, rp.xMove, rp.yMove, false); - lp.closePath(); - rp.closePath(); - lp.appendReverse(rp); - isClosed = true; - break; + while (!p.isDone()) { + switch (p.currentSegment(coords)) { + case PathIterator.SEG_MOVETO: + if (!isClosed) { + closeSolidShape(); + } + rp.clean(); + mx = cx = coords[0]; + my = cy = coords[1]; + isMove = true; + isClosed = false; + break; + case PathIterator.SEG_LINETO: + addLine(cx, cy, cx = coords[0], cy = coords[1], true); + break; + case PathIterator.SEG_QUADTO: + addQuad(cx, cy, coords[0], coords[1], cx = coords[2], cy = coords[3]); + break; + case PathIterator.SEG_CUBICTO: + addCubic(cx, cy, coords[0], coords[1], coords[2], coords[3], cx = coords[4], + cy = coords[5]); + break; + case PathIterator.SEG_CLOSE: + addLine(cx, cy, mx, my, false); + addJoin(lp, mx, my, lp.xMove, lp.yMove, true); + addJoin(rp, mx, my, rp.xMove, rp.yMove, false); + lp.closePath(); + rp.closePath(); + lp.appendReverse(rp); + isClosed = true; + break; } p.next(); } @@ -492,7 +555,8 @@ public class BasicStroke implements Stroke { /** * Generates dashed stroked shape. * - * @param p - the PathIterator of source shape + * @param p + * the PathIterator of source shape. */ void createDashedShape(PathIterator p) { double coords[] = new double[6]; @@ -502,52 +566,53 @@ public class BasicStroke implements Stroke { checkMove = false; boolean isClosed = true; - while(!p.isDone()) { - switch(p.currentSegment(coords)) { - case PathIterator.SEG_MOVETO: + while (!p.isDone()) { + switch (p.currentSegment(coords)) { + case PathIterator.SEG_MOVETO: - if (!isClosed) { - closeDashedShape(); - } + if (!isClosed) { + closeDashedShape(); + } - dasher = new Dasher(dash, dashPhase); - lp.clean(); - rp.clean(); - sp = null; - isFirst = true; - isMove = true; - isClosed = false; - mx = cx = coords[0]; - my = cy = coords[1]; - break; - case PathIterator.SEG_LINETO: - addDashLine(cx, cy, cx = coords[0], cy = coords[1]); - break; - case PathIterator.SEG_QUADTO: - addDashQuad(cx, cy, coords[0], coords[1], cx = coords[2], cy = coords[3]); - break; - case PathIterator.SEG_CUBICTO: - addDashCubic(cx, cy, coords[0], coords[1], coords[2], coords[3], cx = coords[4], cy = coords[5]); - break; - case PathIterator.SEG_CLOSE: - addDashLine(cx, cy, cx = mx, cy = my); - - if (dasher.isConnected()) { - // Connect current and head segments - addJoin(lp, fmx, fmy, sp.xMove, sp.yMove, true); - lp.join(sp); - addJoin(lp, fmx, fmy, rp.xLast, rp.yLast, true); - lp.combine(rp); - addCap(lp, smx, smy, lp.xMove, lp.yMove); - lp.closePath(); - dst.append(lp); + dasher = new Dasher(dash, dashPhase); + lp.clean(); + rp.clean(); sp = null; - } else { - closeDashedShape(); - } + isFirst = true; + isMove = true; + isClosed = false; + mx = cx = coords[0]; + my = cy = coords[1]; + break; + case PathIterator.SEG_LINETO: + addDashLine(cx, cy, cx = coords[0], cy = coords[1]); + break; + case PathIterator.SEG_QUADTO: + addDashQuad(cx, cy, coords[0], coords[1], cx = coords[2], cy = coords[3]); + break; + case PathIterator.SEG_CUBICTO: + addDashCubic(cx, cy, coords[0], coords[1], coords[2], coords[3], + cx = coords[4], cy = coords[5]); + break; + case PathIterator.SEG_CLOSE: + addDashLine(cx, cy, cx = mx, cy = my); - isClosed = true; - break; + if (dasher.isConnected()) { + // Connect current and head segments + addJoin(lp, fmx, fmy, sp.xMove, sp.yMove, true); + lp.join(sp); + addJoin(lp, fmx, fmy, rp.xLast, rp.yLast, true); + lp.combine(rp); + addCap(lp, smx, smy, lp.xMove, lp.yMove); + lp.closePath(); + dst.append(lp); + sp = null; + } else { + closeDashedShape(); + } + + isClosed = true; + break; } p.next(); } @@ -583,11 +648,16 @@ public class BasicStroke implements Stroke { /** * Adds cap to the work path. * - * @param p - the BufferedPath object of work path - * @param x0 - the x coordinate of the source path - * @param y0 - the y coordinate on the source path - * @param x2 - the x coordinate of the next point on the work path - * @param y2 - the y coordinate of the next point on the work path + * @param p + * the BufferedPath object of work path. + * @param x0 + * the x coordinate of the source path. + * @param y0 + * the y coordinate on the source path. + * @param x2 + * the x coordinate of the next point on the work path. + * @param y2 + * the y coordinate of the next point on the work path. */ void addCap(BufferedPath p, double x0, double y0, double x2, double y2) { double x1 = p.xLast; @@ -597,42 +667,49 @@ public class BasicStroke implements Stroke { double x20 = x2 - x0; double y20 = y2 - y0; - switch(cap) { - case CAP_BUTT: - p.lineTo(x2, y2); - break; - case CAP_ROUND: - double mx = x10 * CUBIC_ARC; - double my = y10 * CUBIC_ARC; - - double x3 = x0 + y10; - double y3 = y0 - x10; - - x10 *= CUBIC_ARC; - y10 *= CUBIC_ARC; - x20 *= CUBIC_ARC; - y20 *= CUBIC_ARC; - - p.cubicTo(x1 + y10, y1 - x10, x3 + mx, y3 + my, x3, y3); - p.cubicTo(x3 - mx, y3 - my, x2 - y20, y2 + x20, x2, y2); - break; - case CAP_SQUARE: - p.lineTo(x1 + y10, y1 - x10); - p.lineTo(x2 - y20, y2 + x20); - p.lineTo(x2, y2); - break; + switch (cap) { + case CAP_BUTT: + p.lineTo(x2, y2); + break; + case CAP_ROUND: + double mx = x10 * CUBIC_ARC; + double my = y10 * CUBIC_ARC; + + double x3 = x0 + y10; + double y3 = y0 - x10; + + x10 *= CUBIC_ARC; + y10 *= CUBIC_ARC; + x20 *= CUBIC_ARC; + y20 *= CUBIC_ARC; + + p.cubicTo(x1 + y10, y1 - x10, x3 + mx, y3 + my, x3, y3); + p.cubicTo(x3 - mx, y3 - my, x2 - y20, y2 + x20, x2, y2); + break; + case CAP_SQUARE: + p.lineTo(x1 + y10, y1 - x10); + p.lineTo(x2 - y20, y2 + x20); + p.lineTo(x2, y2); + break; } } /** * Adds bevel and miter join to the work path. * - * @param p - the BufferedPath object of work path - * @param x0 - the x coordinate of the source path - * @param y0 - the y coordinate on the source path - * @param x2 - the x coordinate of the next point on the work path - * @param y2 - the y coordinate of the next point on the work path - * @param isLeft - the orientation of work path, true if work path lies to the left from source path, false otherwise + * @param p + * the BufferedPath object of work path. + * @param x0 + * the x coordinate of the source path. + * @param y0 + * the y coordinate on the source path. + * @param x2 + * the x coordinate of the next point on the work path. + * @param y2 + * the y coordinate of the next point on the work path. + * @param isLeft + * the orientation of work path, true if work path lies to the + * left from source path, false otherwise. */ void addJoin(BufferedPath p, double x0, double y0, double x2, double y2, boolean isLeft) { double x1 = p.xLast; @@ -667,26 +744,26 @@ public class BasicStroke implements Stroke { p.lineTo(x0, y0); p.lineTo(x2, y2); } else { - switch(join) { - case JOIN_BEVEL: - p.lineTo(x2, y2); - break; - case JOIN_MITER: - double s1 = x1 * x10 + y1 * y10; - double s2 = x2 * x20 + y2 * y20; - double x3 = (s1 * y20 - s2 * y10) / sin0; - double y3 = (s2 * x10 - s1 * x20) / sin0; - double x30 = x3 - x0; - double y30 = y3 - y0; - double miterLength = Math.sqrt(x30 * x30 + y30 * y30); - if (miterLength < miterLimit * w2) { - p.lineTo(x3, y3); - } - p.lineTo(x2, y2); - break; - case JOIN_ROUND: - addRoundJoin(p, x0, y0, x2, y2, isLeft); - break; + switch (join) { + case JOIN_BEVEL: + p.lineTo(x2, y2); + break; + case JOIN_MITER: + double s1 = x1 * x10 + y1 * y10; + double s2 = x2 * x20 + y2 * y20; + double x3 = (s1 * y20 - s2 * y10) / sin0; + double y3 = (s2 * x10 - s1 * x20) / sin0; + double x30 = x3 - x0; + double y30 = y3 - y0; + double miterLength = Math.sqrt(x30 * x30 + y30 * y30); + if (miterLength < miterLimit * w2) { + p.lineTo(x3, y3); + } + p.lineTo(x2, y2); + break; + case JOIN_ROUND: + addRoundJoin(p, x0, y0, x2, y2, isLeft); + break; } } } @@ -694,12 +771,19 @@ public class BasicStroke implements Stroke { /** * Adds round join to the work path. * - * @param p - the BufferedPath object of work path - * @param x0 - the x coordinate of the source path - * @param y0 - the y coordinate on the source path - * @param x2 - the x coordinate of the next point on the work path - * @param y2 - the y coordinate of the next point on the work path - * @param isLeft - the orientation of work path, true if work path lies to the left from source path, false otherwise + * @param p + * the BufferedPath object of work path. + * @param x0 + * the x coordinate of the source path. + * @param y0 + * the y coordinate on the source path. + * @param x2 + * the x coordinate of the next point on the work path. + * @param y2 + * the y coordinate of the next point on the work path. + * @param isLeft + * the orientation of work path, true if work path lies to the + * left from source path, false otherwise. */ void addRoundJoin(BufferedPath p, double x0, double y0, double x2, double y2, boolean isLeft) { double x1 = p.xLast; @@ -763,11 +847,16 @@ public class BasicStroke implements Stroke { /** * Adds solid line segment to the work path. * - * @param x1 - the x coordinate of the start line point - * @param y1 - the y coordinate of the start line point - * @param x2 - the x coordinate of the end line point - * @param y2 - the y coordinate of the end line point - * @param zero - if true it's allowable to add zero length line segment + * @param x1 + * the x coordinate of the start line point. + * @param y1 + * the y coordinate of the start line point. + * @param x2 + * the x coordinate of the end line point. + * @param y2 + * the y coordinate of the end line point. + * @param zero + * if true it's allowable to add zero length line segment. */ void addLine(double x1, double y1, double x2, double y2, boolean zero) { double dx = x2 - x1; @@ -808,12 +897,18 @@ public class BasicStroke implements Stroke { /** * Adds solid quad segment to the work path. * - * @param x1 - the x coordinate of the first control point - * @param y1 - the y coordinate of the first control point - * @param x2 - the x coordinate of the second control point - * @param y2 - the y coordinate of the second control point - * @param x3 - the x coordinate of the third control point - * @param y3 - the y coordinate of the third control point + * @param x1 + * the x coordinate of the first control point. + * @param y1 + * the y coordinate of the first control point. + * @param x2 + * the x coordinate of the second control point. + * @param y2 + * the y coordinate of the second control point. + * @param x3 + * the x coordinate of the third control point. + * @param y3 + * the y coordinate of the third control point. */ void addQuad(double x1, double y1, double x2, double y2, double x3, double y3) { double x21 = x2 - x1; @@ -841,11 +936,11 @@ public class BasicStroke implements Stroke { double w; w = w2 / l21; - double mx1 = - y21 * w; - double my1 = x21 * w; + double mx1 = -y21 * w; + double my1 = x21 * w; w = w2 / l23; - double mx3 = y23 * w; - double my3 = - x23 * w; + double mx3 = y23 * w; + double my3 = -x23 * w; double lx1 = x1 + mx1; double ly1 = y1 + my1; @@ -903,15 +998,23 @@ public class BasicStroke implements Stroke { } /** - * Subdivides solid quad curve to make outline for source quad segment and adds it to work path. + * Subdivides solid quad curve to make outline for source quad segment and + * adds it to work path. * - * @param x1 - the x coordinate of the first control point - * @param y1 - the y coordinate of the first control point - * @param x2 - the x coordinate of the second control point - * @param y2 - the y coordinate of the second control point - * @param x3 - the x coordinate of the third control point - * @param y3 - the y coordinate of the third control point - * @param level - the maximum level of subdivision deepness + * @param x1 + * the x coordinate of the first control point. + * @param y1 + * the y coordinate of the first control point. + * @param x2 + * the x coordinate of the second control point. + * @param y2 + * the y coordinate of the second control point. + * @param x3 + * the x coordinate of the third control point. + * @param y3 + * the y coordinate of the third control point. + * @param level + * the maximum level of subdivision deepness. */ void addSubQuad(double x1, double y1, double x2, double y2, double x3, double y3, int level) { double x21 = x2 - x1; @@ -939,8 +1042,8 @@ public class BasicStroke implements Stroke { double mx2 = (x21 * l23 + x23 * l21) * w; double my2 = (y21 * l23 + y23 * l21) * w; w = w2 / l23; - double mx3 = y23 * w; - double my3 = - x23 * w; + double mx3 = y23 * w; + double my3 = -x23 * w; lp.quadTo(x2 + mx2, y2 + my2, x3 + mx3, y3 + my3); rp.quadTo(x2 - mx2, y2 - my2, x3 - mx3, y3 - my3); } @@ -949,16 +1052,25 @@ public class BasicStroke implements Stroke { /** * Adds solid cubic segment to the work path. * - * @param x1 - the x coordinate of the first control point - * @param y1 - the y coordinate of the first control point - * @param x2 - the x coordinate of the second control point - * @param y2 - the y coordinate of the second control point - * @param x3 - the x coordinate of the third control point - * @param y3 - the y coordinate of the third control point - * @param x4 - the x coordinate of the fours control point - * @param y4 - the y coordinate of the fours control point - */ - void addCubic(double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4) { + * @param x1 + * the x coordinate of the first control point. + * @param y1 + * the y coordinate of the first control point. + * @param x2 + * the x coordinate of the second control point. + * @param y2 + * the y coordinate of the second control point. + * @param x3 + * the x coordinate of the third control point. + * @param y3 + * the y coordinate of the third control point. + * @param x4 + * the x coordinate of the fours control point. + * @param y4 + * the y coordinate of the fours control point. + */ + void addCubic(double x1, double y1, double x2, double y2, double x3, double y3, double x4, + double y4) { double x12 = x1 - x2; double y12 = y1 - y2; double x23 = x2 - x3; @@ -997,35 +1109,32 @@ public class BasicStroke implements Stroke { if (l12 == 0.0) { w = w2 / l23; - mx1 = y23 * w; - my1 = - x23 * w; + mx1 = y23 * w; + my1 = -x23 * w; w = w2 / l34; - mx4 = y34 * w; - my4 = - x34 * w; - onLine = - x23 * y34 + y23 * x34 == 0.0; // sin3 - } else - if (l34 == 0.0) { + mx4 = y34 * w; + my4 = -x34 * w; + onLine = -x23 * y34 + y23 * x34 == 0.0; // sin3 + } else if (l34 == 0.0) { w = w2 / l12; - mx1 = y12 * w; - my1 = - x12 * w; + mx1 = y12 * w; + my1 = -x12 * w; w = w2 / l23; - mx4 = y23 * w; - my4 = - x23 * w; - onLine = - x12 * y23 + y12 * x23 == 0.0; // sin2 + mx4 = y23 * w; + my4 = -x23 * w; + onLine = -x12 * y23 + y12 * x23 == 0.0; // sin2 } else { w = w2 / l12; - mx1 = y12 * w; - my1 = - x12 * w; + mx1 = y12 * w; + my1 = -x12 * w; w = w2 / l34; - mx4 = y34 * w; - my4 = - x34 * w; + mx4 = y34 * w; + my4 = -x34 * w; if (l23 == 0.0) { - onLine = - x12 * y34 + y12 * x34 == 0.0; + onLine = -x12 * y34 + y12 * x34 == 0.0; } else { - onLine = - - x12 * y34 + y12 * x34 == 0.0 && - - x12 * y23 + y12 * x23 == 0.0 && // sin2 - - x23 * y34 + y23 * x34 == 0.0; // sin3 + onLine = -x12 * y34 + y12 * x34 == 0.0 && -x12 * y23 + y12 * x23 == 0.0 && // sin2 + -x23 * y34 + y23 * x34 == 0.0; // sin3 } } @@ -1063,8 +1172,7 @@ public class BasicStroke implements Stroke { if (0.0 < t && t < 1.0) { roots[rc++] = t; } - } else - if (d > 0.0) { + } else if (d > 0.0) { d = Math.sqrt(d); double z = l12 + l34 - l23 - l23; double t; @@ -1087,15 +1195,15 @@ public class BasicStroke implements Stroke { } roots[rc++] = 1.0; - double ax = - x34 - x12 + x23 + x23; - double ay = - y34 - y12 + y23 + y23; - double bx = 3.0 * (- x23 + x12); - double by = 3.0 * (- y23 + y12); - double cx = 3.0 * (- x12); - double cy = 3.0 * (- y12); + double ax = -x34 - x12 + x23 + x23; + double ay = -y34 - y12 + y23 + y23; + double bx = 3.0 * (-x23 + x12); + double by = 3.0 * (-y23 + y12); + double cx = 3.0 * (-x12); + double cy = 3.0 * (-y12); double xPrev = x1; double yPrev = y1; - for(int i = 0; i < rc; i++) { + for (int i = 0; i < rc; i++) { double t = roots[i]; double px = t * (t * (t * ax + bx) + cx) + x1; double py = t * (t * (t * ay + by) + cy) + y1; @@ -1109,8 +1217,8 @@ public class BasicStroke implements Stroke { } xPrev = px; yPrev = py; - mx1 = - mx1; - my1 = - my1; + mx1 = -mx1; + my1 = -my1; } } else { lp.cubicTo(x2 + mx1, y2 + my1, x3 + mx4, y3 + my4, x4 + mx4, y4 + my4); @@ -1122,19 +1230,30 @@ public class BasicStroke implements Stroke { } /** - * Subdivides solid cubic curve to make outline for source quad segment and adds it to work path. + * Subdivides solid cubic curve to make outline for source quad segment and + * adds it to work path. * - * @param x1 - the x coordinate of the first control point - * @param y1 - the y coordinate of the first control point - * @param x2 - the x coordinate of the second control point - * @param y2 - the y coordinate of the second control point - * @param x3 - the x coordinate of the third control point - * @param y3 - the y coordinate of the third control point - * @param x4 - the x coordinate of the fours control point - * @param y4 - the y coordinate of the fours control point - * @param level - the maximum level of subdivision deepness - */ - void addSubCubic(double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4, int level) { + * @param x1 + * the x coordinate of the first control point. + * @param y1 + * the y coordinate of the first control point. + * @param x2 + * the x coordinate of the second control point. + * @param y2 + * the y coordinate of the second control point. + * @param x3 + * the x coordinate of the third control point. + * @param y3 + * the y coordinate of the third control point. + * @param x4 + * the x coordinate of the fours control point. + * @param y4 + * the y coordinate of the fours control point. + * @param level + * the maximum level of subdivision deepness. + */ + void addSubCubic(double x1, double y1, double x2, double y2, double x3, double y3, double x4, + double y4, int level) { double x12 = x1 - x2; double y12 = y1 - y2; double x23 = x2 - x3; @@ -1142,19 +1261,18 @@ public class BasicStroke implements Stroke { double x34 = x3 - x4; double y34 = y3 - y4; - double cos2 = - x12 * x23 - y12 * y23; - double cos3 = - x23 * x34 - y23 * y34; - double sin2 = - x12 * y23 + y12 * x23; - double sin3 = - x23 * y34 + y23 * x34; - double sin0 = - x12 * y34 + y12 * x34; - double cos0 = - x12 * x34 - y12 * y34; - - if (level < MAX_LEVEL && (sin2 != 0.0 || sin3 != 0.0 || sin0 != 0.0) && - (cos2 >= 0.0 || cos3 >= 0.0 || cos0 >= 0.0 || - (Math.abs(sin2 / cos2) > curveDelta) || - (Math.abs(sin3 / cos3) > curveDelta) || - (Math.abs(sin0 / cos0) > curveDelta))) - { + double cos2 = -x12 * x23 - y12 * y23; + double cos3 = -x23 * x34 - y23 * y34; + double sin2 = -x12 * y23 + y12 * x23; + double sin3 = -x23 * y34 + y23 * x34; + double sin0 = -x12 * y34 + y12 * x34; + double cos0 = -x12 * x34 - y12 * y34; + + if (level < MAX_LEVEL + && (sin2 != 0.0 || sin3 != 0.0 || sin0 != 0.0) + && (cos2 >= 0.0 || cos3 >= 0.0 || cos0 >= 0.0 + || (Math.abs(sin2 / cos2) > curveDelta) + || (Math.abs(sin3 / cos3) > curveDelta) || (Math.abs(sin0 / cos0) > curveDelta))) { double cx = (x2 + x3) / 2.0; double cy = (y2 + y3) / 2.0; double lx2 = (x2 + x1) / 2.0; @@ -1177,27 +1295,26 @@ public class BasicStroke implements Stroke { if (l12 == 0.0) { w = w2 / l23; - mx1 = y23 * w; - my1 = - x23 * w; + mx1 = y23 * w; + my1 = -x23 * w; w = w2 / l34; - mx4 = y34 * w; - my4 = - x34 * w; - } else - if (l34 == 0.0) { + mx4 = y34 * w; + my4 = -x34 * w; + } else if (l34 == 0.0) { w = w2 / l12; - mx1 = y12 * w; - my1 = - x12 * w; + mx1 = y12 * w; + my1 = -x12 * w; w = w2 / l23; - mx4 = y23 * w; - my4 = - x23 * w; + mx4 = y23 * w; + my4 = -x23 * w; } else { // Common case w = w2 / l12; - mx1 = y12 * w; - my1 = - x12 * w; + mx1 = y12 * w; + my1 = -x12 * w; w = w2 / l34; - mx4 = y34 * w; - my4 = - x34 * w; + mx4 = y34 * w; + my4 = -x34 * w; } if (sin2 == 0.0) { @@ -1225,10 +1342,14 @@ public class BasicStroke implements Stroke { /** * Adds dashed line segment to the work path. * - * @param x1 - the x coordinate of the start line point - * @param y1 - the y coordinate of the start line point - * @param x2 - the x coordinate of the end line point - * @param y2 - the y coordinate of the end line point + * @param x1 + * the x coordinate of the start line point. + * @param y1 + * the y coordinate of the start line point. + * @param x2 + * the x coordinate of the end line point. + * @param y2 + * the y coordinate of the end line point. */ void addDashLine(double x1, double y1, double x2, double y2) { double x21 = x2 - x1; @@ -1243,12 +1364,12 @@ public class BasicStroke implements Stroke { double px1, py1; px1 = py1 = 0.0; double w = w2 / l21; - double mx = - y21 * w; - double my = x21 * w; + double mx = -y21 * w; + double my = x21 * w; dasher.init(new DashIterator.Line(l21)); - while(!dasher.eof()) { + while (!dasher.eof()) { double t = dasher.getValue(); scx = x1 + t * x21; scy = y1 + t * y21; @@ -1271,28 +1392,27 @@ public class BasicStroke implements Stroke { addJoin(lp, x1, y1, lx1, ly1, true); addJoin(rp, x1, y1, rx1, ry1, false); } - } else - if (dasher.isContinue()) { - double px2 = scx; - double py2 = scy; - lp.lineTo(px2 + mx, py2 + my); - rp.lineTo(px2 - mx, py2 - my); - if (dasher.close) { - addCap(lp, px2, py2, rp.xLast, rp.yLast); - lp.combine(rp); - if (isFirst) { - isFirst = false; - fmx = smx; - fmy = smy; - sp = lp; - lp = new BufferedPath(); - } else { - addCap(lp, smx, smy, lp.xMove, lp.yMove); - lp.closePath(); - } - isMove = true; + } else if (dasher.isContinue()) { + double px2 = scx; + double py2 = scy; + lp.lineTo(px2 + mx, py2 + my); + rp.lineTo(px2 - mx, py2 - my); + if (dasher.close) { + addCap(lp, px2, py2, rp.xLast, rp.yLast); + lp.combine(rp); + if (isFirst) { + isFirst = false; + fmx = smx; + fmy = smy; + sp = lp; + lp = new BufferedPath(); + } else { + addCap(lp, smx, smy, lp.xMove, lp.yMove); + lp.closePath(); } + isMove = true; } + } dasher.next(); } @@ -1301,12 +1421,18 @@ public class BasicStroke implements Stroke { /** * Adds dashed quad segment to the work path. * - * @param x1 - the x coordinate of the first control point - * @param y1 - the y coordinate of the first control point - * @param x2 - the x coordinate of the second control point - * @param y2 - the y coordinate of the second control point - * @param x3 - the x coordinate of the third control point - * @param y3 - the y coordinate of the third control point + * @param x1 + * the x coordinate of the first control point. + * @param y1 + * the y coordinate of the first control point. + * @param x2 + * the x coordinate of the second control point. + * @param y2 + * the y coordinate of the second control point. + * @param x3 + * the x coordinate of the third control point. + * @param y3 + * the y coordinate of the third control point. */ void addDashQuad(double x1, double y1, double x2, double y2, double x3, double y3) { @@ -1345,7 +1471,7 @@ public class BasicStroke implements Stroke { dasher.init(new DashIterator.Quad(x1, y1, x2, y2, x3, y3)); - while(!dasher.eof()) { + while (!dasher.eof()) { double t = dasher.getValue(); double dx = t * ax + bx; double dy = t * ay + by; @@ -1357,8 +1483,8 @@ public class BasicStroke implements Stroke { dx1 = dx; dy1 = dy; double w = w2 / Math.sqrt(dx1 * dx1 + dy1 * dy1); - double mx1 = - dy1 * w; - double my1 = dx1 * w; + double mx1 = -dy1 * w; + double my1 = dx1 * w; double lx1 = px1 + mx1; double ly1 = py1 + my1; double rx1 = px1 - mx1; @@ -1374,33 +1500,32 @@ public class BasicStroke implements Stroke { addJoin(lp, x1, y1, lx1, ly1, true); addJoin(rp, x1, y1, rx1, ry1, false); } - } else - if (dasher.isContinue()) { - double px3 = scx; - double py3 = scy; - double sx = x2 - x23 * prev; - double sy = y2 - y23 * prev; - double t2 = (t - prev) / (1 - prev); - double px2 = px1 + (sx - px1) * t2; - double py2 = py1 + (sy - py1) * t2; - - addQuad(px1, py1, px2, py2, px3, py3); - if (dasher.isClosed()) { - addCap(lp, px3, py3, rp.xLast, rp.yLast); - lp.combine(rp); - if (isFirst) { - isFirst = false; - fmx = smx; - fmy = smy; - sp = lp; - lp = new BufferedPath(); - } else { - addCap(lp, smx, smy, lp.xMove, lp.yMove); - lp.closePath(); - } - isMove = true; + } else if (dasher.isContinue()) { + double px3 = scx; + double py3 = scy; + double sx = x2 - x23 * prev; + double sy = y2 - y23 * prev; + double t2 = (t - prev) / (1 - prev); + double px2 = px1 + (sx - px1) * t2; + double py2 = py1 + (sy - py1) * t2; + + addQuad(px1, py1, px2, py2, px3, py3); + if (dasher.isClosed()) { + addCap(lp, px3, py3, rp.xLast, rp.yLast); + lp.combine(rp); + if (isFirst) { + isFirst = false; + fmx = smx; + fmy = smy; + sp = lp; + lp = new BufferedPath(); + } else { + addCap(lp, smx, smy, lp.xMove, lp.yMove); + lp.closePath(); } + isMove = true; } + } prev = t; dasher.next(); @@ -1410,16 +1535,25 @@ public class BasicStroke implements Stroke { /** * Adds dashed cubic segment to the work path. * - * @param x1 - the x coordinate of the first control point - * @param y1 - the y coordinate of the first control point - * @param x2 - the x coordinate of the second control point - * @param y2 - the y coordinate of the second control point - * @param x3 - the x coordinate of the third control point - * @param y3 - the y coordinate of the third control point - * @param x4 - the x coordinate of the fours control point - * @param y4 - the y coordinate of the fours control point + * @param x1 + * the x coordinate of the first control point. + * @param y1 + * the y coordinate of the first control point. + * @param x2 + * the x coordinate of the second control point. + * @param y2 + * the y coordinate of the second control point. + * @param x3 + * the x coordinate of the third control point. + * @param y3 + * the y coordinate of the third control point. + * @param x4 + * the x coordinate of the fours control point. + * @param y4 + * the y coordinate of the fours control point. */ - void addDashCubic(double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4) { + void addDashCubic(double x1, double y1, double x2, double y2, double x3, double y3, double x4, + double y4) { double x12 = x1 - x2; double y12 = y1 - y2; @@ -1469,7 +1603,7 @@ public class BasicStroke implements Stroke { dasher.init(new DashIterator.Cubic(x1, y1, x2, y2, x3, y3, x4, y4)); - while(!dasher.eof()) { + while (!dasher.eof()) { double t = dasher.getValue(); scx = t * (t * (t * ax + bx) + cx) + dx; @@ -1480,8 +1614,8 @@ public class BasicStroke implements Stroke { double dx1 = t * (t * (ax + ax + ax) + bx + bx) + cx; double dy1 = t * (t * (ay + ay + ay) + by + by) + cy; double w = w2 / Math.sqrt(dx1 * dx1 + dy1 * dy1); - double mx1 = - dy1 * w; - double my1 = dx1 * w; + double mx1 = -dy1 * w; + double my1 = dx1 * w; double lx1 = px1 + mx1; double ly1 = py1 + my1; double rx1 = px1 - mx1; @@ -1497,42 +1631,41 @@ public class BasicStroke implements Stroke { addJoin(lp, x1, y1, lx1, ly1, true); addJoin(rp, x1, y1, rx1, ry1, false); } - } else - if (dasher.isContinue()) { - double sx1 = x2 - x23 * prev; - double sy1 = y2 - y23 * prev; - double sx2 = x3 - x34 * prev; - double sy2 = y3 - y34 * prev; - double sx3 = sx1 + (sx2 - sx1) * prev; - double sy3 = sy1 + (sy2 - sy1) * prev; - double t2 = (t - prev) / (1 - prev); - double sx4 = sx3 + (sx2 - sx3) * t2; - double sy4 = sy3 + (sy2 - sy3) * t2; - - double px4 = scx; - double py4 = scy; - double px2 = px1 + (sx3 - px1) * t2; - double py2 = py1 + (sy3 - py1) * t2; - double px3 = px2 + (sx4 - px2) * t2; - double py3 = py2 + (sy4 - py2) * t2; - - addCubic(px1, py1, px2, py2, px3, py3, px4, py4); - if (dasher.isClosed()) { - addCap(lp, px4, py4, rp.xLast, rp.yLast); - lp.combine(rp); - if (isFirst) { - isFirst = false; - fmx = smx; - fmy = smy; - sp = lp; - lp = new BufferedPath(); - } else { - addCap(lp, smx, smy, lp.xMove, lp.yMove); - lp.closePath(); - } - isMove = true; + } else if (dasher.isContinue()) { + double sx1 = x2 - x23 * prev; + double sy1 = y2 - y23 * prev; + double sx2 = x3 - x34 * prev; + double sy2 = y3 - y34 * prev; + double sx3 = sx1 + (sx2 - sx1) * prev; + double sy3 = sy1 + (sy2 - sy1) * prev; + double t2 = (t - prev) / (1 - prev); + double sx4 = sx3 + (sx2 - sx3) * t2; + double sy4 = sy3 + (sy2 - sy3) * t2; + + double px4 = scx; + double py4 = scy; + double px2 = px1 + (sx3 - px1) * t2; + double py2 = py1 + (sy3 - py1) * t2; + double px3 = px2 + (sx4 - px2) * t2; + double py3 = py2 + (sy4 - py2) * t2; + + addCubic(px1, py1, px2, py2, px3, py3, px4, py4); + if (dasher.isClosed()) { + addCap(lp, px4, py4, rp.xLast, rp.yLast); + lp.combine(rp); + if (isFirst) { + isFirst = false; + fmx = smx; + fmy = smy; + sp = lp; + lp = new BufferedPath(); + } else { + addCap(lp, smx, smy, lp.xMove, lp.yMove); + lp.closePath(); } + isMove = true; } + } prev = t; dasher.next(); @@ -1543,30 +1676,44 @@ public class BasicStroke implements Stroke { * Dasher class provides dashing for particular dash style. */ class Dasher { - - /** The pos. */ + + /** + * The pos. + */ double pos; - - /** The first. */ + + /** + * The first. + */ boolean close, visible, first; - - /** The dash. */ + + /** + * The dash. + */ float dash[]; - - /** The phase. */ + + /** + * The phase. + */ float phase; - - /** The index. */ + + /** + * The index. + */ int index; - - /** The iter. */ + + /** + * The iter. + */ DashIterator iter; - + /** * Instantiates a new dasher. * - * @param dash the dash - * @param phase the phase + * @param dash + * the dash. + * @param phase + * the phase. */ Dasher(float dash[], float phase) { this.dash = dash; @@ -1578,52 +1725,53 @@ public class BasicStroke implements Stroke { visible = !visible; pos -= dash[index]; index = (index + 1) % dash.length; - } + } pos = -pos; first = visible; } - + /** * Inits the. * - * @param iter the iter + * @param iter + * the iter. */ void init(DashIterator iter) { this.iter = iter; close = true; } - + /** * Checks if is open. * - * @return true, if is open + * @return true, if is open. */ boolean isOpen() { return visible && pos < iter.length; } - + /** * Checks if is continue. * - * @return true, if is continue + * @return true, if is continue. */ boolean isContinue() { return !visible && pos > 0; } - + /** * Checks if is closed. * - * @return true, if is closed + * @return true, if is closed. */ boolean isClosed() { return close; } - + /** * Checks if is connected. * - * @return true, if is connected + * @return true, if is connected. */ boolean isConnected() { return first && !close; @@ -1632,7 +1780,7 @@ public class BasicStroke implements Stroke { /** * Eof. * - * @return true, if successful + * @return true, if successful. */ boolean eof() { if (!close) { @@ -1648,7 +1796,7 @@ public class BasicStroke implements Stroke { } return false; } - + /** * Next. */ @@ -1663,17 +1811,17 @@ public class BasicStroke implements Stroke { } visible = !visible; } - + /** * Gets the value. * - * @return the value + * @return the value. */ double getValue() { double t = iter.getNext(pos); return t < 0 ? 0 : (t > 1 ? 1 : t); } - + } /** @@ -1681,7 +1829,9 @@ public class BasicStroke implements Stroke { */ static abstract class DashIterator { - /** The Constant FLATNESS. */ + /** + * The Constant FLATNESS. + */ static final double FLATNESS = 1.0; /** @@ -1692,7 +1842,8 @@ public class BasicStroke implements Stroke { /** * Instantiates a new line. * - * @param len the len + * @param len + * the len. */ Line(double len) { length = len; @@ -1710,36 +1861,56 @@ public class BasicStroke implements Stroke { */ static class Quad extends DashIterator { - /** The val size. */ + /** + * The val size. + */ int valSize; - - /** The val pos. */ + + /** + * The val pos. + */ int valPos; - - /** The cur len. */ + + /** + * The cur len. + */ double curLen; - - /** The prev len. */ + + /** + * The prev len. + */ double prevLen; - - /** The last len. */ + + /** + * The last len. + */ double lastLen; - - /** The values. */ + + /** + * The values. + */ double[] values; - - /** The step. */ + + /** + * The step. + */ double step; /** * Instantiates a new quad. * - * @param x1 the x1 - * @param y1 the y1 - * @param x2 the x2 - * @param y2 the y2 - * @param x3 the x3 - * @param y3 the y3 + * @param x1 + * the x1. + * @param y1 + * the y1. + * @param x2 + * the x2. + * @param y2 + * the y2. + * @param x3 + * the x3. + * @param y3 + * the y3. */ Quad(double x1, double y1, double x2, double y2, double x3, double y3) { @@ -1766,7 +1937,7 @@ public class BasicStroke implements Stroke { double pvx = vx; double pvy = vy; length = 0.0; - for(int i = 0; i < n; i++) { + for (int i = 0; i < n; i++) { vx += dx1; vy += dy1; dx1 += dx2; @@ -1804,40 +1975,63 @@ public class BasicStroke implements Stroke { */ static class Cubic extends DashIterator { - /** The val size. */ + /** + * The val size. + */ int valSize; - - /** The val pos. */ + + /** + * The val pos. + */ int valPos; - - /** The cur len. */ + + /** + * The cur len. + */ double curLen; - - /** The prev len. */ + + /** + * The prev len. + */ double prevLen; - - /** The last len. */ + + /** + * The last len. + */ double lastLen; - - /** The values. */ + + /** + * The values. + */ double[] values; - - /** The step. */ + + /** + * The step. + */ double step; /** * Instantiates a new cubic. * - * @param x1 the x1 - * @param y1 the y1 - * @param x2 the x2 - * @param y2 the y2 - * @param x3 the x3 - * @param y3 the y3 - * @param x4 the x4 - * @param y4 the y4 + * @param x1 + * the x1. + * @param y1 + * the y1. + * @param x2 + * the x2. + * @param y2 + * the y2. + * @param x3 + * the x3. + * @param y3 + * the y3. + * @param x4 + * the x4. + * @param y4 + * the y4. */ - Cubic(double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4) { + Cubic(double x1, double y1, double x2, double y2, double x3, double y3, double x4, + double y4) { double nx1 = x1 + x3 - x2 - x2; double ny1 = y1 + y3 - y2 - y2; @@ -1869,7 +2063,7 @@ public class BasicStroke implements Stroke { double pvx = vx; double pvy = vy; length = 0.0; - for(int i = 0; i < n; i++) { + for (int i = 0; i < n; i++) { vx += dx1; vy += dy1; dx1 += dx2; @@ -1904,15 +2098,17 @@ public class BasicStroke implements Stroke { } - /** The length. */ + /** + * The length. + */ double length; /** * Gets the next. * - * @param dashPos the dash pos - * - * @return the next + * @param dashPos + * the dash pos. + * @return the next. */ abstract double getNext(double dashPos); @@ -1923,39 +2119,60 @@ public class BasicStroke implements Stroke { */ static class BufferedPath { - /** The Constant bufCapacity. */ + /** + * The Constant bufCapacity. + */ private static final int bufCapacity = 10; - /** The point shift. */ + /** + * The point shift. + */ static int pointShift[] = { - 2, // MOVETO - 2, // LINETO - 4, // QUADTO - 6, // CUBICTO - 0}; // CLOSE + 2, // MOVETO + 2, // LINETO + 4, // QUADTO + 6, // CUBICTO + 0 + }; // CLOSE - /** The types. */ + /** + * The types. + */ byte[] types; - - /** The points. */ + + /** + * The points. + */ float[] points; - - /** The type size. */ + + /** + * The type size. + */ int typeSize; - - /** The point size. */ + + /** + * The point size. + */ int pointSize; - /** The x last. */ + /** + * The x last. + */ float xLast; - - /** The y last. */ + + /** + * The y last. + */ float yLast; - - /** The x move. */ + + /** + * The x move. + */ float xMove; - - /** The y move. */ + + /** + * The y move. + */ float yMove; /** @@ -1969,8 +2186,10 @@ public class BasicStroke implements Stroke { /** * Check buf. * - * @param typeCount the type count - * @param pointCount the point count + * @param typeCount + * the type count. + * @param pointCount + * the point count. */ void checkBuf(int typeCount, int pointCount) { if (typeSize + typeCount > types.length) { @@ -1988,7 +2207,7 @@ public class BasicStroke implements Stroke { /** * Checks if is empty. * - * @return true, if is empty + * @return true, if is empty. */ boolean isEmpty() { return typeSize == 0; @@ -2005,8 +2224,10 @@ public class BasicStroke implements Stroke { /** * Move to. * - * @param x the x - * @param y the y + * @param x + * the x. + * @param y + * the y. */ void moveTo(double x, double y) { checkBuf(1, 2); @@ -2018,8 +2239,10 @@ public class BasicStroke implements Stroke { /** * Line to. * - * @param x the x - * @param y the y + * @param x + * the x. + * @param y + * the y. */ void lineTo(double x, double y) { checkBuf(1, 2); @@ -2031,10 +2254,14 @@ public class BasicStroke implements Stroke { /** * Quad to. * - * @param x1 the x1 - * @param y1 the y1 - * @param x2 the x2 - * @param y2 the y2 + * @param x1 + * the x1. + * @param y1 + * the y1. + * @param x2 + * the x2. + * @param y2 + * the y2. */ void quadTo(double x1, double y1, double x2, double y2) { checkBuf(1, 4); @@ -2048,12 +2275,18 @@ public class BasicStroke implements Stroke { /** * Cubic to. * - * @param x1 the x1 - * @param y1 the y1 - * @param x2 the x2 - * @param y2 the y2 - * @param x3 the x3 - * @param y3 the y3 + * @param x1 + * the x1. + * @param y1 + * the y1. + * @param x2 + * the x2. + * @param y2 + * the y2. + * @param x3 + * the x3. + * @param y3 + * the y3. */ void cubicTo(double x1, double y1, double x2, double y2, double x3, double y3) { checkBuf(1, 6); @@ -2077,8 +2310,10 @@ public class BasicStroke implements Stroke { /** * Sets the last. * - * @param x the x - * @param y the y + * @param x + * the x. + * @param y + * the y. */ void setLast(double x, double y) { points[pointSize - 2] = xLast = (float)x; @@ -2088,7 +2323,8 @@ public class BasicStroke implements Stroke { /** * Append. * - * @param p the p + * @param p + * the p. */ void append(BufferedPath p) { checkBuf(p.typeSize, p.pointSize); @@ -2103,18 +2339,19 @@ public class BasicStroke implements Stroke { /** * Append reverse. * - * @param p the p + * @param p + * the p. */ void appendReverse(BufferedPath p) { checkBuf(p.typeSize, p.pointSize); // Skip last point, beacause it's the first point of the second path - for(int i = p.pointSize - 2; i >= 0; i -= 2) { + for (int i = p.pointSize - 2; i >= 0; i -= 2) { points[pointSize++] = p.points[i + 0]; points[pointSize++] = p.points[i + 1]; } // Skip first type, beacuse it's always MOVETO int closeIndex = 0; - for(int i = p.typeSize - 1; i >= 0; i--) { + for (int i = p.typeSize - 1; i >= 0; i--) { byte type = p.types[i]; if (type == PathIterator.SEG_MOVETO) { types[closeIndex] = PathIterator.SEG_MOVETO; @@ -2133,7 +2370,8 @@ public class BasicStroke implements Stroke { /** * Join. * - * @param p the p + * @param p + * the p. */ void join(BufferedPath p) { // Skip MOVETO @@ -2149,17 +2387,18 @@ public class BasicStroke implements Stroke { /** * Combine. * - * @param p the p + * @param p + * the p. */ void combine(BufferedPath p) { checkBuf(p.typeSize - 1, p.pointSize - 2); // Skip last point, beacause it's the first point of the second path - for(int i = p.pointSize - 4; i >= 0; i -= 2) { + for (int i = p.pointSize - 4; i >= 0; i -= 2) { points[pointSize++] = p.points[i + 0]; points[pointSize++] = p.points[i + 1]; } // Skip first type, beacuse it's always MOVETO - for(int i = p.typeSize - 1; i >= 1; i--) { + for (int i = p.typeSize - 1; i >= 1; i--) { types[typeSize++] = p.types[i]; } xLast = points[pointSize - 2]; @@ -2169,29 +2408,30 @@ public class BasicStroke implements Stroke { /** * Creates the general path. * - * @return the general path + * @return the general path. */ GeneralPath createGeneralPath() { GeneralPath p = new GeneralPath(); int j = 0; - for(int i = 0; i < typeSize; i++) { + for (int i = 0; i < typeSize; i++) { int type = types[i]; - switch(type){ - case PathIterator.SEG_MOVETO: - p.moveTo(points[j], points[j + 1]); - break; - case PathIterator.SEG_LINETO: - p.lineTo(points[j], points[j + 1]); - break; - case PathIterator.SEG_QUADTO: - p.quadTo(points[j], points[j + 1], points[j + 2], points[j + 3]); - break; - case PathIterator.SEG_CUBICTO: - p.curveTo(points[j], points[j + 1], points[j + 2], points[j + 3], points[j + 4], points[j + 5]); - break; - case PathIterator.SEG_CLOSE: - p.closePath(); - break; + switch (type) { + case PathIterator.SEG_MOVETO: + p.moveTo(points[j], points[j + 1]); + break; + case PathIterator.SEG_LINETO: + p.lineTo(points[j], points[j + 1]); + break; + case PathIterator.SEG_QUADTO: + p.quadTo(points[j], points[j + 1], points[j + 2], points[j + 3]); + break; + case PathIterator.SEG_CUBICTO: + p.curveTo(points[j], points[j + 1], points[j + 2], points[j + 3], + points[j + 4], points[j + 5]); + break; + case PathIterator.SEG_CLOSE: + p.closePath(); + break; } j += pointShift[type]; } @@ -2201,4 +2441,3 @@ public class BasicStroke implements Stroke { } } - diff --git a/awt/java/awt/BufferCapabilities.java b/awt/java/awt/BufferCapabilities.java index 80e8add53f5f4..cd5fe7b1c7333 100644 --- a/awt/java/awt/BufferCapabilities.java +++ b/awt/java/awt/BufferCapabilities.java @@ -18,35 +18,45 @@ * @author Alexey A. Petrenko * @version $Revision$ */ -package java.awt; +package java.awt; /** - * The BufferCapabilities class represents the capabilities - * and other properties of the image buffers. + * The BufferCapabilities class represents the capabilities and other properties + * of the image buffers. + * + * @since Android 1.0 */ public class BufferCapabilities implements Cloneable { - - /** The front buffer capabilities. */ + + /** + * The front buffer capabilities. + */ private final ImageCapabilities frontBufferCapabilities; - - /** The back buffer capabilities. */ + + /** + * The back buffer capabilities. + */ private final ImageCapabilities backBufferCapabilities; - - /** The flip contents. */ + + /** + * The flip contents. + */ private final FlipContents flipContents; /** * Instantiates a new BufferCapabilities object. * - * @param frontBufferCapabilities the front buffer capabilities, - * can not be null. - * @param backBufferCapabilities the the back and intermediate - * buffers capabilities, can not be null. - * @param flipContents the back buffer contents after page flipping, - * null if page flipping is not used. + * @param frontBufferCapabilities + * the front buffer capabilities, can not be null. + * @param backBufferCapabilities + * the the back and intermediate buffers capabilities, can not be + * null. + * @param flipContents + * the back buffer contents after page flipping, null if page + * flipping is not used. */ - public BufferCapabilities(ImageCapabilities frontBufferCapabilities, + public BufferCapabilities(ImageCapabilities frontBufferCapabilities, ImageCapabilities backBufferCapabilities, FlipContents flipContents) { if (frontBufferCapabilities == null || backBufferCapabilities == null) { throw new IllegalArgumentException(); @@ -70,8 +80,8 @@ public class BufferCapabilities implements Cloneable { /** * Gets the image capabilities of the front buffer. * - * @return the ImageCapabilities object represented capabilities - * of the front buffer. + * @return the ImageCapabilities object represented capabilities of the + * front buffer. */ public ImageCapabilities getFrontBufferCapabilities() { return frontBufferCapabilities; @@ -80,15 +90,15 @@ public class BufferCapabilities implements Cloneable { /** * Gets the image capabilities of the back buffer. * - * @return the ImageCapabilities object represented capabilities - * of the back buffer. + * @return the ImageCapabilities object represented capabilities of the back + * buffer. */ public ImageCapabilities getBackBufferCapabilities() { return backBufferCapabilities; } /** - * Gets the flip contents of the back buffer after page-flipping. + * Gets the flip contents of the back buffer after page-flipping. * * @return the FlipContents of the back buffer after page-flipping. */ @@ -99,8 +109,7 @@ public class BufferCapabilities implements Cloneable { /** * Checks if the buffer strategy uses page flipping. * - * @return true, if the buffer strategy uses page flipping, - * false otherwise. + * @return true, if the buffer strategy uses page flipping, false otherwise. */ public boolean isPageFlipping() { return flipContents != null; @@ -110,7 +119,7 @@ public class BufferCapabilities implements Cloneable { * Checks if page flipping is only available in full-screen mode. * * @return true, if page flipping is only available in full-screen mode, - * false otherwise. + * false otherwise. */ public boolean isFullScreenRequired() { return false; @@ -119,39 +128,40 @@ public class BufferCapabilities implements Cloneable { /** * Checks if page flipping can be performed using more than two buffers. * - * @return true, if page flipping can be performed using more than two buffers, - * false otherwise. + * @return true, if page flipping can be performed using more than two + * buffers, false otherwise. */ public boolean isMultiBufferAvailable() { return false; } /** - * The FlipContents class represents a set of possible back buffer contents + * The FlipContents class represents a set of possible back buffer contents * after page-flipping. + * + * @since Android 1.0 */ public static final class FlipContents { - + /** - * The back buffered contents are cleared with the background color + * The back buffered contents are cleared with the background color * after flipping. */ public static final FlipContents BACKGROUND = new FlipContents(); - - /** - * The back buffered contents are copied to the front buffer before + + /** + * The back buffered contents are copied to the front buffer before * flipping. */ public static final FlipContents COPIED = new FlipContents(); - - /** - * The back buffer contents are the prior contents of the - * front buffer. + + /** + * The back buffer contents are the prior contents of the front buffer. */ public static final FlipContents PRIOR = new FlipContents(); - - /** - * The back buffer contents are undefined after flipping + + /** + * The back buffer contents are undefined after flipping */ public static final FlipContents UNDEFINED = new FlipContents(); diff --git a/awt/java/awt/Color.java b/awt/java/awt/Color.java index e1e4178e9992f..93c532d784a35 100644 --- a/awt/java/awt/Color.java +++ b/awt/java/awt/Color.java @@ -18,6 +18,7 @@ * @author Oleg V. Khaschansky * @version $Revision$ */ + package java.awt; import java.awt.color.ColorSpace; @@ -33,155 +34,230 @@ import java.util.Arrays; import org.apache.harmony.awt.internal.nls.Messages; /** - * The Color class defines colors in the default sRGB color - * space or in the specified ColorSpace. Every Color contains alpha value. - * The alpha value defines the transparency of a color and can be represented - * by a float value in the range 0.0 - 1.0 or 0 - 255. - */ + * The Color class defines colors in the default sRGB color space or in the + * specified ColorSpace. Every Color contains alpha value. The alpha value + * defines the transparency of a color and can be represented by a float value + * in the range 0.0 - 1.0 or 0 - 255. + * + * @since Android 1.0 + */ public class Color implements Paint, Serializable { - - /** The Constant serialVersionUID. */ + + /** + * The Constant serialVersionUID. + */ private static final long serialVersionUID = 118526816881161077L; /* - * The values of the following colors are based on 1.5 release behavior which - * can be revealed using the following or similar code: - * Color c = Color.white; - * System.out.println(c); + * The values of the following colors are based on 1.5 release behavior + * which can be revealed using the following or similar code: Color c = + * Color.white; System.out.println(c); */ - /** The color white. */ + /** + * The color white. + */ public static final Color white = new Color(255, 255, 255); - /** The color white. */ + /** + * The color white. + */ public static final Color WHITE = white; - /** The color light gray. */ + /** + * The color light gray. + */ public static final Color lightGray = new Color(192, 192, 192); - /** The color light gray. */ + /** + * The color light gray. + */ public static final Color LIGHT_GRAY = lightGray; - /** The color gray. */ + /** + * The color gray. + */ public static final Color gray = new Color(128, 128, 128); - /** The color gray. */ + /** + * The color gray. + */ public static final Color GRAY = gray; - /** The color dark gray. */ + /** + * The color dark gray. + */ public static final Color darkGray = new Color(64, 64, 64); - /** The color dark gray. */ + /** + * The color dark gray. + */ public static final Color DARK_GRAY = darkGray; - /** The color black. */ + /** + * The color black. + */ public static final Color black = new Color(0, 0, 0); - /** The color black. */ + /** + * The color black. + */ public static final Color BLACK = black; - /** The color red. */ + /** + * The color red. + */ public static final Color red = new Color(255, 0, 0); - /** The color red. */ + /** + * The color red. + */ public static final Color RED = red; - /** The color pink. */ + /** + * The color pink. + */ public static final Color pink = new Color(255, 175, 175); - /** The color pink. */ + /** + * The color pink. + */ public static final Color PINK = pink; - /** The color orange. */ + /** + * The color orange. + */ public static final Color orange = new Color(255, 200, 0); - /** The color orange. */ + /** + * The color orange. + */ public static final Color ORANGE = orange; - /** The color yellow. */ + /** + * The color yellow. + */ public static final Color yellow = new Color(255, 255, 0); - /** The color yellow. */ + /** + * The color yellow. + */ public static final Color YELLOW = yellow; - /** The color green. */ + /** + * The color green. + */ public static final Color green = new Color(0, 255, 0); - /** The color green. */ + /** + * The color green. + */ public static final Color GREEN = green; - /** The color magenta. */ + /** + * The color magenta. + */ public static final Color magenta = new Color(255, 0, 255); - /** The color magenta. */ + /** + * The color magenta. + */ public static final Color MAGENTA = magenta; - /** The color cyan. */ + /** + * The color cyan. + */ public static final Color cyan = new Color(0, 255, 255); - /** The color cyan. */ + /** + * The color cyan. + */ public static final Color CYAN = cyan; - /** The color blue. */ + /** + * The color blue. + */ public static final Color blue = new Color(0, 0, 255); - /** The color blue. */ + /** + * The color blue. + */ public static final Color BLUE = blue; - /** integer RGB value. */ + /** + * integer RGB value. + */ int value; - /** Float sRGB value. */ + /** + * Float sRGB value. + */ private float[] frgbvalue; - /** Color in an arbitrary color space with float components. If null, other value should be used. */ + /** + * Color in an arbitrary color space with float components. If + * null, other value should be used. + */ private float fvalue[]; - /** Float alpha value. If frgbvalue is null, this is not valid data. */ + /** + * Float alpha value. If frgbvalue is null, this is not valid data. + */ private float falpha; - /** The color's color space if applicable. */ + /** + * The color's color space if applicable. + */ private ColorSpace cs; /* - * The value of the SCALE_FACTOR is based on 1.5 release behavior which - * can be revealed using the following code: - * Color c = new Color(100, 100, 100); - * Color bc = c.brighter(); - * System.out.println("Brighter factor: " + ((float)c.getRed())/((float)bc.getRed())); - * Color dc = c.darker(); - * System.out.println("Darker factor: " + ((float)dc.getRed())/((float)c.getRed())); - * The result is the same for brighter and darker methods, so we need only - * one scale factor for both. - */ - /** The Constant SCALE_FACTOR. */ + * The value of the SCALE_FACTOR is based on 1.5 release behavior which can + * be revealed using the following code: Color c = new Color(100, 100, 100); + * Color bc = c.brighter(); System.out.println("Brighter factor: " + + * ((float)c.getRed())/((float)bc.getRed())); Color dc = c.darker(); + * System.out.println("Darker factor: " + + * ((float)dc.getRed())/((float)c.getRed())); The result is the same for + * brighter and darker methods, so we need only one scale factor for both. + */ + /** + * The Constant SCALE_FACTOR. + */ private static final double SCALE_FACTOR = 0.7; - /** The Constant MIN_SCALABLE. */ - private static final int MIN_SCALABLE = 3; // should increase when multiplied by SCALE_FACTOR + /** + * The Constant MIN_SCALABLE. + */ + private static final int MIN_SCALABLE = 3; // should increase when + + // multiplied by SCALE_FACTOR - /** The current paint context. */ + /** + * The current paint context. + */ transient private PaintContext currentPaintContext; /** - * Creates a color in the specified ColorSpace, the specified color - * components and the specified alpha. + * Creates a color in the specified ColorSpace, the specified color + * components and the specified alpha. * - * @param cspace the ColorSpace to be used to define the components. - * @param components the components. - * @param alpha the alpha. + * @param cspace + * the ColorSpace to be used to define the components. + * @param components + * the components. + * @param alpha + * the alpha. */ public Color(ColorSpace cspace, float[] components, float alpha) { int nComps = cspace.getNumComponents(); float comp; fvalue = new float[nComps]; - for(int i=0 ; i 1.0f) { - // awt.107=Color parameter outside of expected range: component {0}. - throw new IllegalArgumentException( - Messages.getString("awt.107", i)); //$NON-NLS-1$ + if (comp < 0.0f || comp > 1.0f) { + // awt.107=Color parameter outside of expected range: component + // {0}. + throw new IllegalArgumentException(Messages.getString("awt.107", i)); //$NON-NLS-1$ } fvalue[i] = components[i]; } @@ -196,22 +272,22 @@ public class Color implements Paint, Serializable { frgbvalue = cs.toRGB(fvalue); - value = ((int)(frgbvalue[2]*255 + 0.5)) | - (((int)(frgbvalue[1]*255 + 0.5)) << 8 ) | - (((int)(frgbvalue[0]*255 + 0.5)) << 16 ) | - (((int)(falpha*255 + 0.5)) << 24 ); + value = ((int)(frgbvalue[2] * 255 + 0.5)) | (((int)(frgbvalue[1] * 255 + 0.5)) << 8) + | (((int)(frgbvalue[0] * 255 + 0.5)) << 16) | (((int)(falpha * 255 + 0.5)) << 24); } /** - * Instantiates a new sRGB color with the specified combined - * RGBA value consisting of the alpha component in bits 24-31, - * the red component in bits 16-23, the green component in bits 8-15, - * and the blue component in bits 0-7. If the hasalpha argument is - * false, the alpha has default value - 255. + * Instantiates a new sRGB color with the specified combined RGBA value + * consisting of the alpha component in bits 24-31, the red component in + * bits 16-23, the green component in bits 8-15, and the blue component in + * bits 0-7. If the hasalpha argument is false, the alpha has default value + * - 255. * - * @param rgba the RGBA components. - * @param hasAlpha alpha parameter is true if alpha bits are valid, - * false otherwise. + * @param rgba + * the RGBA components. + * @param hasAlpha + * the alpha parameter is true if alpha bits are valid, false + * otherwise. */ public Color(int rgba, boolean hasAlpha) { if (!hasAlpha) { @@ -222,13 +298,17 @@ public class Color implements Paint, Serializable { } /** - * Instantiates a new color with the specified red, green, blue and alpha + * Instantiates a new color with the specified red, green, blue and alpha * components. * - * @param r the red component. - * @param g the green component. - * @param b the blue component. - * @param a the alpha component. + * @param r + * the red component. + * @param g + * the green component. + * @param b + * the blue component. + * @param a + * the alpha component. */ public Color(int r, int g, int b, int a) { if ((r & 0xFF) != r || (g & 0xFF) != g || (b & 0xFF) != b || (a & 0xFF) != a) { @@ -239,12 +319,15 @@ public class Color implements Paint, Serializable { } /** - * Instantiates a new opaque sRGB color with the specified red, green, - * and blue values. The Alpha component is set to the default - 1.0. + * Instantiates a new opaque sRGB color with the specified red, green, and + * blue values. The Alpha component is set to the default - 1.0. * - * @param r the red component. - * @param g the green component. - * @param b the blue component. + * @param r + * the red component. + * @param g + * the green component. + * @param b + * the blue component. */ public Color(int r, int g, int b) { if ((r & 0xFF) != r || (g & 0xFF) != g || (b & 0xFF) != b) { @@ -256,31 +339,32 @@ public class Color implements Paint, Serializable { } /** - * Instantiates a new sRGB color with the specified - * RGB value consisting of the red component in bits 16-23, - * the green component in bits 8-15, and the blue component - * in bits 0-7. Alpha has default value - 255. + * Instantiates a new sRGB color with the specified RGB value consisting of + * the red component in bits 16-23, the green component in bits 8-15, and + * the blue component in bits 0-7. Alpha has default value - 255. * - * @param rgb the RGB components. + * @param rgb + * the RGB components. */ public Color(int rgb) { value = rgb | 0xFF000000; } /** - * Instantiates a new color with the specified red, green, blue and alpha + * Instantiates a new color with the specified red, green, blue and alpha * components. * - * @param r the red component. - * @param g the green component. - * @param b the blue component. - * @param a the alpha component. + * @param r + * the red component. + * @param g + * the green component. + * @param b + * the blue component. + * @param a + * the alpha component. */ public Color(float r, float g, float b, float a) { - this((int)(r*255+0.5), - (int)(g*255+0.5), - (int)(b*255+0.5), - (int)(a*255+0.5)); + this((int)(r * 255 + 0.5), (int)(g * 255 + 0.5), (int)(b * 255 + 0.5), (int)(a * 255 + 0.5)); falpha = a; fvalue = new float[3]; fvalue[0] = r; @@ -290,25 +374,23 @@ public class Color implements Paint, Serializable { } /** - * Instantiates a new color with the specified red, green, and blue - * components and default alfa value - 1.0. + * Instantiates a new color with the specified red, green, and blue + * components and default alpha value - 1.0. * - * @param r the red component. - * @param g the green component. - * @param b the blue component. + * @param r + * the red component. + * @param g + * the green component. + * @param b + * the blue component. */ public Color(float r, float g, float b) { this(r, g, b, 1.0f); } - public PaintContext createContext( - ColorModel cm, - Rectangle r, - Rectangle2D r2d, - AffineTransform xform, - RenderingHints rhs - ) { - if(currentPaintContext != null) { + public PaintContext createContext(ColorModel cm, Rectangle r, Rectangle2D r2d, + AffineTransform xform, RenderingHints rhs) { + if (currentPaintContext != null) { return currentPaintContext; } currentPaintContext = new Color.ColorPaintContext(value); @@ -323,15 +405,12 @@ public class Color implements Paint, Serializable { @Override public String toString() { /* - The format of the string is based on 1.5 release behavior which - can be revealed using the following code: - - Color c = new Color(1, 2, 3); - System.out.println(c); - */ - - return getClass().getName() + - "[r=" + getRed() + //$NON-NLS-1$ + * The format of the string is based on 1.5 release behavior which can + * be revealed using the following code: Color c = new Color(1, 2, 3); + * System.out.println(c); + */ + + return getClass().getName() + "[r=" + getRed() + //$NON-NLS-1$ ",g=" + getGreen() + //$NON-NLS-1$ ",b=" + getBlue() + //$NON-NLS-1$ "]"; //$NON-NLS-1$ @@ -340,65 +419,67 @@ public class Color implements Paint, Serializable { /** * Compares the specified Object to the Color. * - * @param obj the Object to be compared. - * - * @return true, if the specified Object is a Color whose - * value is equal to this Color, false otherwise. + * @param obj + * the Object to be compared. + * @return true, if the specified Object is a Color whose value is equal to + * this Color, false otherwise. */ @Override public boolean equals(Object obj) { - if(obj instanceof Color) { + if (obj instanceof Color) { return ((Color)obj).value == this.value; } return false; } /** - * Returns a float array containing the color and alpha components of - * the Color in the specified ColorSpace. - * - * @param colorSpace the specified ColorSpace. - * @param components the results of this method will be written to - * this float array. If null, a float array will be created. + * Returns a float array containing the color and alpha components of the + * Color in the specified ColorSpace. * + * @param colorSpace + * the specified ColorSpace. + * @param components + * the results of this method will be written to this float + * array. If null, a float array will be created. * @return the color and alpha components in a float array. */ public float[] getComponents(ColorSpace colorSpace, float[] components) { int nComps = colorSpace.getNumComponents(); - if(components == null) { - components = new float[nComps+1]; + if (components == null) { + components = new float[nComps + 1]; } getColorComponents(colorSpace, components); - if(frgbvalue != null) { + if (frgbvalue != null) { components[nComps] = falpha; } else { - components[nComps] = getAlpha()/255f; + components[nComps] = getAlpha() / 255f; } return components; } /** - * Returns a float array containing the color components of - * the Color in the specified ColorSpace. - * - * @param colorSpace the specified ColorSpace. - * @param components the results of this method will be written to - * this float array. If null, a float array will be created. + * Returns a float array containing the color components of the Color in the + * specified ColorSpace. * + * @param colorSpace + * the specified ColorSpace. + * @param components + * the results of this method will be written to this float + * array. If null, a float array will be created. * @return the color components in a float array. */ public float[] getColorComponents(ColorSpace colorSpace, float[] components) { float[] cieXYZComponents = getColorSpace().toCIEXYZ(getColorComponents(null)); float[] csComponents = colorSpace.fromCIEXYZ(cieXYZComponents); - if(components == null) { + if (components == null) { return csComponents; } - for(int i=0; i 255) ? 255 : r; } - if(b < MIN_SCALABLE && b != 0) { + if (b < MIN_SCALABLE && b != 0) { b = MIN_SCALABLE; } else { - b = (int) (b/SCALE_FACTOR); + b = (int)(b / SCALE_FACTOR); b = (b > 255) ? 255 : b; } - if(g < MIN_SCALABLE && g != 0) { + if (g < MIN_SCALABLE && g != 0) { g = MIN_SCALABLE; } else { - g = (int) (g/SCALE_FACTOR); + g = (int)(g / SCALE_FACTOR); g = (g > 255) ? 255 : g; } @@ -471,24 +550,24 @@ public class Color implements Paint, Serializable { } /** - * Returns a float array containing the color and alpha components of - * the Color in the default sRGB color space. - * - * @param components the results of this method will be written to - * this float array. A new float array will be created if this - * argument is null. + * Returns a float array containing the color and alpha components of the + * Color in the default sRGB color space. * + * @param components + * the results of this method will be written to this float + * array. A new float array will be created if this argument is + * null. * @return the RGB color and alpha components in a float array. */ public float[] getRGBComponents(float[] components) { - if(components == null) { + if (components == null) { components = new float[4]; } - if(frgbvalue != null) { + if (frgbvalue != null) { components[3] = falpha; } else { - components[3] = getAlpha()/255f; + components[3] = getAlpha() / 255f; } getRGBColorComponents(components); @@ -497,52 +576,52 @@ public class Color implements Paint, Serializable { } /** - * Returns a float array containing the color components of - * the Color in the default sRGB color space. - * - * @param components the results of this method will be written to - * this float array. A new float array will be created if this - * argument is null. + * Returns a float array containing the color components of the Color in the + * default sRGB color space. * + * @param components + * the results of this method will be written to this float + * array. A new float array will be created if this argument is + * null. * @return the RGB color components in a float array. */ public float[] getRGBColorComponents(float[] components) { - if(components == null) { + if (components == null) { components = new float[3]; } - if(frgbvalue != null) { + if (frgbvalue != null) { components[2] = frgbvalue[2]; components[1] = frgbvalue[1]; components[0] = frgbvalue[0]; } else { - components[2] = getBlue()/255f; - components[1] = getGreen()/255f; - components[0] = getRed()/255f; + components[2] = getBlue() / 255f; + components[1] = getGreen() / 255f; + components[0] = getRed() / 255f; } return components; } /** - * Returns a float array which contains the color and alpha components of + * Returns a float array which contains the color and alpha components of * the Color in the ColorSpace of the Color. * - * @param components the results of this method will be written to - * this float array. A new float array will be created if this - * argument is null. - * + * @param components + * the results of this method will be written to this float + * array. A new float array will be created if this argument is + * null. * @return the color and alpha components in a float array. */ public float[] getComponents(float[] components) { - if(fvalue == null) { + if (fvalue == null) { return getRGBComponents(components); } int nColorComps = fvalue.length; - if(components == null) { - components = new float[nColorComps+1]; + if (components == null) { + components = new float[nColorComps + 1]; } getColorComponents(components); @@ -553,25 +632,25 @@ public class Color implements Paint, Serializable { } /** - * Returns a float array which contains the color components of - * the Color in the ColorSpace of the Color. - * - * @param components the results of this method will be written to - * this float array. A new float array will be created if this - * argument is null. + * Returns a float array which contains the color components of the Color in + * the ColorSpace of the Color. * + * @param components + * the results of this method will be written to this float + * array. A new float array will be created if this argument is + * null. * @return the color components in a float array. */ public float[] getColorComponents(float[] components) { - if(fvalue == null) { + if (fvalue == null) { return getRGBColorComponents(components); } - if(components == null) { + if (components == null) { components = new float[fvalue.length]; } - for(int i=0; i, Boolean> childClassesFlags = new Hashtable, Boolean>(); - /** The Constant peer. */ + /** + * The Constant peer. + */ private static final ComponentPeer peer = new ComponentPeer() { }; - /** The Constant incrementalImageUpdate. */ + /** + * The Constant incrementalImageUpdate. + */ private static final boolean incrementalImageUpdate; - /** The toolkit. */ + /** + * The toolkit. + */ final transient Toolkit toolkit = Toolkit.getDefaultToolkit(); - //???AWT + // ???AWT /* - protected abstract class AccessibleAWTComponent extends AccessibleContext implements - Serializable, AccessibleComponent { - private static final long serialVersionUID = 642321655757800191L; - - protected class AccessibleAWTComponentHandler implements ComponentListener { - protected AccessibleAWTComponentHandler() { - } - - public void componentHidden(ComponentEvent e) { - if (behaviour.isLightweight()) { - return; - } - firePropertyChange(AccessibleContext.ACCESSIBLE_STATE_PROPERTY, - AccessibleState.VISIBLE, null); - } - - public void componentMoved(ComponentEvent e) { - } - - public void componentResized(ComponentEvent e) { - } - - public void componentShown(ComponentEvent e) { - if (behaviour.isLightweight()) { - return; - } - firePropertyChange(AccessibleContext.ACCESSIBLE_STATE_PROPERTY, null, - AccessibleState.VISIBLE); - } - } - - protected class AccessibleAWTFocusHandler implements FocusListener { - public void focusGained(FocusEvent e) { - if (behaviour.isLightweight()) { - return; - } - firePropertyChange(AccessibleContext.ACCESSIBLE_STATE_PROPERTY, null, - AccessibleState.FOCUSED); - } - - public void focusLost(FocusEvent e) { - if (behaviour.isLightweight()) { - return; - } - firePropertyChange(AccessibleContext.ACCESSIBLE_STATE_PROPERTY, - AccessibleState.FOCUSED, null); - } - } - - protected ComponentListener accessibleAWTComponentHandler; - - protected FocusListener accessibleAWTFocusHandler; - */ - /* - * Number of registered property change listeners. - */ - /* - int listenersCount; - - public void addFocusListener(FocusListener l) { - Component.this.addFocusListener(l); - } - - @Override - public void addPropertyChangeListener(PropertyChangeListener listener) { - toolkit.lockAWT(); - try { - super.addPropertyChangeListener(listener); - listenersCount++; - if (accessibleAWTComponentHandler == null) { - accessibleAWTComponentHandler = new AccessibleAWTComponentHandler(); - Component.this.addComponentListener(accessibleAWTComponentHandler); - } - if (accessibleAWTFocusHandler == null) { - accessibleAWTFocusHandler = new AccessibleAWTFocusHandler(); - Component.this.addFocusListener(accessibleAWTFocusHandler); - } - } finally { - toolkit.unlockAWT(); - } - } - - public boolean contains(Point p) { - toolkit.lockAWT(); - try { - return Component.this.contains(p); - } finally { - toolkit.unlockAWT(); - } - } - - public Accessible getAccessibleAt(Point arg0) { - toolkit.lockAWT(); - try { - return null; - } finally { - toolkit.unlockAWT(); - } - } - - public Color getBackground() { - toolkit.lockAWT(); - try { - return Component.this.getBackground(); - } finally { - toolkit.unlockAWT(); - } - } - - public Rectangle getBounds() { - toolkit.lockAWT(); - try { - return Component.this.getBounds(); - } finally { - toolkit.unlockAWT(); - } - } - - public Cursor getCursor() { - toolkit.lockAWT(); - try { - return Component.this.getCursor(); - } finally { - toolkit.unlockAWT(); - } - } - - public Font getFont() { - toolkit.lockAWT(); - try { - return Component.this.getFont(); - } finally { - toolkit.unlockAWT(); - } - } - - public FontMetrics getFontMetrics(Font f) { - toolkit.lockAWT(); - try { - return Component.this.getFontMetrics(f); - } finally { - toolkit.unlockAWT(); - } - } - - public Color getForeground() { - toolkit.lockAWT(); - try { - return Component.this.getForeground(); - } finally { - toolkit.unlockAWT(); - } - } - - public Point getLocation() { - toolkit.lockAWT(); - try { - return Component.this.getLocation(); - } finally { - toolkit.unlockAWT(); - } - } - - public Point getLocationOnScreen() { - toolkit.lockAWT(); - try { - return Component.this.getLocationOnScreen(); - } finally { - toolkit.unlockAWT(); - } - } - - public Dimension getSize() { - toolkit.lockAWT(); - try { - return Component.this.getSize(); - } finally { - toolkit.unlockAWT(); - } - } - - public boolean isEnabled() { - toolkit.lockAWT(); - try { - return Component.this.isEnabled(); - } finally { - toolkit.unlockAWT(); - } - } - - public boolean isFocusTraversable() { - toolkit.lockAWT(); - try { - return Component.this.isFocusTraversable(); - } finally { - toolkit.unlockAWT(); - } - } - - public boolean isShowing() { - toolkit.lockAWT(); - try { - return Component.this.isShowing(); - } finally { - toolkit.unlockAWT(); - } - } - - public boolean isVisible() { - toolkit.lockAWT(); - try { - return Component.this.isVisible(); - } finally { - toolkit.unlockAWT(); - } - } - - public void removeFocusListener(FocusListener l) { - Component.this.removeFocusListener(l); - } - - @Override - public void removePropertyChangeListener(PropertyChangeListener listener) { - toolkit.lockAWT(); - try { - super.removePropertyChangeListener(listener); - listenersCount--; - if (listenersCount > 0) { - return; - } - // if there are no more listeners, remove handlers: - Component.this.removeFocusListener(accessibleAWTFocusHandler); - Component.this.removeComponentListener(accessibleAWTComponentHandler); - accessibleAWTComponentHandler = null; - accessibleAWTFocusHandler = null; - } finally { - toolkit.unlockAWT(); - } - } - - public void requestFocus() { - toolkit.lockAWT(); - try { - Component.this.requestFocus(); - } finally { - toolkit.unlockAWT(); - } - } - - public void setBackground(Color color) { - toolkit.lockAWT(); - try { - Component.this.setBackground(color); - } finally { - toolkit.unlockAWT(); - } - } - - public void setBounds(Rectangle r) { - toolkit.lockAWT(); - try { - Component.this.setBounds(r); - } finally { - toolkit.unlockAWT(); - } - } - - public void setCursor(Cursor cursor) { - toolkit.lockAWT(); - try { - Component.this.setCursor(cursor); - } finally { - toolkit.unlockAWT(); - } - } - - public void setEnabled(boolean enabled) { - toolkit.lockAWT(); - try { - Component.this.setEnabled(enabled); - } finally { - toolkit.unlockAWT(); - } - } - - public void setFont(Font f) { - toolkit.lockAWT(); - try { - Component.this.setFont(f); - } finally { - toolkit.unlockAWT(); - } - } - - public void setForeground(Color color) { - toolkit.lockAWT(); - try { - Component.this.setForeground(color); - } finally { - toolkit.unlockAWT(); - } - } - - public void setLocation(Point p) { - toolkit.lockAWT(); - try { - Component.this.setLocation(p); - } finally { - toolkit.unlockAWT(); - } - } - - public void setSize(Dimension size) { - toolkit.lockAWT(); - try { - Component.this.setSize(size); - } finally { - toolkit.unlockAWT(); - } - } - - public void setVisible(boolean visible) { - toolkit.lockAWT(); - try { - Component.this.setVisible(visible); - } finally { - toolkit.unlockAWT(); - } - } - - @Override - public Accessible getAccessibleParent() { - toolkit.lockAWT(); - try { - Accessible aParent = super.getAccessibleParent(); - if (aParent != null) { - return aParent; - } - Container parent = getParent(); - return (parent instanceof Accessible ? (Accessible) parent : null); - } finally { - toolkit.unlockAWT(); - } - } - - @Override - public Accessible getAccessibleChild(int i) { - toolkit.lockAWT(); - try { - return null; - } finally { - toolkit.unlockAWT(); - } - } - - @Override - public int getAccessibleChildrenCount() { - toolkit.lockAWT(); - try { - return 0; - } finally { - toolkit.unlockAWT(); - } - } - - @Override - public AccessibleComponent getAccessibleComponent() { - return this; - } - - @Override - public String getAccessibleDescription() { - return super.getAccessibleDescription(); // why override? - } - - @Override - public int getAccessibleIndexInParent() { - toolkit.lockAWT(); - try { - if (getAccessibleParent() == null) { - return -1; - } - int count = 0; - Container parent = getParent(); - for (int i = 0; i < parent.getComponentCount(); i++) { - Component aComp = parent.getComponent(i); - if (aComp instanceof Accessible) { - if (aComp == Component.this) { - return count; - } - ++count; - } - } - return -1; - } finally { - toolkit.unlockAWT(); - } - } - - @Override - public AccessibleRole getAccessibleRole() { - toolkit.lockAWT(); - try { - return AccessibleRole.AWT_COMPONENT; - } finally { - toolkit.unlockAWT(); - } - } - - @Override - public AccessibleStateSet getAccessibleStateSet() { - toolkit.lockAWT(); - try { - AccessibleStateSet set = new AccessibleStateSet(); - if (isEnabled()) { - set.add(AccessibleState.ENABLED); - } - if (isFocusable()) { - set.add(AccessibleState.FOCUSABLE); - } - if (hasFocus()) { - set.add(AccessibleState.FOCUSED); - } - if (isOpaque()) { - set.add(AccessibleState.OPAQUE); - } - if (isShowing()) { - set.add(AccessibleState.SHOWING); - } - if (isVisible()) { - set.add(AccessibleState.VISIBLE); - } - return set; - } finally { - toolkit.unlockAWT(); - } - } - - @Override - public Locale getLocale() throws IllegalComponentStateException { - toolkit.lockAWT(); - try { - return Component.this.getLocale(); - } finally { - toolkit.unlockAWT(); - } - } - } - */ - /** - * The BltBufferStrategy class provides opportunity of blitting - * offscreen surfaces to a component. For more information on - * blitting, see Bit blit. + * protected abstract class AccessibleAWTComponent extends AccessibleContext + * implements Serializable, AccessibleComponent { private static final long + * serialVersionUID = 642321655757800191L; protected class + * AccessibleAWTComponentHandler implements ComponentListener { protected + * AccessibleAWTComponentHandler() { } public void + * componentHidden(ComponentEvent e) { if (behaviour.isLightweight()) { + * return; } firePropertyChange(AccessibleContext.ACCESSIBLE_STATE_PROPERTY, + * AccessibleState.VISIBLE, null); } public void + * componentMoved(ComponentEvent e) { } public void + * componentResized(ComponentEvent e) { } public void + * componentShown(ComponentEvent e) { if (behaviour.isLightweight()) { + * return; } firePropertyChange(AccessibleContext.ACCESSIBLE_STATE_PROPERTY, + * null, AccessibleState.VISIBLE); } } protected class + * AccessibleAWTFocusHandler implements FocusListener { public void + * focusGained(FocusEvent e) { if (behaviour.isLightweight()) { return; } + * firePropertyChange(AccessibleContext.ACCESSIBLE_STATE_PROPERTY, null, + * AccessibleState.FOCUSED); } public void focusLost(FocusEvent e) { if + * (behaviour.isLightweight()) { return; } + * firePropertyChange(AccessibleContext.ACCESSIBLE_STATE_PROPERTY, + * AccessibleState.FOCUSED, null); } } protected ComponentListener + * accessibleAWTComponentHandler; protected FocusListener + * accessibleAWTFocusHandler; + */ + /* + * Number of registered property change listeners. + */ + /* + * int listenersCount; public void addFocusListener(FocusListener l) { + * Component.this.addFocusListener(l); } + * @Override public void addPropertyChangeListener(PropertyChangeListener + * listener) { toolkit.lockAWT(); try { + * super.addPropertyChangeListener(listener); listenersCount++; if + * (accessibleAWTComponentHandler == null) { accessibleAWTComponentHandler = + * new AccessibleAWTComponentHandler(); + * Component.this.addComponentListener(accessibleAWTComponentHandler); } if + * (accessibleAWTFocusHandler == null) { accessibleAWTFocusHandler = new + * AccessibleAWTFocusHandler(); + * Component.this.addFocusListener(accessibleAWTFocusHandler); } } finally { + * toolkit.unlockAWT(); } } public boolean contains(Point p) { + * toolkit.lockAWT(); try { return Component.this.contains(p); } finally { + * toolkit.unlockAWT(); } } public Accessible getAccessibleAt(Point arg0) { + * toolkit.lockAWT(); try { return null; } finally { toolkit.unlockAWT(); } + * } public Color getBackground() { toolkit.lockAWT(); try { return + * Component.this.getBackground(); } finally { toolkit.unlockAWT(); } } + * public Rectangle getBounds() { toolkit.lockAWT(); try { return + * Component.this.getBounds(); } finally { toolkit.unlockAWT(); } } public + * Cursor getCursor() { toolkit.lockAWT(); try { return + * Component.this.getCursor(); } finally { toolkit.unlockAWT(); } } public + * Font getFont() { toolkit.lockAWT(); try { return + * Component.this.getFont(); } finally { toolkit.unlockAWT(); } } public + * FontMetrics getFontMetrics(Font f) { toolkit.lockAWT(); try { return + * Component.this.getFontMetrics(f); } finally { toolkit.unlockAWT(); } } + * public Color getForeground() { toolkit.lockAWT(); try { return + * Component.this.getForeground(); } finally { toolkit.unlockAWT(); } } + * public Point getLocation() { toolkit.lockAWT(); try { return + * Component.this.getLocation(); } finally { toolkit.unlockAWT(); } } public + * Point getLocationOnScreen() { toolkit.lockAWT(); try { return + * Component.this.getLocationOnScreen(); } finally { toolkit.unlockAWT(); } + * } public Dimension getSize() { toolkit.lockAWT(); try { return + * Component.this.getSize(); } finally { toolkit.unlockAWT(); } } public + * boolean isEnabled() { toolkit.lockAWT(); try { return + * Component.this.isEnabled(); } finally { toolkit.unlockAWT(); } } public + * boolean isFocusTraversable() { toolkit.lockAWT(); try { return + * Component.this.isFocusTraversable(); } finally { toolkit.unlockAWT(); } } + * public boolean isShowing() { toolkit.lockAWT(); try { return + * Component.this.isShowing(); } finally { toolkit.unlockAWT(); } } public + * boolean isVisible() { toolkit.lockAWT(); try { return + * Component.this.isVisible(); } finally { toolkit.unlockAWT(); } } public + * void removeFocusListener(FocusListener l) { + * Component.this.removeFocusListener(l); } + * @Override public void removePropertyChangeListener(PropertyChangeListener + * listener) { toolkit.lockAWT(); try { + * super.removePropertyChangeListener(listener); listenersCount--; if + * (listenersCount > 0) { return; } // if there are no more listeners, + * remove handlers: + * Component.this.removeFocusListener(accessibleAWTFocusHandler); + * Component.this.removeComponentListener(accessibleAWTComponentHandler); + * accessibleAWTComponentHandler = null; accessibleAWTFocusHandler = null; } + * finally { toolkit.unlockAWT(); } } public void requestFocus() { + * toolkit.lockAWT(); try { Component.this.requestFocus(); } finally { + * toolkit.unlockAWT(); } } public void setBackground(Color color) { + * toolkit.lockAWT(); try { Component.this.setBackground(color); } finally { + * toolkit.unlockAWT(); } } public void setBounds(Rectangle r) { + * toolkit.lockAWT(); try { Component.this.setBounds(r); } finally { + * toolkit.unlockAWT(); } } public void setCursor(Cursor cursor) { + * toolkit.lockAWT(); try { Component.this.setCursor(cursor); } finally { + * toolkit.unlockAWT(); } } public void setEnabled(boolean enabled) { + * toolkit.lockAWT(); try { Component.this.setEnabled(enabled); } finally { + * toolkit.unlockAWT(); } } public void setFont(Font f) { toolkit.lockAWT(); + * try { Component.this.setFont(f); } finally { toolkit.unlockAWT(); } } + * public void setForeground(Color color) { toolkit.lockAWT(); try { + * Component.this.setForeground(color); } finally { toolkit.unlockAWT(); } } + * public void setLocation(Point p) { toolkit.lockAWT(); try { + * Component.this.setLocation(p); } finally { toolkit.unlockAWT(); } } + * public void setSize(Dimension size) { toolkit.lockAWT(); try { + * Component.this.setSize(size); } finally { toolkit.unlockAWT(); } } public + * void setVisible(boolean visible) { toolkit.lockAWT(); try { + * Component.this.setVisible(visible); } finally { toolkit.unlockAWT(); } } + * @Override public Accessible getAccessibleParent() { toolkit.lockAWT(); + * try { Accessible aParent = super.getAccessibleParent(); if (aParent != + * null) { return aParent; } Container parent = getParent(); return (parent + * instanceof Accessible ? (Accessible) parent : null); } finally { + * toolkit.unlockAWT(); } } + * @Override public Accessible getAccessibleChild(int i) { + * toolkit.lockAWT(); try { return null; } finally { toolkit.unlockAWT(); } + * } + * @Override public int getAccessibleChildrenCount() { toolkit.lockAWT(); + * try { return 0; } finally { toolkit.unlockAWT(); } } + * @Override public AccessibleComponent getAccessibleComponent() { return + * this; } + * @Override public String getAccessibleDescription() { return + * super.getAccessibleDescription(); // why override? } + * @Override public int getAccessibleIndexInParent() { toolkit.lockAWT(); + * try { if (getAccessibleParent() == null) { return -1; } int count = 0; + * Container parent = getParent(); for (int i = 0; i < + * parent.getComponentCount(); i++) { Component aComp = + * parent.getComponent(i); if (aComp instanceof Accessible) { if (aComp == + * Component.this) { return count; } ++count; } } return -1; } finally { + * toolkit.unlockAWT(); } } + * @Override public AccessibleRole getAccessibleRole() { toolkit.lockAWT(); + * try { return AccessibleRole.AWT_COMPONENT; } finally { + * toolkit.unlockAWT(); } } + * @Override public AccessibleStateSet getAccessibleStateSet() { + * toolkit.lockAWT(); try { AccessibleStateSet set = new + * AccessibleStateSet(); if (isEnabled()) { + * set.add(AccessibleState.ENABLED); } if (isFocusable()) { + * set.add(AccessibleState.FOCUSABLE); } if (hasFocus()) { + * set.add(AccessibleState.FOCUSED); } if (isOpaque()) { + * set.add(AccessibleState.OPAQUE); } if (isShowing()) { + * set.add(AccessibleState.SHOWING); } if (isVisible()) { + * set.add(AccessibleState.VISIBLE); } return set; } finally { + * toolkit.unlockAWT(); } } + * @Override public Locale getLocale() throws IllegalComponentStateException + * { toolkit.lockAWT(); try { return Component.this.getLocale(); } finally { + * toolkit.unlockAWT(); } } } + */ + /** + * The BltBufferStrategy class provides opportunity of blitting offscreen + * surfaces to a component. For more information on blitting, see Bit blit. + * + * @since Android 1.0 */ protected class BltBufferStrategy extends BufferStrategy { - - /** The back buffers. */ + + /** + * The back buffers. + */ protected VolatileImage[] backBuffers; - /** The caps. */ + /** + * The caps. + */ protected BufferCapabilities caps; - /** The width. */ + /** + * The width. + */ protected int width; - /** The height. */ + /** + * The height. + */ protected int height; - /** The validated contents. */ + /** + * The validated contents. + */ protected boolean validatedContents; /** * Instantiates a new BltBufferStrategy buffer strategy. * - * @param numBuffers the number of buffers. - * @param caps the BufferCapabilities. - * - * @throws NotImplementedException the not implemented exception. + * @param numBuffers + * the number of buffers. + * @param caps + * the BufferCapabilities. + * @throws NotImplementedException + * the not implemented exception. */ - protected BltBufferStrategy(int numBuffers, BufferCapabilities caps) throws org.apache.harmony.luni.util.NotImplementedException { + protected BltBufferStrategy(int numBuffers, BufferCapabilities caps) + throws org.apache.harmony.luni.util.NotImplementedException { if (true) { throw new RuntimeException("Method is not implemented"); //$NON-NLS-1$ } } /** - * Returns true if the drawing buffer has been lost since the last call - * to getDrawGraphics. + * Returns true if the drawing buffer has been lost since the last call + * to getDrawGraphics. * - * @return true if the drawing buffer has been lost since the last call - * to getDrawGraphics, false otherwise. - * + * @return true if the drawing buffer has been lost since the last call + * to getDrawGraphics, false otherwise. * @see java.awt.image.BufferStrategy#contentsLost() */ @Override @@ -634,9 +360,8 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali * state and reinitialized to the default background color. * * @return true if the drawing buffer has been restored from a lost - * state and reinitialized to the default background color, - * false otherwise. - * + * state and reinitialized to the default background color, + * false otherwise. * @see java.awt.image.BufferStrategy#contentsRestored() */ @Override @@ -650,7 +375,8 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali /** * Creates the back buffers. * - * @param numBuffers the number of buffers. + * @param numBuffers + * the number of buffers. */ protected void createBackBuffers(int numBuffers) { if (true) { @@ -662,19 +388,17 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali * Returns the BufferCapabilities of the buffer strategy. * * @return the BufferCapabilities. - * * @see java.awt.image.BufferStrategy#getCapabilities() */ @Override public BufferCapabilities getCapabilities() { - return (BufferCapabilities) caps.clone(); + return (BufferCapabilities)caps.clone(); } /** * Gets Graphics of current buffer strategy. * * @return the Graphics of current buffer strategy. - * * @see java.awt.image.BufferStrategy#getDrawGraphics() */ @Override @@ -708,56 +432,68 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali } /** - * The FlipBufferStrategy class is for flipping buffers on a component. + * The FlipBufferStrategy class is for flipping buffers on a component. + * + * @since Android 1.0 */ protected class FlipBufferStrategy extends BufferStrategy { - - /** The Buffer Capabilities. */ + + /** + * The Buffer Capabilities. + */ protected BufferCapabilities caps; - /** The drawing buffer. */ + /** + * The drawing buffer. + */ protected Image drawBuffer; - /** The drawing VolatileImage buffer. */ + /** + * The drawing VolatileImage buffer. + */ protected VolatileImage drawVBuffer; - /** The number of buffers. */ + /** + * The number of buffers. + */ protected int numBuffers; - /** The validated contents indicates if the drawing buffer is restored from - * lost state. */ + /** + * The validated contents indicates if the drawing buffer is restored + * from lost state. + */ protected boolean validatedContents; /** * Instantiates a new flip buffer strategy. * - * @param numBuffers the number of buffers. - * @param caps the BufferCapabilities. - * - * @throws AWTException if the capabilities supplied could not - * be supported or met. + * @param numBuffers + * the number of buffers. + * @param caps + * the BufferCapabilities. + * @throws AWTException + * if the capabilities supplied could not be supported or + * met. */ - protected FlipBufferStrategy(int numBuffers, BufferCapabilities caps) - throws AWTException { - //???AWT + protected FlipBufferStrategy(int numBuffers, BufferCapabilities caps) throws AWTException { + // ???AWT /* - if (!(Component.this instanceof Window) && !(Component.this instanceof Canvas)) { - // awt.14B=Only Canvas or Window is allowed - throw new ClassCastException(Messages.getString("awt.14B")); //$NON-NLS-1$ - } - */ + * if (!(Component.this instanceof Window) && !(Component.this + * instanceof Canvas)) { // awt.14B=Only Canvas or Window is allowed + * throw new ClassCastException(Messages.getString("awt.14B")); + * //$NON-NLS-1$ } + */ // TODO: throw new AWTException("Capabilities are not supported"); this.numBuffers = numBuffers; - this.caps = (BufferCapabilities) caps.clone(); + this.caps = (BufferCapabilities)caps.clone(); } /** - * Returns true if the drawing buffer has been lost since the last call - * to getDrawGraphics. - * - * @return true if the drawing buffer has been lost since the last call - * to getDrawGraphics, false otherwise. + * Returns true if the drawing buffer has been lost since the last call + * to getDrawGraphics. * + * @return true if the drawing buffer has been lost since the last call + * to getDrawGraphics, false otherwise. * @see java.awt.image.BufferStrategy#contentsLost() */ @Override @@ -773,9 +509,8 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali * state and reinitialized to the default background color. * * @return true if the drawing buffer has been restored from a lost - * state and reinitialized to the default background color, - * false otherwise. - * + * state and reinitialized to the default background color, + * false otherwise. * @see java.awt.image.BufferStrategy#contentsRestored() */ @Override @@ -789,14 +524,14 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali /** * Creates flipping buffers with the specified buffer capabilities. * - * @param numBuffers the number of buffers. - * @param caps the BufferCapabilities. - * - * @throws AWTException if the capabilities could not be - * supported or met. + * @param numBuffers + * the number of buffers. + * @param caps + * the BufferCapabilities. + * @throws AWTException + * if the capabilities could not be supported or met. */ - protected void createBuffers(int numBuffers, BufferCapabilities caps) - throws AWTException { + protected void createBuffers(int numBuffers, BufferCapabilities caps) throws AWTException { if (numBuffers < 2) { // awt.14C=Number of buffers must be greater than one throw new IllegalArgumentException(Messages.getString("awt.14C")); //$NON-NLS-1$ @@ -827,7 +562,8 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali /** * Flips the contents of the back buffer to the front buffer. * - * @param flipAction the flip action. + * @param flipAction + * the flip action. */ protected void flip(BufferCapabilities.FlipContents flipAction) { if (true) { @@ -851,19 +587,17 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali * Returns the BufferCapabilities of the buffer strategy. * * @return the BufferCapabilities. - * * @see java.awt.image.BufferStrategy#getCapabilities() */ @Override public BufferCapabilities getCapabilities() { - return (BufferCapabilities) caps.clone(); + return (BufferCapabilities)caps.clone(); } /** * Gets Graphics of current buffer strategy. * * @return the Graphics of current buffer strategy. - * * @see java.awt.image.BufferStrategy#getDrawGraphics() */ @Override @@ -900,14 +634,16 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali * The internal component's state utilized by the visual theme. */ class ComponentState implements State { - - /** The default minimum size. */ + + /** + * The default minimum size. + */ private Dimension defaultMinimumSize = new Dimension(); /** * Checks if the component is enabled. * - * @return true, if the component is enabled + * @return true, if the component is enabled. */ public boolean isEnabled() { return enabled; @@ -916,7 +652,7 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali /** * Checks if the component is visible. * - * @return true, if the component is visible + * @return true, if the component is visible. */ public boolean isVisible() { return visible; @@ -925,17 +661,17 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali /** * Checks if is focused. * - * @return true, if is focused + * @return true, if is focused. */ public boolean isFocused() { - //???AWT: return isFocusOwner(); + // ???AWT: return isFocusOwner(); return false; } /** * Gets the font. * - * @return the font + * @return the font. */ public Font getFont() { return Component.this.getFont(); @@ -944,7 +680,7 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali /** * Checks if the font has been set. * - * @return true, if the font has been set + * @return true, if the font has been set. */ public boolean isFontSet() { return font != null; @@ -953,7 +689,7 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali /** * Gets the background color. * - * @return the background color + * @return the background color. */ public Color getBackground() { Color c = Component.this.getBackground(); @@ -963,7 +699,7 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali /** * Checks if the background is set. * - * @return true, if the background is set + * @return true, if the background is set. */ public boolean isBackgroundSet() { return backColor != null; @@ -972,7 +708,7 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali /** * Gets the text color. * - * @return the text color + * @return the text color. */ public Color getTextColor() { Color c = getForeground(); @@ -982,7 +718,7 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali /** * Checks if the text color is set. * - * @return true, if the text color is set + * @return true, if the text color is set. */ public boolean isTextColorSet() { return foreColor != null; @@ -991,7 +727,7 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali /** * Gets the font metrics. * - * @return the font metrics + * @return the font metrics. */ @SuppressWarnings("deprecation") public FontMetrics getFontMetrics() { @@ -1001,7 +737,7 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali /** * Gets the bounding rectangle. * - * @return the bounding rectangle + * @return the bounding rectangle. */ public Rectangle getBounds() { return new Rectangle(x, y, w, h); @@ -1010,7 +746,7 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali /** * Gets the size of the bounding rectangle. * - * @return the size of the bounding rectangle + * @return the size of the bounding rectangle. */ public Dimension getSize() { return new Dimension(w, h); @@ -1019,7 +755,7 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali /** * Gets the window id. * - * @return the window id + * @return the window id. */ public long getWindowId() { NativeWindow win = getNativeWindow(); @@ -1029,7 +765,7 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali /** * Gets the default minimum size. * - * @return the default minimum size + * @return the default minimum size. */ public Dimension getDefaultMinimumSize() { if (defaultMinimumSize == null) { @@ -1041,7 +777,8 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali /** * Sets the default minimum size. * - * @param size the new default minimum size + * @param size + * the new default minimum size. */ public void setDefaultMinimumSize(Dimension size) { defaultMinimumSize = size; @@ -1062,179 +799,283 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali } } - //???AWT: private transient AccessibleContext accessibleContext; + // ???AWT: private transient AccessibleContext accessibleContext; - /** The behaviour. */ + /** + * The behaviour. + */ final transient ComponentBehavior behaviour; - //???AWT: Container parent; + // ???AWT: Container parent; - /** The name. */ + /** + * The name. + */ private String name; - /** The auto name. */ + /** + * The auto name. + */ private boolean autoName = true; - /** The font. */ + /** + * The font. + */ private Font font; - /** The back color. */ + /** + * The back color. + */ private Color backColor; - /** The fore color. */ + /** + * The fore color. + */ private Color foreColor; - /** The deprecated event handler. */ + /** + * The deprecated event handler. + */ boolean deprecatedEventHandler = true; - /** The enabled events. */ + /** + * The enabled events. + */ private long enabledEvents; - /** The enabled awt events. */ + /** + * The enabled AWT events. + */ private long enabledAWTEvents; - /** The component listeners. */ + /** + * The component listeners. + */ private final AWTListenerList componentListeners = new AWTListenerList( this); - /** The focus listeners. */ + /** + * The focus listeners. + */ private final AWTListenerList focusListeners = new AWTListenerList( this); - /** The hierarchy listeners. */ + /** + * The hierarchy listeners. + */ private final AWTListenerList hierarchyListeners = new AWTListenerList( this); - /** The hierarchy bounds listeners. */ + /** + * The hierarchy bounds listeners. + */ private final AWTListenerList hierarchyBoundsListeners = new AWTListenerList( this); - /** The key listeners. */ - private final AWTListenerList keyListeners = new AWTListenerList( - this); + /** + * The key listeners. + */ + private final AWTListenerList keyListeners = new AWTListenerList(this); - /** The mouse listeners. */ + /** + * The mouse listeners. + */ private final AWTListenerList mouseListeners = new AWTListenerList( this); - /** The mouse motion listeners. */ + /** + * The mouse motion listeners. + */ private final AWTListenerList mouseMotionListeners = new AWTListenerList( this); - /** The mouse wheel listeners. */ + /** + * The mouse wheel listeners. + */ private final AWTListenerList mouseWheelListeners = new AWTListenerList( this); - /** The input method listeners. */ + /** + * The input method listeners. + */ private final AWTListenerList inputMethodListeners = new AWTListenerList( this); - /** The x. */ + /** + * The x. + */ int x; - /** The y. */ + /** + * The y. + */ int y; - /** The w. */ + /** + * The w. + */ int w; - /** The h. */ + /** + * The h. + */ int h; - /** The maximum size. */ + /** + * The maximum size. + */ private Dimension maximumSize; - /** The minimum size. */ + /** + * The minimum size. + */ private Dimension minimumSize; - /** The preferred size. */ + /** + * The preferred size. + */ private Dimension preferredSize; - /** The bounds mask param. */ + /** + * The bounds mask param. + */ private int boundsMaskParam; - /** The ignore repaint. */ + /** + * The ignore repaint. + */ private boolean ignoreRepaint; - /** The enabled. */ + /** + * The enabled. + */ private boolean enabled = true; - /** The input methods enabled. */ + /** + * The input methods enabled. + */ private boolean inputMethodsEnabled = true; - /** The dispatch to im. */ + /** + * The dispatch to im. + */ transient boolean dispatchToIM = true; - /** The focusable. */ + /** + * The focusable. + */ private boolean focusable = true; // By default, all Components return // true from isFocusable() method - /** The visible. */ + /** + * The visible. + */ boolean visible = true; - /** The called set focusable. */ + /** + * The called set focusable. + */ private boolean calledSetFocusable; - /** The overriden is focusable. */ + /** + * The overridden is focusable. + */ private boolean overridenIsFocusable = true; - /** The focus traversal keys enabled. */ + /** + * The focus traversal keys enabled. + */ private boolean focusTraversalKeysEnabled = true; - /** Possible keys are: FORWARD_TRAVERSAL_KEYS, BACKWARD_TRAVERSAL_KEYS, UP_CYCLE_TRAVERSAL_KEYS. */ + /** + * Possible keys are: FORWARD_TRAVERSAL_KEYS, BACKWARD_TRAVERSAL_KEYS, + * UP_CYCLE_TRAVERSAL_KEYS. + */ private final Map> traversalKeys = new HashMap>(); - /** The traversal i ds. */ + /** + * The traversal i ds. + */ int[] traversalIDs; - /** The locale. */ + /** + * The locale. + */ private Locale locale; - /** The orientation. */ + /** + * The orientation. + */ private ComponentOrientation orientation; - /** The property change support. */ + /** + * The property change support. + */ private PropertyChangeSupport propertyChangeSupport; - //???AWT: private ArrayList popups; + // ???AWT: private ArrayList popups; - /** The coalescer. */ + /** + * The coalescer. + */ private boolean coalescer; - /** The events table. */ + /** + * The events table. + */ private Hashtable> eventsTable; - /** Cashed reference used during EventQueue.postEvent() */ + /** + * Cashed reference used during EventQueue.postEvent() + */ private LinkedList eventsList; - /** The hierarchy changing counter. */ + /** + * The hierarchy changing counter. + */ private int hierarchyChangingCounter; - /** The was showing. */ + /** + * The was showing. + */ private boolean wasShowing; - /** The was displayable. */ + /** + * The was displayable. + */ private boolean wasDisplayable; - /** The cursor. */ + /** + * The cursor. + */ Cursor cursor; - //???AWT: DropTarget dropTarget; + // ???AWT: DropTarget dropTarget; - /** The mouse exited expected. */ + /** + * The mouse exited expected. + */ private boolean mouseExitedExpected; - /** The repaint region. */ + /** + * The repaint region. + */ transient MultiRectArea repaintRegion; - //???AWT: transient RedrawManager redrawManager; - /** The redraw manager. */ + // ???AWT: transient RedrawManager redrawManager; + /** + * The redraw manager. + */ transient Object redrawManager; - /** The valid. */ + /** + * The valid. + */ private boolean valid; - /** The updated images. */ + /** + * The updated images. + */ private HashMap updatedImages; /** @@ -1244,7 +1085,9 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali private class ComponentLock { } - /** The component lock. */ + /** + * The component lock. + */ private final transient Object componentLock = new ComponentLock(); static { PrivilegedAction action = new PrivilegedAction() { @@ -1276,17 +1119,16 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali try { orientation = ComponentOrientation.UNKNOWN; redrawManager = null; - //???AWT + // ???AWT /* - traversalIDs = this instanceof Container ? KeyboardFocusManager.contTraversalIDs - : KeyboardFocusManager.compTraversalIDs; - for (int element : traversalIDs) { - traversalKeys.put(new Integer(element), null); - } - behaviour = createBehavior(); - */ + * traversalIDs = this instanceof Container ? + * KeyboardFocusManager.contTraversalIDs : + * KeyboardFocusManager.compTraversalIDs; for (int element : + * traversalIDs) { traversalKeys.put(new Integer(element), null); } + * behaviour = createBehavior(); + */ behaviour = null; - + deriveCoalescerFlag(); } finally { toolkit.unlockAWT(); @@ -1307,8 +1149,8 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali for (Class c = thisClass; c != Component.class; c = c.getSuperclass()) { try { coalesceMethod = c.getDeclaredMethod("coalesceEvents", new Class[] { //$NON-NLS-1$ - Class.forName("java.awt.AWTEvent"), //$NON-NLS-1$ - Class.forName("java.awt.AWTEvent") }); //$NON-NLS-1$ + Class.forName("java.awt.AWTEvent"), //$NON-NLS-1$ + Class.forName("java.awt.AWTEvent")}); //$NON-NLS-1$ } catch (Exception e) { } if (coalesceMethod != null) { @@ -1332,7 +1174,8 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali /** * Sets the name of the Component. * - * @param name the new name of the Component. + * @param name + * the new name of the Component. */ public void setName(String name) { String oldName; @@ -1367,15 +1210,15 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali /** * Auto name. * - * @return the string + * @return the string. */ String autoName() { String name = getClass().getName(); if (name.indexOf("$") != -1) { //$NON-NLS-1$ return null; } - //???AWT - //int number = toolkit.autoNumber.nextComponent++; + // ???AWT + // int number = toolkit.autoNumber.nextComponent++; int number = 0; name = name.substring(name.lastIndexOf(".") + 1) + Integer.toString(number); //$NON-NLS-1$ return name; @@ -1390,10 +1233,8 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali public String toString() { /* * The format is based on 1.5 release behavior which can be revealed by - * the following code: - * - * Component c = new Component(){}; c.setVisible(false); - * System.out.println(c); + * the following code: Component c = new Component(){}; + * c.setVisible(false); System.out.println(c); */ toolkit.lockAWT(); try { @@ -1403,32 +1244,21 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali } } - //???AWT + // ???AWT /* - public void add(PopupMenu popup) { - toolkit.lockAWT(); - try { - if (popup.getParent() == this) { - return; - } - if (popups == null) { - popups = new ArrayList(); - } - popup.setParent(this); - popups.add(popup); - } finally { - toolkit.unlockAWT(); - } - } - */ + * public void add(PopupMenu popup) { toolkit.lockAWT(); try { if + * (popup.getParent() == this) { return; } if (popups == null) { popups = + * new ArrayList(); } popup.setParent(this); popups.add(popup); } + * finally { toolkit.unlockAWT(); } } + */ /** * Returns true, if the component contains the specified Point. * - * @param p the Point. - * - * @return true, if the component contains the specified Point, - * false otherwise. + * @param p + * the Point. + * @return true, if the component contains the specified Point, false + * otherwise. */ public boolean contains(Point p) { toolkit.lockAWT(); @@ -1440,14 +1270,15 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali } /** - * Returns true, if the component contains the point with - * the specified coordinates. + * Returns true, if the component contains the point with the specified + * coordinates. * - * @param x the x coordinate. - * @param y the y coordinate. - * - * @return true, if the component contains the point with - * the specified coordinates, false otherwise. + * @param x + * the x coordinate. + * @param y + * the y coordinate. + * @return true, if the component contains the point with the specified + * coordinates, false otherwise. */ public boolean contains(int x, int y) { toolkit.lockAWT(); @@ -1462,7 +1293,6 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali * Deprecated: replaced by replaced by getSize() method. * * @return the dimension. - * * @deprecated Replaced by getSize() method. */ @Deprecated @@ -1474,90 +1304,63 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali toolkit.unlockAWT(); } } - - //???AWT + + // ???AWT /* - public Container getParent() { - toolkit.lockAWT(); - try { - return parent; - } finally { - toolkit.unlockAWT(); - } - } - */ - + * public Container getParent() { toolkit.lockAWT(); try { return parent; } + * finally { toolkit.unlockAWT(); } } + */ + /** * List. * - * @param out the out - * @param indent the indent - * + * @param out + * the out. + * @param indent + * the indent * @return the nearest heavyweight ancestor in hierarchy or - * null if not found + * null if not found. */ - //???AWT + // ???AWT /* - Component getHWAncestor() { - return (parent != null ? parent.getHWSurface() : null); - } - */ - + * Component getHWAncestor() { return (parent != null ? + * parent.getHWSurface() : null); } + */ + /** * @return heavyweight component that is equal to or is a nearest * heavyweight container of the current component, or - * null if not found + * null if not found. */ - //???AWT + // ???AWT /* - Component getHWSurface() { - Component parent; - for (parent = this; (parent != null) && (parent.isLightweight()); parent = parent - .getParent()) { - ; - } - return parent; - } + * Component getHWSurface() { Component parent; for (parent = this; (parent + * != null) && (parent.isLightweight()); parent = parent .getParent()) { ; } + * return parent; } Window getWindowAncestor() { Component par; for (par = + * this; par != null && !(par instanceof Window); par = par.getParent()) { ; + * } return (Window) par; } + */ - Window getWindowAncestor() { - Component par; - for (par = this; par != null && !(par instanceof Window); par = par.getParent()) { - ; - } - return (Window) par; - } - */ - - /** To be called by container */ - //???AWT + /** + * To be called by container + */ + // ???AWT /* - void setParent(Container parent) { - this.parent = parent; - setRedrawManager(); - } - - void setRedrawManager() { - redrawManager = getRedrawManager(); - } - - public void remove(MenuComponent menu) { - toolkit.lockAWT(); - try { - if (menu.getParent() == this) { - menu.setParent(null); - popups.remove(menu); - } - } finally { - toolkit.unlockAWT(); - } - } - */ + * void setParent(Container parent) { this.parent = parent; + * setRedrawManager(); } void setRedrawManager() { redrawManager = + * getRedrawManager(); } public void remove(MenuComponent menu) { + * toolkit.lockAWT(); try { if (menu.getParent() == this) { + * menu.setParent(null); popups.remove(menu); } } finally { + * toolkit.unlockAWT(); } } + */ /** - * Prints a list of this component with the specified number of - * leading whitespace characters to the specified PrintStream. + * Prints a list of this component with the specified number of leading + * whitespace characters to the specified PrintStream. * - * @param out the output PrintStream object. - * @param indent how many leading whitespace characters to prepend + * @param out + * the output PrintStream object. + * @param indent + * how many leading whitespace characters to prepend. */ public void list(PrintStream out, int indent) { toolkit.lockAWT(); @@ -1571,7 +1374,8 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali /** * Prints a list of this component to the specified PrintWriter. * - * @param out the output PrintWriter object. + * @param out + * the output PrintWriter object. */ public void list(PrintWriter out) { toolkit.lockAWT(); @@ -1583,11 +1387,13 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali } /** - * Prints a list of this component with the specified number of - * leading whitespace characters to the specified PrintWriter. + * Prints a list of this component with the specified number of leading + * whitespace characters to the specified PrintWriter. * - * @param out the output PrintWriter object. - * @param indent how many leading whitespace characters to prepend + * @param out + * the output PrintWriter object. + * @param indent + * how many leading whitespace characters to prepend. */ public void list(PrintWriter out, int indent) { toolkit.lockAWT(); @@ -1599,13 +1405,12 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali } /** - * Gets a string composed of the desired number of - * whitespace characters. + * Gets a string composed of the desired number of whitespace characters. * - * @param indent the length of the String to return - * - * @return the string composed of the desired number of - * whitespace characters + * @param indent + * the length of the String to return. + * @return the string composed of the desired number of whitespace + * characters. */ String getIndentStr(int indent) { char[] ind = new char[indent]; @@ -1616,9 +1421,10 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali } /** - * Prints a list of this component to the specified PrintStream + * Prints a list of this component to the specified PrintStream. * - * @param out the output PrintStream object. + * @param out + * the output PrintStream object. */ public void list(PrintStream out) { toolkit.lockAWT(); @@ -1631,8 +1437,7 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali } /** - * Prints a list of this component to the standard system - * output stream. + * Prints a list of this component to the standard system output stream. */ public void list() { toolkit.lockAWT(); @@ -1644,9 +1449,10 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali } /** - * Prints this component. + * Prints this component. * - * @param g the Graphics to be used for painting. + * @param g + * the Graphics to be used for painting. */ public void print(Graphics g) { toolkit.lockAWT(); @@ -1660,7 +1466,8 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali /** * Prints the component and all of its subcomponents. * - * @param g the Graphics to be used for painting. + * @param g + * the Graphics to be used for painting. */ public void printAll(Graphics g) { toolkit.lockAWT(); @@ -1672,11 +1479,12 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali } /** - * Sets the size of the Component specified by width and height - * parameters. + * Sets the size of the Component specified by width and height parameters. * - * @param width the width of the Component. - * @param height the height of the Component. + * @param width + * the width of the Component. + * @param height + * the height of the Component. */ public void setSize(int width, int height) { toolkit.lockAWT(); @@ -1690,7 +1498,8 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali /** * Sets the size of the Component specified by Dimension object. * - * @param d the new size of the Component. + * @param d + * the new size of the Component. */ public void setSize(Dimension d) { toolkit.lockAWT(); @@ -1704,9 +1513,10 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali /** * Deprecated: replaced by setSize(int, int) method. * - * @param width the width. - * @param height the height. - * + * @param width + * the width. + * @param height + * the height. * @deprecated Replaced by setSize(int, int) method. */ @Deprecated @@ -1723,8 +1533,8 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali /** * Deprecated: replaced by setSize(int, int) method. * - * @param size the size. - * + * @param size + * the size. * @deprecated Replaced by setSize(int, int) method. */ @Deprecated @@ -1740,8 +1550,7 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali /** * Checks whether or not this component is completely opaque. * - * @return true, if this component is completely opaque, - * false by default. + * @return true, if this component is completely opaque, false by default. */ public boolean isOpaque() { toolkit.lockAWT(); @@ -1765,7 +1574,7 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali } finally { toolkit.unlockAWT(); } - //???AWT: fireAccessibleStateChange(AccessibleState.ENABLED, false); + // ???AWT: fireAccessibleStateChange(AccessibleState.ENABLED, false); } /** @@ -1781,15 +1590,15 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali } finally { toolkit.unlockAWT(); } - //???AWT: fireAccessibleStateChange(AccessibleState.ENABLED, true); + // ???AWT: fireAccessibleStateChange(AccessibleState.ENABLED, true); } /** * Enables or disable this component. * - * @param b the boolean parameter. - * - * @deprecated Replaced by setEnabled(boolean) method. + * @param b + * the boolean parameter. + * @deprecated Replaced by setEnabled(boolean) method. */ @Deprecated public void enable(boolean b) { @@ -1809,9 +1618,9 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali * Stores the location of this component to the specified Point object; * returns the point of the component's top-left corner. * - * @param rv the Point object where the component's top-left corner - * position will be stored. - * + * @param rv + * the Point object where the component's top-left corner + * position will be stored. * @return the Point which specifies the component's top-left corner. */ public Point getLocation(Point rv) { @@ -1828,8 +1637,8 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali } /** - * Gets the location of this component on the form; - * returns the point of the component's top-left corner. + * Gets the location of this component on the form; returns the point of the + * component's top-left corner. * * @return the Point which specifies the component's top-left corner. */ @@ -1857,12 +1666,11 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali } /** - * Stores the size of this Component to the specified Dimension - * object. - * - * @param rv the Dimension object where the size of the Component - * will be stored. + * Stores the size of this Component to the specified Dimension object. * + * @param rv + * the Dimension object where the size of the Component will be + * stored. * @return the Dimension of this Component. */ public Dimension getSize(Dimension rv) { @@ -1879,9 +1687,9 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali } /** - * Checks whether or not this Component is valid. A component is valid - * if it is correctly sized and positioned within its parent container - * and all its children are also valid. + * Checks whether or not this Component is valid. A component is valid if it + * is correctly sized and positioned within its parent container and all its + * children are also valid. * * @return true, if the Component is valid, false otherwise. */ @@ -1898,7 +1706,6 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali * Deprecated: replaced by getComponentAt(int, int) method. * * @return the Point. - * * @deprecated Replaced by getComponentAt(int, int) method. */ @Deprecated @@ -1912,7 +1719,7 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali } /** - * Connects this Component to a native screen resource and makes it + * Connects this Component to a native screen resource and makes it * displayable. This method not be called directly by user applications. */ public void addNotify() { @@ -1920,11 +1727,11 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali try { prepare4HierarchyChange(); behaviour.addNotify(); - //???AWT -// finishHierarchyChange(this, parent, 0); -// if (dropTarget != null) { -// dropTarget.addNotify(peer); -// } + // ???AWT + // finishHierarchyChange(this, parent, 0); + // if (dropTarget != null) { + // dropTarget.addNotify(peer); + // } } finally { toolkit.unlockAWT(); } @@ -1933,45 +1740,32 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali /** * Map to display. * - * @param b the b + * @param b + * the b. */ void mapToDisplay(boolean b) { - //???AWT + // ???AWT /* - if (b && !isDisplayable()) { - if ((this instanceof Window) || ((parent != null) && parent.isDisplayable())) { - addNotify(); - } - } else if (!b && isDisplayable()) { - removeNotify(); - } - */ + * if (b && !isDisplayable()) { if ((this instanceof Window) || ((parent + * != null) && parent.isDisplayable())) { addNotify(); } } else if (!b + * && isDisplayable()) { removeNotify(); } + */ } /** * Gets the toolkit. * - * @return accessible context specific for particular component + * @return accessible context specific for particular component. */ - //???AWT + // ???AWT /* - AccessibleContext createAccessibleContext() { - return null; - } + * AccessibleContext createAccessibleContext() { return null; } public + * AccessibleContext getAccessibleContext() { toolkit.lockAWT(); try { if + * (accessibleContext == null) { accessibleContext = + * createAccessibleContext(); } return accessibleContext; } finally { + * toolkit.unlockAWT(); } } + */ - public AccessibleContext getAccessibleContext() { - toolkit.lockAWT(); - try { - if (accessibleContext == null) { - accessibleContext = createAccessibleContext(); - } - return accessibleContext; - } finally { - toolkit.unlockAWT(); - } - } - */ - /** * Gets Toolkit for the current Component. * @@ -1982,8 +1776,8 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali } /** - * Gets this component's locking object for AWT component tree - * and layout operations. + * Gets this component's locking object for AWT component tree and layout + * operations. * * @return the tree locking object. */ @@ -1992,12 +1786,14 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali } /** - * @param evt the Event. - * @param what the event's key. + * Handles the event. Use ActionListener instead of this. * + * @param evt + * the Event. + * @param what + * the event's key. * @return true, if successful. - * - * @deprecated Use ActionListener class for registering event listener. + * @deprecated Use ActionListener class for registering event listener. */ @Deprecated public boolean action(Event evt, Object what) { @@ -2006,11 +1802,10 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali return false; } - /** * Gets the property change support. * - * @return the property change support + * @return the property change support. */ private PropertyChangeSupport getPropertyChangeSupport() { synchronized (componentLock) { @@ -2020,36 +1815,29 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali return propertyChangeSupport; } } - - //???AWT - /* - public void addPropertyChangeListener(PropertyChangeListener listener) { - getPropertyChangeSupport().addPropertyChangeListener(listener); - } - - public void addPropertyChangeListener(String propertyName, PropertyChangeListener listener) { - getPropertyChangeSupport().addPropertyChangeListener(propertyName, listener); - } - public void applyComponentOrientation(ComponentOrientation orientation) { - toolkit.lockAWT(); - try { - setComponentOrientation(orientation); - } finally { - toolkit.unlockAWT(); - } - } - */ + // ???AWT + /* + * public void addPropertyChangeListener(PropertyChangeListener listener) { + * getPropertyChangeSupport().addPropertyChangeListener(listener); } public + * void addPropertyChangeListener(String propertyName, + * PropertyChangeListener listener) { + * getPropertyChangeSupport().addPropertyChangeListener(propertyName, + * listener); } public void applyComponentOrientation(ComponentOrientation + * orientation) { toolkit.lockAWT(); try { + * setComponentOrientation(orientation); } finally { toolkit.unlockAWT(); } + * } + */ /** - * Returns true if the set of focus traversal keys for the given focus - * traversal operation has been explicitly defined for this Component. - * - * @param id the ID of traversal key. + * Returns true if the set of focus traversal keys for the given focus + * traversal operation has been explicitly defined for this Component. * - * @return true, if the set of focus traversal keys for the given focus - * traversal operation has been explicitly defined for this Component, - * false otherwise. + * @param id + * the ID of traversal key. + * @return true, if the set of focus traversal keys for the given focus. + * traversal operation has been explicitly defined for this + * Component, false otherwise. */ public boolean areFocusTraversalKeysSet(int id) { toolkit.lockAWT(); @@ -2069,7 +1857,6 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali * Gets the bounds of the Component. * * @return the rectangle bounds of the Component. - * * @deprecated Use getBounds() methood. */ @Deprecated @@ -2083,16 +1870,20 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali } /** - * Returns the construction status of a specified image - * with the specified width and height that is being created. - * - * - * @param image the image to be checked. - * @param width the width of scaled image which status is being checked, or -1. - * @param height the height of scaled image which status is being checked, or -1. - * @param observer the ImageObserver object to be notified while - * the image is being prepared. + * Returns the construction status of a specified image with the specified + * width and height that is being created. * + * @param image + * the image to be checked. + * @param width + * the width of scaled image which status is being checked, or + * -1. + * @param height + * the height of scaled image which status is being checked, or + * -1. + * @param observer + * the ImageObserver object to be notified while the image is + * being prepared. * @return the ImageObserver flags of the current state of the image data. */ public int checkImage(Image image, int width, int height, ImageObserver observer) { @@ -2105,13 +1896,14 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali } /** - * Returns the construction status of a specified image that is being created. - * - * - * @param image the image to be checked. - * @param observer the ImageObserver object to be notified while - * the image is being prepared. + * Returns the construction status of a specified image that is being + * created. * + * @param image + * the image to be checked. + * @param observer + * the ImageObserver object to be notified while the image is + * being prepared. * @return the ImageObserver flags of the current state of the image data. */ public int checkImage(Image image, ImageObserver observer) { @@ -2126,10 +1918,11 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali /** * Coalesces the existed event with new event. * - * @param existingEvent the existing event in the EventQueue. - * @param newEvent the new event to be posted to the EventQueue. - * - * @return the coalesced AWTEvent, or null if there is no coalescing done. + * @param existingEvent + * the existing event in the EventQueue. + * @param newEvent + * the new event to be posted to the EventQueue. + * @return the coalesced AWTEvent, or null if there is no coalescing done. */ protected AWTEvent coalesceEvents(AWTEvent existingEvent, AWTEvent newEvent) { toolkit.lockAWT(); @@ -2147,7 +1940,7 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali /** * Checks if this Component is a coalescer. * - * @return true, if is coalescer + * @return true, if is coalescer. */ boolean isCoalescer() { return coalescer; @@ -2156,9 +1949,9 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali /** * Gets the relative event. * - * @param id the id - * - * @return the relative event + * @param id + * the id. + * @return the relative event. */ AWTEvent getRelativeEvent(int id) { Integer idWrapper = new Integer(id); @@ -2177,7 +1970,8 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali /** * Adds the new event. * - * @param event the event + * @param event + * the event. */ void addNewEvent(AWTEvent event) { eventsList.addLast(event); @@ -2193,7 +1987,8 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali /** * Removes the next event. * - * @param id the id + * @param id + * the id. */ void removeNextEvent(int id) { eventsTable.get(new Integer(id)).removeFirst(); @@ -2202,8 +1997,8 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali /** * Creates the image with the specified ImageProducer. * - * @param producer the ImageProducer to be used for image creation. - * + * @param producer + * the ImageProducer to be used for image creation. * @return the image with the specified ImageProducer. */ public Image createImage(ImageProducer producer) { @@ -2218,11 +2013,13 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali /** * Creates an off-screen drawable image to be used for double buffering. * - * @param width the width of the image. - * @param height the height of the image. - * - * @return the off-screen drawable image or null if the component is not - * displayable or GraphicsEnvironment.isHeadless() method returns true. + * @param width + * the width of the image. + * @param height + * the height of the image. + * @return the off-screen drawable image or null if the component is not + * displayable or GraphicsEnvironment.isHeadless() method returns + * true. */ public Image createImage(int width, int height) { toolkit.lockAWT(); @@ -2245,17 +2042,19 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali } /** - * Creates an off-screen drawable image with the specified width, - * height and ImageCapabilities. - * - * @param width the width - * @param height the height - * @param caps the ImageCapabilities. + * Creates an off-screen drawable image with the specified width, height and + * ImageCapabilities. * - * @return the volatile image - * - * @throws AWTException if an image with the specified capabilities - * cannot be created. + * @param width + * the width. + * @param height + * the height. + * @param caps + * the ImageCapabilities. + * @return the volatile image. + * @throws AWTException + * if an image with the specified capabilities cannot be + * created. */ public VolatileImage createVolatileImage(int width, int height, ImageCapabilities caps) throws AWTException { @@ -2277,16 +2076,17 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali } /** - * Creates a volatile off-screen drawable image which is used - * for double buffering. - * - * @param width the width of image. - * @param height the height of image. + * Creates a volatile off-screen drawable image which is used for double + * buffering. * - * @return the volatile image a volatile off-screen drawable image - * which is used for double buffering or null if the component - * is not displayable, or GraphicsEnvironment.isHeadless() method - * returns true. + * @param width + * the width of image. + * @param height + * the height of image. + * @return the volatile image a volatile off-screen drawable image which is + * used for double buffering or null if the component is not + * displayable, or GraphicsEnvironment.isHeadless() method returns + * true. */ public VolatileImage createVolatileImage(int width, int height) { toolkit.lockAWT(); @@ -2311,9 +2111,12 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali * with the component's background color to prepare it for double-buffered * painting. * - * @param image the image - * @param width the width - * @param height the height + * @param image + * the image. + * @param width + * the width. + * @param height + * the height. */ private void fillImageBackground(Image image, int width, int height) { Graphics gr = image.getGraphics(); @@ -2325,8 +2128,8 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali /** * Delivers event. * - * @param evt the event. - * + * @param evt + * the event. * @deprecated Replaced by dispatchEvent(AWTEvent e) method. */ @Deprecated @@ -2335,7 +2138,7 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali } /** - * Prompts the layout manager to lay out this component. + * Prompts the layout manager to lay out this component. */ public void doLayout() { toolkit.lockAWT(); @@ -2350,9 +2153,12 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali /** * Fire property change impl. * - * @param propertyName the property name - * @param oldValue the old value - * @param newValue the new value + * @param propertyName + * the property name. + * @param oldValue + * the old value. + * @param newValue + * the new value. */ private void firePropertyChangeImpl(String propertyName, Object oldValue, Object newValue) { PropertyChangeSupport pcs; @@ -2368,32 +2174,40 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali /** * Reports a bound property changes for int properties. * - * @param propertyName the property name. - * @param oldValue the old property's value. - * @param newValue the new property's value. + * @param propertyName + * the property name. + * @param oldValue + * the old property's value. + * @param newValue + * the new property's value. */ protected void firePropertyChange(String propertyName, int oldValue, int newValue) { firePropertyChangeImpl(propertyName, new Integer(oldValue), new Integer(newValue)); } /** - * Report a bound property change for a boolean-valued property. - * - * @param propertyName the property name. - * @param oldValue the property's old value. - * @param newValue the property's new value. + * Report a bound property change for a boolean-valued property. + * + * @param propertyName + * the property name. + * @param oldValue + * the property's old value. + * @param newValue + * the property's new value. */ protected void firePropertyChange(String propertyName, boolean oldValue, boolean newValue) { - firePropertyChangeImpl(propertyName, Boolean.valueOf(oldValue), Boolean - .valueOf(newValue)); + firePropertyChangeImpl(propertyName, Boolean.valueOf(oldValue), Boolean.valueOf(newValue)); } /** - * Reports a bound property change for an Object-valued property. + * Reports a bound property change for an Object-valued property. * - * @param propertyName the property name. - * @param oldValue the property's old value - * @param newValue the property's new value + * @param propertyName + * the property name. + * @param oldValue + * the property's old value. + * @param newValue + * the property's new value. */ protected void firePropertyChange(final String propertyName, final Object oldValue, final Object newValue) { @@ -2401,75 +2215,93 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali } /** - * Report a bound property change for a byte-valued property. + * Report a bound property change for a byte-valued property. * - * @param propertyName the property name. - * @param oldValue the property's old value. - * @param newValue the property's new value. + * @param propertyName + * the property name. + * @param oldValue + * the property's old value. + * @param newValue + * the property's new value. */ public void firePropertyChange(String propertyName, byte oldValue, byte newValue) { firePropertyChangeImpl(propertyName, new Byte(oldValue), new Byte(newValue)); } /** - * Report a bound property change for a char-valued property. + * Report a bound property change for a char-valued property. * - * @param propertyName the property name. - * @param oldValue the old property's value. - * @param newValue the new property's value. + * @param propertyName + * the property name. + * @param oldValue + * the old property's value. + * @param newValue + * the new property's value. */ public void firePropertyChange(String propertyName, char oldValue, char newValue) { firePropertyChangeImpl(propertyName, new Character(oldValue), new Character(newValue)); } /** - * Report a bound property change for a short-valued property. + * Report a bound property change for a short-valued property. * - * @param propertyName the property name. - * @param oldValue the old property's value. - * @param newValue the new property's value. + * @param propertyName + * the property name. + * @param oldValue + * the old property's value. + * @param newValue + * the new property's value. */ public void firePropertyChange(String propertyName, short oldValue, short newValue) { firePropertyChangeImpl(propertyName, new Short(oldValue), new Short(newValue)); } /** - * Report a bound property change for a long-valued property. + * Report a bound property change for a long-valued property. * - * @param propertyName the property name. - * @param oldValue the old property's value. - * @param newValue the new property's value. + * @param propertyName + * the property name. + * @param oldValue + * the old property's value. + * @param newValue + * the new property's value. */ public void firePropertyChange(String propertyName, long oldValue, long newValue) { firePropertyChangeImpl(propertyName, new Long(oldValue), new Long(newValue)); } /** - * Report a bound property change for a float-valued property. + * Report a bound property change for a float-valued property. * - * @param propertyName the property name. - * @param oldValue the old property's value. - * @param newValue the new property's value. + * @param propertyName + * the property name. + * @param oldValue + * the old property's value. + * @param newValue + * the new property's value. */ public void firePropertyChange(String propertyName, float oldValue, float newValue) { firePropertyChangeImpl(propertyName, new Float(oldValue), new Float(newValue)); } /** - * Report a bound property change for a double-valued property. + * Report a bound property change for a double-valued property. * - * @param propertyName the property name. - * @param oldValue the old property's value. - * @param newValue the new property's value. + * @param propertyName + * the property name. + * @param oldValue + * the old property's value. + * @param newValue + * the new property's value. */ public void firePropertyChange(String propertyName, double oldValue, double newValue) { firePropertyChangeImpl(propertyName, new Double(oldValue), new Double(newValue)); } /** - * Gets the alignment along the x axis. + * Gets the alignment along the x axis. * - * @return the alignment along the x axis. + * @return the alignment along the x axis. */ public float getAlignmentX() { toolkit.lockAWT(); @@ -2481,7 +2313,7 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali } /** - * Gets the alignment along the y axis. + * Gets the alignment along the y axis. * * @return the alignment along y axis. */ @@ -2502,12 +2334,11 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali public Color getBackground() { toolkit.lockAWT(); try { - //???AWT + // ???AWT /* - if ((backColor == null) && (parent != null)) { - return parent.getBackground(); - } - */ + * if ((backColor == null) && (parent != null)) { return + * parent.getBackground(); } + */ return backColor; } finally { toolkit.unlockAWT(); @@ -2529,11 +2360,12 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali } /** - * Writes the data of the bounding rectangle to the specified - * Rectangle object. - * - * @param rv the Rectangle object where the bounding rectangle's data is stored. + * Writes the data of the bounding rectangle to the specified Rectangle + * object. * + * @param rv + * the Rectangle object where the bounding rectangle's data is + * stored. * @return the bounding rectangle. */ public Rectangle getBounds(Rectangle rv) { @@ -2566,8 +2398,8 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali /** * Gets the Component which contains the specified Point. * - * @param p the Point. - * + * @param p + * the Point. * @return the Component which contains the specified Point. */ public Component getComponentAt(Point p) { @@ -2580,14 +2412,15 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali } /** - * Gets the Component which contains the point with the - * specified coordinates. - * - * @param x the x coordinate of the point. - * @param y the y coordinate of the point. + * Gets the Component which contains the point with the specified + * coordinates. * - * @return the Component which contains the point with the - * specified coordinates. + * @param x + * the x coordinate of the point. + * @param y + * the y coordinate of the point. + * @return the Component which contains the point with the specified + * coordinates. */ public Component getComponentAt(int x, int y) { toolkit.lockAWT(); @@ -2622,11 +2455,10 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali try { if (cursor != null) { return cursor; - //???AWT - /* - } else if (parent != null) { - return parent.getCursor(); - */ + // ???AWT + /* + * } else if (parent != null) { return parent.getCursor(); + */ } return Cursor.getDefaultCursor(); } finally { @@ -2634,57 +2466,29 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali } } - //???AWT + // ???AWT /* - public DropTarget getDropTarget() { - toolkit.lockAWT(); - try { - return dropTarget; - } finally { - toolkit.unlockAWT(); - } - } - - public Container getFocusCycleRootAncestor() { - toolkit.lockAWT(); - try { - for (Container c = parent; c != null; c = c.getParent()) { - if (c.isFocusCycleRoot()) { - return c; - } - } - return null; - } finally { - toolkit.unlockAWT(); - } - } - - @SuppressWarnings("unchecked") - public Set getFocusTraversalKeys(int id) { - toolkit.lockAWT(); - try { - Integer kId = new Integer(id); - KeyboardFocusManager.checkTraversalKeysID(traversalKeys, kId); - Set keys = traversalKeys.get(kId); - if (keys == null && parent != null) { - keys = parent.getFocusTraversalKeys(id); - } - if (keys == null) { - keys = KeyboardFocusManager.getCurrentKeyboardFocusManager() - .getDefaultFocusTraversalKeys(id); - } - return (Set) keys; - } finally { - toolkit.unlockAWT(); - } - } - */ - + * public DropTarget getDropTarget() { toolkit.lockAWT(); try { return + * dropTarget; } finally { toolkit.unlockAWT(); } } public Container + * getFocusCycleRootAncestor() { toolkit.lockAWT(); try { for (Container c = + * parent; c != null; c = c.getParent()) { if (c.isFocusCycleRoot()) { + * return c; } } return null; } finally { toolkit.unlockAWT(); } } + * @SuppressWarnings("unchecked") public Set + * getFocusTraversalKeys(int id) { toolkit.lockAWT(); try { Integer kId = + * new Integer(id); KeyboardFocusManager.checkTraversalKeysID(traversalKeys, + * kId); Set keys = traversalKeys.get(kId); if (keys + * == null && parent != null) { keys = parent.getFocusTraversalKeys(id); } + * if (keys == null) { keys = + * KeyboardFocusManager.getCurrentKeyboardFocusManager() + * .getDefaultFocusTraversalKeys(id); } return (Set) keys; } + * finally { toolkit.unlockAWT(); } } + */ + /** * Checks if the the focus traversal keys are enabled for this component. * - * @return true, if the the focus traversal keys are enabled for - * this component, false otherwise. + * @return true, if the the focus traversal keys are enabled for this + * component, false otherwise. */ public boolean getFocusTraversalKeysEnabled() { toolkit.lockAWT(); @@ -2698,8 +2502,8 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali /** * Gets the font metrics of the specified Font. * - * @param f the Font. - * + * @param f + * the Font. * @return the FontMetrics of the specified Font. */ @SuppressWarnings("deprecation") @@ -2715,12 +2519,11 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali public Color getForeground() { toolkit.lockAWT(); try { - //???AWT + // ???AWT /* - if (foreColor == null && parent != null) { - return parent.getForeground(); - } - */ + * if (foreColor == null && parent != null) { return + * parent.getForeground(); } + */ return foreColor; } finally { toolkit.unlockAWT(); @@ -2728,11 +2531,11 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali } /** - * Gets the Graphics of the Component or null if this Component - * is not displayable. + * Gets the Graphics of the Component or null if this Component is not + * displayable. * - * @return the Graphics of the Component or null if this Component - * is not displayable. + * @return the Graphics of the Component or null if this Component is not + * displayable. */ public Graphics getGraphics() { toolkit.lockAWT(); @@ -2749,26 +2552,18 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali } } - /** * Gets the GraphicsConfiguration associated with this Component. * * @return the GraphicsConfiguration associated with this Component. */ public GraphicsConfiguration getGraphicsConfiguration() { - //???AWT + // ???AWT /* - toolkit.lockAWT(); - try { - Window win = getWindowAncestor(); - if (win == null) { - return null; - } - return win.getGraphicsConfiguration(); - } finally { - toolkit.unlockAWT(); - } - */ + * toolkit.lockAWT(); try { Window win = getWindowAncestor(); if (win == + * null) { return null; } return win.getGraphicsConfiguration(); } + * finally { toolkit.unlockAWT(); } + */ return null; } @@ -2787,11 +2582,11 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali } /** - * Returns true if paint messages received from the operating system - * should be ignored. + * Returns true if paint messages received from the operating system should + * be ignored. * - * @return true if paint messages received from the operating system - * should be ignored, false otherwise. + * @return true if paint messages received from the operating system should + * be ignored, false otherwise. */ public boolean getIgnoreRepaint() { toolkit.lockAWT(); @@ -2803,23 +2598,20 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali } /** - * Gets the input context of this component for handling - * the communication with input methods when text is entered - * in this component. + * Gets the input context of this component for handling the communication + * with input methods when text is entered in this component. * - * @return the InputContext used by this Component or - * null if no context is specifined. + * @return the InputContext used by this Component or null if no context is + * specifined. */ public InputContext getInputContext() { toolkit.lockAWT(); try { - //???AWT + // ???AWT /* - Container parent = getParent(); - if (parent != null) { - return parent.getInputContext(); - } - */ + * Container parent = getParent(); if (parent != null) { return + * parent.getInputContext(); } + */ return null; } finally { toolkit.unlockAWT(); @@ -2827,11 +2619,11 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali } /** - * Gets the input method request handler which supports requests - * from input methods for this component, or null for default. + * Gets the input method request handler which supports requests from input + * methods for this component, or null for default. * - * @return the input method request handler which supports requests - * from input methods for this component, or null for default. + * @return the input method request handler which supports requests from + * input methods for this component, or null for default. */ public InputMethodRequests getInputMethodRequests() { return null; @@ -2845,19 +2637,14 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali public Locale getLocale() { toolkit.lockAWT(); try { - //???AWT + // ???AWT /* - if (locale == null) { - if (parent == null) { - if (this instanceof Window) { - return Locale.getDefault(); - } - // awt.150=no parent - throw new IllegalComponentStateException(Messages.getString("awt.150")); //$NON-NLS-1$ - } - return getParent().getLocale(); - } - */ + * if (locale == null) { if (parent == null) { if (this instanceof + * Window) { return Locale.getDefault(); } // awt.150=no parent + * throw new + * IllegalComponentStateException(Messages.getString("awt.150")); + * //$NON-NLS-1$ } return getParent().getLocale(); } + */ return locale; } finally { toolkit.unlockAWT(); @@ -2865,35 +2652,30 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali } /** - * Gets the location of this component in the form of a point - * specifying the component's top-left corner in the - * screen's coordinate space. + * Gets the location of this component in the form of a point specifying the + * component's top-left corner in the screen's coordinate space. * - * @return the Point giving the component's location in the - * screen's coordinate space. - * - * @throws IllegalComponentStateException if the component is - * not shown on the screen. + * @return the Point giving the component's location in the screen's + * coordinate space. + * @throws IllegalComponentStateException + * if the component is not shown on the screen. */ public Point getLocationOnScreen() throws IllegalComponentStateException { toolkit.lockAWT(); try { Point p = new Point(); if (isShowing()) { - //???AWT + // ???AWT /* - Component comp; - for (comp = this; comp != null && !(comp instanceof Window); comp = comp - .getParent()) { - p.translate(comp.getX(), comp.getY()); - } - if (comp instanceof Window) { - p.translate(comp.getX(), comp.getY()); - } - */ + * Component comp; for (comp = this; comp != null && !(comp + * instanceof Window); comp = comp .getParent()) { + * p.translate(comp.getX(), comp.getY()); } if (comp instanceof + * Window) { p.translate(comp.getX(), comp.getY()); } + */ return p; } - // awt.151=component must be showing on the screen to determine its location + // awt.151=component must be showing on the screen to determine its + // location throw new IllegalComponentStateException(Messages.getString("awt.151")); //$NON-NLS-1$ } finally { toolkit.unlockAWT(); @@ -2901,11 +2683,10 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali } /** - * Gets the peer. This method should not be called directly by - * user applications. + * Gets the peer. This method should not be called directly by user + * applications. * * @return the ComponentPeer. - * * @deprecated Replaced by isDisplayable(). */ @Deprecated @@ -2922,24 +2703,24 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali } /** - * Gets an array of the property change listeners registered to - * this Component. + * Gets an array of the property change listeners registered to this + * Component. * - * @return an array of the PropertyChangeListeners registered to - * this Component. + * @return an array of the PropertyChangeListeners registered to this + * Component. */ public PropertyChangeListener[] getPropertyChangeListeners() { return getPropertyChangeSupport().getPropertyChangeListeners(); } /** - * Gets an array of PropertyChangeListener objects registered - * to this Component for the specified property. + * Gets an array of PropertyChangeListener objects registered to this + * Component for the specified property. * - * @param propertyName the property name. - * - * @return an array of PropertyChangeListener objects registered - * to this Component for the specified property. + * @param propertyName + * the property name. + * @return an array of PropertyChangeListener objects registered to this + * Component for the specified property. */ public PropertyChangeListener[] getPropertyChangeListeners(String propertyName) { return getPropertyChangeSupport().getPropertyChangeListeners(propertyName); @@ -2990,11 +2771,11 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali /** * Got the focus. * - * @param evt the Event. - * @param what the Object. - * + * @param evt + * the Event. + * @param what + * the Object. * @return true, if successful. - * * @deprecated Replaced by processFocusEvent(FocusEvent) method. */ @Deprecated @@ -3007,10 +2788,9 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali /** * Handles event. * - * @param evt the Event. - * + * @param evt + * the Event. * @return true, if successful. - * * @deprecated Replaced by processEvent(AWTEvent) method. */ @Deprecated @@ -3052,7 +2832,7 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali public boolean hasFocus() { toolkit.lockAWT(); try { - //???AWT: return isFocusOwner(); + // ???AWT: return isFocusOwner(); return false; } finally { toolkit.unlockAWT(); @@ -3076,24 +2856,24 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali moveFocusOnHide(); behaviour.setVisible(false); postEvent(new ComponentEvent(this, ComponentEvent.COMPONENT_HIDDEN)); - //???AWT: finishHierarchyChange(this, parent, 0); + // ???AWT: finishHierarchyChange(this, parent, 0); notifyInputMethod(null); - //???AWT: invalidateRealParent(); + // ???AWT: invalidateRealParent(); } finally { toolkit.unlockAWT(); } } /** - * Checks whether or not the point with the specified coordinates - * belongs to the Commponent. - * - * @param x the x coordinate of the Point. - * @param y the y coordinate of the Point. - * - * @return true, if the point with the specified coordinates - * belongs to the Commponent, false otherwise. + * Checks whether or not the point with the specified coordinates belongs to + * the Commponent. * + * @param x + * the x coordinate of the Point. + * @param y + * the y coordinate of the Point. + * @return true, if the point with the specified coordinates belongs to the + * Commponent, false otherwise. * @deprecated Replaced by contains(int, int) method. */ @Deprecated @@ -3107,15 +2887,15 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali } /** - * Invalidates the component, this component and all parents - * above it are marked as needing to be laid out. + * Invalidates the component, this component and all parents above it are + * marked as needing to be laid out. */ public void invalidate() { toolkit.lockAWT(); try { valid = false; resetDefaultSize(); - //???AWT: invalidateRealParent(); + // ???AWT: invalidateRealParent(); } finally { toolkit.unlockAWT(); } @@ -3124,8 +2904,8 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali /** * Checks whether or not the background color is set to this Component. * - * @return true, if the background color is set to this Component, - * false otherwise. + * @return true, if the background color is set to this Component, false + * otherwise. */ public boolean isBackgroundSet() { toolkit.lockAWT(); @@ -3139,8 +2919,7 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali /** * Checks whether or not a cursor is set for the Component. * - * @return true, if a cursor is set for the Component, - * false otherwise. + * @return true, if a cursor is set for the Component, false otherwise. */ public boolean isCursorSet() { toolkit.lockAWT(); @@ -3166,11 +2945,11 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali } /** - * Checks whether or not this component is painted to an buffer - * which is copied to the screen later. + * Checks whether or not this component is painted to an buffer which is + * copied to the screen later. * - * @return true, if this component is painted to an buffer - * which is copied to the screen later, false otherwise. + * @return true, if this component is painted to an buffer which is copied + * to the screen later, false otherwise. */ public boolean isDoubleBuffered() { toolkit.lockAWT(); @@ -3200,7 +2979,7 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali * "Recursive" isEnabled(). * * @return true if not only component itself is enabled but its heavyweight - * parent is also "indirectly" enabled + * parent is also "indirectly" enabled. */ boolean isIndirectlyEnabled() { Component comp = this; @@ -3208,7 +2987,7 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali if (!comp.isLightweight() && !comp.isEnabled()) { return false; } - //???AWT: comp = comp.getRealParent(); + // ???AWT: comp = comp.getRealParent(); } return true; } @@ -3216,7 +2995,7 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali /** * Checks if the component is key enabled. * - * @return true, if the component is enabled and indirectly enabled + * @return true, if the component is enabled and indirectly enabled. */ boolean isKeyEnabled() { if (!isEnabled()) { @@ -3229,39 +3008,24 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali * Gets only parent of a child component, but not owner of a window. * * @return parent of child component, null if component is a top-level - * (Window instance) + * (Window instance). */ - //???AWT + // ???AWT /* - Container getRealParent() { - return (!(this instanceof Window) ? getParent() : null); - } - - public boolean isFocusCycleRoot(Container container) { - toolkit.lockAWT(); - try { - return getFocusCycleRootAncestor() == container; - } finally { - toolkit.unlockAWT(); - } - } + * Container getRealParent() { return (!(this instanceof Window) ? + * getParent() : null); } public boolean isFocusCycleRoot(Container + * container) { toolkit.lockAWT(); try { return getFocusCycleRootAncestor() + * == container; } finally { toolkit.unlockAWT(); } } public boolean + * isFocusOwner() { toolkit.lockAWT(); try { return + * KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner() == + * this; } finally { toolkit.unlockAWT(); } } + */ - public boolean isFocusOwner() { - toolkit.lockAWT(); - try { - return KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner() == this; - } finally { - toolkit.unlockAWT(); - } - } - */ - /** * Checks whether or not this Component can be focusable. * * @return true, if this Component can be focusable, false otherwise. - * - * @deprecated Replaced by isFocusable(). + * @deprecated Replaced by isFocusable(). */ @Deprecated public boolean isFocusTraversable() { @@ -3306,8 +3070,8 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali /** * Checks if foreground color is set for the Component or not. * - * @return true, if is foreground color is set for the Component, - * false otherwise. + * @return true, if is foreground color is set for the Component, false + * otherwise. */ public boolean isForegroundSet() { toolkit.lockAWT(); @@ -3321,8 +3085,8 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali /** * Returns true if this component has a lightweight peer. * - * @return true, if this component has a lightweight peer, - * false if it has a native peer or no peer. + * @return true, if this component has a lightweight peer, false if it has a + * native peer or no peer. */ public boolean isLightweight() { toolkit.lockAWT(); @@ -3333,22 +3097,18 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali } } - /** * Checks whether or not this Component is shown. * * @return true, if this Component is shown, false otherwise. */ public boolean isShowing() { - //???AWT + // ???AWT /* - toolkit.lockAWT(); - try { - return (isVisible() && isDisplayable() && (parent != null) && parent.isShowing()); - } finally { - toolkit.unlockAWT(); - } - */ + * toolkit.lockAWT(); try { return (isVisible() && isDisplayable() && + * (parent != null) && parent.isShowing()); } finally { + * toolkit.unlockAWT(); } + */ return false; } @@ -3369,11 +3129,11 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali /** * Deprecated: replaced by processKeyEvent(KeyEvent) method. * - * @param evt the Event. - * @param key the key code. - * + * @param evt + * the Event. + * @param key + * the key code. * @return true, if successful. - * * @deprecated Replaced by replaced by processKeyEvent(KeyEvent) method. */ @Deprecated @@ -3386,11 +3146,11 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali /** * Deprecated: replaced by processKeyEvent(KeyEvent) method. * - * @param evt the Event. - * @param key the key code. - * + * @param evt + * the Event. + * @param key + * the key code. * @return true, if successful. - * * @deprecated Replaced by processKeyEvent(KeyEvent) method. */ @Deprecated @@ -3418,11 +3178,11 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali /** * Deprecated: replaced by getComponentAt(int, int) method. * - * @param x the x coordinate. - * @param y the y coordinate. - * + * @param x + * the x coordinate. + * @param y + * the y coordinate. * @return The component. - * * @deprecated Replaced by getComponentAt(int, int) method. */ @Deprecated @@ -3439,13 +3199,13 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali } /** - * Deprecated: replaced by processFocusEvent(FocusEvent). - * - * @param evt the Event. - * @param what the Object. + * Deprecated: replaced by processFocusEvent(FocusEvent). * + * @param evt + * the Event. + * @param what + * the Object. * @return true, if successful. - * * @deprecated Replaced by processFocusEvent(FocusEvent). */ @Deprecated @@ -3458,12 +3218,13 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali /** * Deprecated: replaced by processMouseEvent(MouseEvent) method. * - * @param evt the MouseEvent. - * @param x the x coordinate. - * @param y the y coordinate. - * + * @param evt + * the MouseEvent. + * @param x + * the x coordinate. + * @param y + * the y coordinate. * @return true, if successful. - * * @deprecated Replaced by processMouseEvent(MouseEvent) method. */ @Deprecated @@ -3476,12 +3237,13 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali /** * Deprecated: replaced by getMinimumSize() method. * - * @param evt the Event. - * @param x the x coordinate. - * @param y the y coordinate. - * + * @param evt + * the Event. + * @param x + * the x coordinate. + * @param y + * the y coordinate. * @return true, if successful. - * * @deprecated Replaced by getMinimumSize() method. */ @Deprecated @@ -3494,12 +3256,13 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali /** * Replaced by processMouseEvent(MouseEvent) method. * - * @param evt the Event. - * @param x the x coordinate. - * @param y the y coordinate. - * + * @param evt + * the Event. + * @param x + * the x coordinate. + * @param y + * the y coordinate. * @return true, if successful. - * * @deprecated replaced by processMouseEvent(MouseEvent) method. */ @Deprecated @@ -3512,12 +3275,13 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali /** * Replaced by processMouseEvent(MouseEvent) method. * - * @param evt the Event. - * @param x the x coordinate. - * @param y the y coordinate. - * + * @param evt + * the Event. + * @param x + * the x coordinate. + * @param y + * the y coordinate. * @return true, if successful. - * * @deprecated Replaced by processMouseEvent(MouseEvent) method. */ @Deprecated @@ -3530,12 +3294,13 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali /** * Replaced by processMouseEvent(MouseEvent) method. * - * @param evt the Event. - * @param x the x coordinate. - * @param y the y coordinate. - * + * @param evt + * the Event. + * @param x + * the x coordinate. + * @param y + * the y coordinate. * @deprecated Replaced by processMouseEvent(MouseEvent) method. - * * @return true, if successful. */ @Deprecated @@ -3548,12 +3313,13 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali /** * Replaced by processMouseEvent(MouseEvent) method. * - * @param evt the Event. - * @param x the x coordinate. - * @param y the y coordinate. - * + * @param evt + * the Event. + * @param x + * the x coordinate. + * @param y + * the y coordinate. * @return true, if successful. - * * @deprecated Replaced by processMouseEvent(MouseEvent) method. */ @Deprecated @@ -3566,9 +3332,10 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali /** * Deprecated: replaced by setLocation(int, int) method. * - * @param x the x coordinates. - * @param y the y coordinates. - * + * @param x + * the x coordinates. + * @param y + * the y coordinates. * @deprecated Replaced by setLocation(int, int) method. */ @Deprecated @@ -3582,18 +3349,12 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali } } - //???AWT + // ???AWT /* - @Deprecated - public void nextFocus() { - toolkit.lockAWT(); - try { - transferFocus(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS); - } finally { - toolkit.unlockAWT(); - } - } - */ + * @Deprecated public void nextFocus() { toolkit.lockAWT(); try { + * transferFocus(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS); } finally { + * toolkit.unlockAWT(); } } + */ /** * Returns a string representation of the component's state. @@ -3603,10 +3364,8 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali protected String paramString() { /* * The format is based on 1.5 release behavior which can be revealed by - * the following code: - * - * Component c = new Component(){}; c.setVisible(false); - * System.out.println(c); + * the following code: Component c = new Component(){}; + * c.setVisible(false); System.out.println(c); */ toolkit.lockAWT(); try { @@ -3624,35 +3383,27 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali if (handled) { return true; } - //???AWT + // ???AWT /* - - // propagate non-handled events up to parent - Component par = parent; - // try to call postEvent only on components which - // override any of deprecated method handlers - // while (par != null && !par.deprecatedEventHandler) { - // par = par.parent; - // } - // translate event coordinates before posting it to parent - if (par != null) { - evt.translate(x, y); - par.postEvent(evt); - } - - */ + * // propagate non-handled events up to parent Component par = parent; + * // try to call postEvent only on components which // override any of + * deprecated method handlers // while (par != null && + * !par.deprecatedEventHandler) { // par = par.parent; // } // translate + * event coordinates before posting it to parent if (par != null) { + * evt.translate(x, y); par.postEvent(evt); } + */ return false; } /** - * Prepares an image for rendering on the Component. - * - * @param image the Image to be prepared. - * @param observer the ImageObserver object to be notified as soon as - * the image is prepared. + * Prepares an image for rendering on the Component. * - * @return true if the image has been fully prepared, - * false otherwise. + * @param image + * the Image to be prepared. + * @param observer + * the ImageObserver object to be notified as soon as the image + * is prepared. + * @return true if the image has been fully prepared, false otherwise. */ public boolean prepareImage(Image image, ImageObserver observer) { toolkit.lockAWT(); @@ -3664,17 +3415,19 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali } /** - * Prepares an image for rendering on the Component with the - * specified width, height, and ImageObserver. + * Prepares an image for rendering on the Component with the specified + * width, height, and ImageObserver. * - * @param image the Image to be prepared. - * @param width the width of scaled image. - * @param height the height of scaled height. - * @param observer the ImageObserver object to be notified as soon as - * the image is prepared. - * - * @return true if the image is been fully prepared, - * false otherwise. + * @param image + * the Image to be prepared. + * @param width + * the width of scaled image. + * @param height + * the height of scaled height. + * @param observer + * the ImageObserver object to be notified as soon as the image + * is prepared. + * @return true if the image is been fully prepared, false otherwise. */ public boolean prepareImage(Image image, int width, int height, ImageObserver observer) { toolkit.lockAWT(); @@ -3691,16 +3444,14 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali public void removeNotify() { toolkit.lockAWT(); try { - //???AWT + // ???AWT /* - if (dropTarget != null) { - dropTarget.removeNotify(peer); - } - */ + * if (dropTarget != null) { dropTarget.removeNotify(peer); } + */ prepare4HierarchyChange(); - ///???AWT: moveFocus(); + // /???AWT: moveFocus(); behaviour.removeNotify(); - //???AWT: finishHierarchyChange(this, parent, 0); + // ???AWT: finishHierarchyChange(this, parent, 0); removeNotifyInputContext(); } finally { toolkit.unlockAWT(); @@ -3708,7 +3459,7 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali } /** - * Calls InputContext.removeNotify + * Calls InputContext.removeNotify. */ private void removeNotifyInputContext() { if (!inputMethodsEnabled) { @@ -3716,7 +3467,7 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali } InputContext ic = getInputContext(); if (ic != null) { - //???AWT: ic.removeNotify(this); + // ???AWT: ic.removeNotify(this); } } @@ -3726,46 +3477,25 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali * setFocusable(false) is called, and therefore automatic forward focus * traversal is necessary */ - //???AWT + // ???AWT /* - void moveFocus() { - // don't use transferFocus(), but query focus traversal policy directly - // and if it returns null, transfer focus up cycle - // and find next focusable component there - KeyboardFocusManager kfm = KeyboardFocusManager.getCurrentKeyboardFocusManager(); - Container root = kfm.getCurrentFocusCycleRoot(); - Component nextComp = this; - boolean success = !isFocusOwner(); - while (!success) { - if (root != nextComp.getFocusCycleRootAncestor()) { - // component was probably removed from container - // so focus will be lost in some time - return; - } - nextComp = root.getFocusTraversalPolicy().getComponentAfter(root, nextComp); - if (nextComp == this) { - nextComp = null; // avoid looping - } - if (nextComp != null) { - success = nextComp.requestFocusInWindow(); - } else { - nextComp = root; - root = root.getFocusCycleRootAncestor(); - // if no acceptable component is found at all - clear global - // focus owner - if (root == null) { - if (nextComp instanceof Window) { - Window wnd = (Window) nextComp; - wnd.setFocusOwner(null); - wnd.setRequestedFocus(null); - } - kfm.clearGlobalFocusOwner(); - return; - } - } - } - } - */ + * void moveFocus() { // don't use transferFocus(), but query focus + * traversal policy directly // and if it returns null, transfer focus up + * cycle // and find next focusable component there KeyboardFocusManager kfm + * = KeyboardFocusManager.getCurrentKeyboardFocusManager(); Container root = + * kfm.getCurrentFocusCycleRoot(); Component nextComp = this; boolean + * success = !isFocusOwner(); while (!success) { if (root != + * nextComp.getFocusCycleRootAncestor()) { // component was probably removed + * from container // so focus will be lost in some time return; } nextComp = + * root.getFocusTraversalPolicy().getComponentAfter(root, nextComp); if + * (nextComp == this) { nextComp = null; // avoid looping } if (nextComp != + * null) { success = nextComp.requestFocusInWindow(); } else { nextComp = + * root; root = root.getFocusCycleRootAncestor(); // if no acceptable + * component is found at all - clear global // focus owner if (root == null) + * { if (nextComp instanceof Window) { Window wnd = (Window) nextComp; + * wnd.setFocusOwner(null); wnd.setRequestedFocus(null); } + * kfm.clearGlobalFocusOwner(); return; } } } } + */ /** * For Container there's a difference between moving focus when being made @@ -3774,80 +3504,73 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali * setVisible() is not called. */ void moveFocusOnHide() { - //???AWT: moveFocus(); + // ???AWT: moveFocus(); } /** * Removes the property change listener registered for this component. * - * @param listener the PropertyChangeListener. + * @param listener + * the PropertyChangeListener. */ public void removePropertyChangeListener(PropertyChangeListener listener) { getPropertyChangeSupport().removePropertyChangeListener(listener); } /** - * Removes the property change listener registered fot this component - * for the specified propertyy. + * Removes the property change listener registered fot this component for + * the specified propertyy. * - * @param propertyName the property name. - * @param listener the PropertyChangeListener. + * @param propertyName + * the property name. + * @param listener + * the PropertyChangeListener. */ - public void removePropertyChangeListener(String propertyName, - PropertyChangeListener listener) { + public void removePropertyChangeListener(String propertyName, PropertyChangeListener listener) { getPropertyChangeSupport().removePropertyChangeListener(propertyName, listener); } - /** - * Repaints the specified rectangle of this component within - * tm milliseconds. + * Repaints the specified rectangle of this component within tm + * milliseconds. * - * @param tm the time in milliseconds before updating. - * @param x the x coordinate of Rectangle. - * @param y the y coordinate of Rectangle. - * @param width the width of Rectangle. - * @param height the height of Rectangle. + * @param tm + * the time in milliseconds before updating. + * @param x + * the x coordinate of Rectangle. + * @param y + * the y coordinate of Rectangle. + * @param width + * the width of Rectangle. + * @param height + * the height of Rectangle. */ public void repaint(long tm, int x, int y, int width, int height) { - //???AWT + // ???AWT /* - toolkit.lockAWT(); - try { - if (width <= 0 || height <= 0 || (redrawManager == null) || !isShowing()) { - return; - } - if (behaviour instanceof LWBehavior) { - if (parent == null || !parent.visible || !parent.behaviour.isDisplayable()) { - return; - } - if (repaintRegion == null) { - repaintRegion = new MultiRectArea(new Rectangle(x, y, width, height)); - } - repaintRegion.intersect(new Rectangle(0, 0, this.w, this.h)); - repaintRegion.translate(this.x, this.y); - parent.repaintRegion = repaintRegion; - repaintRegion = null; - parent.repaint(tm, x + this.x, y + this.y, width, height); - } else { - if (repaintRegion != null) { - redrawManager.addUpdateRegion(this, repaintRegion); - repaintRegion = null; - } else { - redrawManager.addUpdateRegion(this, new Rectangle(x, y, width, height)); - } - toolkit.getSystemEventQueueCore().notifyEventMonitor(toolkit); - } - } finally { - toolkit.unlockAWT(); - } - */ + * toolkit.lockAWT(); try { if (width <= 0 || height <= 0 || + * (redrawManager == null) || !isShowing()) { return; } if (behaviour + * instanceof LWBehavior) { if (parent == null || !parent.visible || + * !parent.behaviour.isDisplayable()) { return; } if (repaintRegion == + * null) { repaintRegion = new MultiRectArea(new Rectangle(x, y, width, + * height)); } repaintRegion.intersect(new Rectangle(0, 0, this.w, + * this.h)); repaintRegion.translate(this.x, this.y); + * parent.repaintRegion = repaintRegion; repaintRegion = null; + * parent.repaint(tm, x + this.x, y + this.y, width, height); } else { + * if (repaintRegion != null) { redrawManager.addUpdateRegion(this, + * repaintRegion); repaintRegion = null; } else { + * redrawManager.addUpdateRegion(this, new Rectangle(x, y, width, + * height)); } + * toolkit.getSystemEventQueueCore().notifyEventMonitor(toolkit); } } + * finally { toolkit.unlockAWT(); } + */ } /** * Post event. * - * @param e the e + * @param e + * the e. */ void postEvent(AWTEvent e) { getToolkit().getSystemEventQueueImpl().postEvent(e); @@ -3856,10 +3579,14 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali /** * Repaints the specified Rectangle of this Component. * - * @param x the x coordinate of Rectangle. - * @param y the y coordinate of Rectangle. - * @param width the width of Rectangle. - * @param height the height of Rectangle. + * @param x + * the x coordinate of Rectangle. + * @param y + * the y coordinate of Rectangle. + * @param width + * the width of Rectangle. + * @param height + * the height of Rectangle. */ public void repaint(int x, int y, int width, int height) { toolkit.lockAWT(); @@ -3887,7 +3614,8 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali /** * Repaints the component within tm milliseconds. * - * @param tm the time in milliseconds before updating. + * @param tm + * the time in milliseconds before updating. */ public void repaint(long tm) { toolkit.lockAWT(); @@ -3899,29 +3627,28 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali } /** - * Requests that this Component get the input focus temporarily. - * This component must be displayable, visible, and focusable. + * Requests that this Component get the input focus temporarily. This + * component must be displayable, visible, and focusable. * - * @param temporary this parameter is true if the focus change - * is temporary, when the window loses the focus. - * - * @return true if the focus change request is succeeded, - * false otherwise. + * @param temporary + * this parameter is true if the focus change is temporary, when + * the window loses the focus. + * @return true if the focus change request is succeeded, false otherwise. */ protected boolean requestFocus(boolean temporary) { toolkit.lockAWT(); try { - //???AWT: return requestFocusImpl(temporary, true, false); + // ???AWT: return requestFocusImpl(temporary, true, false); } finally { toolkit.unlockAWT(); } - //???AWT + // ???AWT return false; } /** - * Requests that this Component get the input focus. - * This component must be displayable, visible, and focusable. + * Requests that this Component get the input focus. This component must be + * displayable, visible, and focusable. */ public void requestFocus() { toolkit.lockAWT(); @@ -3932,55 +3659,35 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali } } - //???AWT + // ???AWT /* - protected boolean requestFocusInWindow(boolean temporary) { - toolkit.lockAWT(); - try { - Window wnd = getWindowAncestor(); - if ((wnd == null) || !wnd.isFocused()) { - return false; - } - return requestFocusImpl(temporary, false, false); - } finally { - toolkit.unlockAWT(); - } - } - - boolean requestFocusImpl(boolean temporary, boolean crossWindow, boolean rejectionRecovery) { - if (!rejectionRecovery && isFocusOwner()) { - return true; - } - Window wnd = getWindowAncestor(); - Container par = getRealParent(); - if ((par != null) && par.isRemoved) { - return false; - } - if (!isShowing() || !isFocusable() || !wnd.isFocusableWindow()) { - return false; - } - return KeyboardFocusManager.getCurrentKeyboardFocusManager().requestFocus(this, - temporary, crossWindow, true); - } - - public boolean requestFocusInWindow() { - toolkit.lockAWT(); - try { - return requestFocusInWindow(false); - } finally { - toolkit.unlockAWT(); - } - } - */ + * protected boolean requestFocusInWindow(boolean temporary) { + * toolkit.lockAWT(); try { Window wnd = getWindowAncestor(); if ((wnd == + * null) || !wnd.isFocused()) { return false; } return + * requestFocusImpl(temporary, false, false); } finally { + * toolkit.unlockAWT(); } } boolean requestFocusImpl(boolean temporary, + * boolean crossWindow, boolean rejectionRecovery) { if (!rejectionRecovery + * && isFocusOwner()) { return true; } Window wnd = getWindowAncestor(); + * Container par = getRealParent(); if ((par != null) && par.isRemoved) { + * return false; } if (!isShowing() || !isFocusable() || + * !wnd.isFocusableWindow()) { return false; } return + * KeyboardFocusManager.getCurrentKeyboardFocusManager().requestFocus(this, + * temporary, crossWindow, true); } public boolean requestFocusInWindow() { + * toolkit.lockAWT(); try { return requestFocusInWindow(false); } finally { + * toolkit.unlockAWT(); } } + */ /** * Deprecated: replaced by setBounds(int, int, int, int) method. * - * @param x the x coordinate. - * @param y the y coordinate. - * @param w the width. - * @param h the height. - * + * @param x + * the x coordinate. + * @param y + * the y coordinate. + * @param w + * the width. + * @param h + * the height. * @deprecated Replaced by setBounds(int, int, int, int) method. */ @Deprecated @@ -3995,13 +3702,17 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali } /** - * Sets rectangle for this Component to be the rectangle with the specified + * Sets rectangle for this Component to be the rectangle with the specified * x,y coordinates of the top-left corner and the width and height. * - * @param x the x coordinate of the rectangle's top-left corner. - * @param y the y coordinate of the rectangle's top-left corner. - * @param w the width of rectangle. - * @param h the height of rectangle. + * @param x + * the x coordinate of the rectangle's top-left corner. + * @param y + * the y coordinate of the rectangle's top-left corner. + * @param w + * the width of rectangle. + * @param h + * the height of rectangle. */ public void setBounds(int x, int y, int w, int h) { toolkit.lockAWT(); @@ -4013,16 +3724,22 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali } /** - * Sets rectangle for this Component to be the rectangle with the specified - * x,y coordinates of the top-left corner and the width and height - * and posts the appropriate events. + * Sets rectangle for this Component to be the rectangle with the specified + * x,y coordinates of the top-left corner and the width and height and posts + * the appropriate events. * - * @param x the x coordinate of the rectangle's top-left corner. - * @param y the y coordinate of the rectangle's top-left corner. - * @param w the width of rectangle. - * @param h the height of rectangle. - * @param bMask the bitmask of bounds options - * @param updateBehavior the whether to update the behavoir's bounds as well + * @param x + * the x coordinate of the rectangle's top-left corner. + * @param y + * the y coordinate of the rectangle's top-left corner. + * @param w + * the width of rectangle. + * @param h + * the height of rectangle. + * @param bMask + * the bitmask of bounds options. + * @param updateBehavior + * the whether to update the behavoir's bounds as well. */ void setBounds(int x, int y, int w, int h, int bMask, boolean updateBehavior) { int oldX = this.x; @@ -4032,7 +3749,7 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali setBoundsFields(x, y, w, h, bMask); // Moved if ((oldX != this.x) || (oldY != this.y)) { - //???AWT: invalidateRealParent(); + // ???AWT: invalidateRealParent(); postEvent(new ComponentEvent(this, ComponentEvent.COMPONENT_MOVED)); spreadHierarchyBoundsEvents(this, HierarchyEvent.ANCESTOR_MOVED); } @@ -4051,7 +3768,8 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali /** * Calls InputContextImpl.notifyClientWindowChanged. * - * @param bounds the bounds + * @param bounds + * the bounds. */ void notifyInputMethod(Rectangle bounds) { // only Window actually notifies IM of bounds change @@ -4060,11 +3778,16 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali /** * Sets the bounds fields. * - * @param x the x - * @param y the y - * @param w the w - * @param h the h - * @param bMask the b mask + * @param x + * the x. + * @param y + * the y. + * @param w + * the w. + * @param h + * the h. + * @param bMask + * the b mask. */ private void setBoundsFields(int x, int y, int w, int h, int bMask) { if ((bMask & NativeWindow.BOUNDS_NOSIZE) == 0) { @@ -4080,7 +3803,7 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali /** * Gets the native insets. * - * @return the native insets + * @return the native insets. */ Insets getNativeInsets() { return new Insets(0, 0, 0, 0); @@ -4089,7 +3812,7 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali /** * Gets the insets. * - * @return the insets + * @return the insets. */ Insets getInsets() { return new Insets(0, 0, 0, 0); @@ -4098,7 +3821,7 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali /** * Checks if is mouse exited expected. * - * @return true, if is mouse exited expected + * @return true, if is mouse exited expected. */ boolean isMouseExitedExpected() { return mouseExitedExpected; @@ -4107,7 +3830,8 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali /** * Sets the mouse exited expected. * - * @param expected the new mouse exited expected + * @param expected + * the new mouse exited expected. */ void setMouseExitedExpected(boolean expected) { mouseExitedExpected = expected; @@ -4116,7 +3840,8 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali /** * Sets the new bounding rectangle for this Component. * - * @param r the new bounding rectangle. + * @param r + * the new bounding rectangle. */ public void setBounds(Rectangle r) { toolkit.lockAWT(); @@ -4128,10 +3853,11 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali } /** - * Sets the component orientation which affects the component's - * elements and text within this component. + * Sets the component orientation which affects the component's elements and + * text within this component. * - * @param o the ComponentOrientation object. + * @param o + * the ComponentOrientation object. */ public void setComponentOrientation(ComponentOrientation o) { ComponentOrientation oldOrientation; @@ -4149,7 +3875,8 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali /** * Sets the specified cursor for this Component. * - * @param cursor the new Cursor. + * @param cursor + * the new Cursor. */ public void setCursor(Cursor cursor) { toolkit.lockAWT(); @@ -4168,26 +3895,20 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali if (isDisplayable() && isShowing()) { Rectangle absRect = new Rectangle(getLocationOnScreen(), getSize()); Point absPointerPos = toolkit.dispatcher.mouseDispatcher.getPointerPos(); - //???AWT + // ???AWT /* - if (absRect.contains(absPointerPos)) { - // set Cursor only on top-level Windows(on X11) - Window topLevelWnd = getWindowAncestor(); - if (topLevelWnd != null) { - Point pointerPos = MouseDispatcher.convertPoint(null, absPointerPos, - topLevelWnd); - Component compUnderCursor = topLevelWnd.findComponentAt(pointerPos); - // if (compUnderCursor == this || - // compUnderCursor.getCursorAncestor() == this) { - NativeWindow wnd = topLevelWnd.getNativeWindow(); - if (compUnderCursor != null && wnd != null) { - compUnderCursor.getRealCursor().getNativeCursor() - .setCursor(wnd.getId()); - } - // } - } - } - */ + * if (absRect.contains(absPointerPos)) { // set Cursor only on + * top-level Windows(on X11) Window topLevelWnd = + * getWindowAncestor(); if (topLevelWnd != null) { Point pointerPos + * = MouseDispatcher.convertPoint(null, absPointerPos, topLevelWnd); + * Component compUnderCursor = + * topLevelWnd.findComponentAt(pointerPos); // if (compUnderCursor + * == this || // compUnderCursor.getCursorAncestor() == this) { + * NativeWindow wnd = topLevelWnd.getNativeWindow(); if + * (compUnderCursor != null && wnd != null) { + * compUnderCursor.getRealCursor().getNativeCursor() + * .setCursor(wnd.getId()); } // } } } + */ } } @@ -4195,68 +3916,44 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali * Gets the ancestor Cursor if Component is disabled (directly or via an * ancestor) even if Cursor is explicitly set. * - * @param value the value - * - * @return actual Cursor to be displayed + * @param value + * the value. + * @return the actual Cursor to be displayed. */ - //???AWT + // ???AWT /* - Cursor getRealCursor() { - Component cursorAncestor = getCursorAncestor(); - return cursorAncestor != null ? cursorAncestor.getCursor() : Cursor.getDefaultCursor(); - } - */ + * Cursor getRealCursor() { Component cursorAncestor = getCursorAncestor(); + * return cursorAncestor != null ? cursorAncestor.getCursor() : + * Cursor.getDefaultCursor(); } + */ /** * Gets the ancestor(or component itself) whose cursor is set when pointer * is inside component * - * @return actual Cursor to be displayed + * @return the actual Cursor to be displayed. */ - //???AWT + // ???AWT /* - Component getCursorAncestor() { - Component comp; - for (comp = this; comp != null; comp = comp.getParent()) { - if (comp instanceof Window || comp.isCursorSet() && comp.isKeyEnabled()) { - return comp; - } - } - return null; - } + * Component getCursorAncestor() { Component comp; for (comp = this; comp != + * null; comp = comp.getParent()) { if (comp instanceof Window || + * comp.isCursorSet() && comp.isKeyEnabled()) { return comp; } } return + * null; } public void setDropTarget(DropTarget dt) { toolkit.lockAWT(); try + * { if (dropTarget == dt) { return; } DropTarget oldDropTarget = + * dropTarget; dropTarget = dt; if (oldDropTarget != null) { if + * (behaviour.isDisplayable()) { oldDropTarget.removeNotify(peer); } + * oldDropTarget.setComponent(null); } if (dt != null) { + * dt.setComponent(this); if (behaviour.isDisplayable()) { + * dt.addNotify(peer); } } } finally { toolkit.unlockAWT(); } } + */ - public void setDropTarget(DropTarget dt) { - toolkit.lockAWT(); - try { - if (dropTarget == dt) { - return; - } - DropTarget oldDropTarget = dropTarget; - dropTarget = dt; - if (oldDropTarget != null) { - if (behaviour.isDisplayable()) { - oldDropTarget.removeNotify(peer); - } - oldDropTarget.setComponent(null); - } - if (dt != null) { - dt.setComponent(this); - if (behaviour.isDisplayable()) { - dt.addNotify(peer); - } - } - } finally { - toolkit.unlockAWT(); - } - } - */ - /** - * Sets this component to the "enabled" or "disabled" state depending - * on the specified boolean parameter. + * Sets this component to the "enabled" or "disabled" state depending on the + * specified boolean parameter. * - * @param value true if this component should be enabled; false - * if this component should be disabled. + * @param value + * true if this component should be enabled; false if this + * component should be disabled. */ public void setEnabled(boolean value) { toolkit.lockAWT(); @@ -4270,7 +3967,8 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali /** * Sets the enabled impl. * - * @param value the new enabled impl + * @param value + * the new enabled impl. */ void setEnabledImpl(boolean value) { if (enabled != value) { @@ -4283,77 +3981,49 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali } } - //???AWT + // ???AWT /* - private void fireAccessibleStateChange(AccessibleState state, boolean value) { - if (behaviour.isLightweight()) { - return; - } - AccessibleContext ac = getAccessibleContext(); - if (ac != null) { - AccessibleState oldValue = null; - AccessibleState newValue = null; - if (value) { - newValue = state; - } else { - oldValue = state; - } - ac.firePropertyChange(AccessibleContext.ACCESSIBLE_STATE_PROPERTY, oldValue, - newValue); - } - } - */ + * private void fireAccessibleStateChange(AccessibleState state, boolean + * value) { if (behaviour.isLightweight()) { return; } AccessibleContext ac + * = getAccessibleContext(); if (ac != null) { AccessibleState oldValue = + * null; AccessibleState newValue = null; if (value) { newValue = state; } + * else { oldValue = state; } + * ac.firePropertyChange(AccessibleContext.ACCESSIBLE_STATE_PROPERTY, + * oldValue, newValue); } } + */ - //???AWT + // ???AWT /* - public void setFocusTraversalKeys(int id, Set keystrokes) { - Set oldTraversalKeys; - String propName = "FocusTraversalKeys"; //$NON-NLS-1$ - toolkit.lockAWT(); - try { - Integer kId = new Integer(id); - KeyboardFocusManager.checkTraversalKeysID(traversalKeys, kId); - Map> keys = new HashMap>(); - for (int kid : traversalIDs) { - Integer key = new Integer(kid); - keys.put(key, getFocusTraversalKeys(kid)); - } - KeyboardFocusManager.checkKeyStrokes(traversalIDs, keys, kId, keystrokes); - oldTraversalKeys = traversalKeys.get(new Integer(id)); - // put a copy of keystrokes object into map: - Set newKeys = keystrokes; - if (keystrokes != null) { - newKeys = new HashSet(keystrokes); - } - traversalKeys.put(kId, newKeys); - String direction = ""; //$NON-NLS-1$ - switch (id) { - case KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS: - direction = "forward"; //$NON-NLS-1$ - break; - case KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS: - direction = "backward"; //$NON-NLS-1$ - break; - case KeyboardFocusManager.UP_CYCLE_TRAVERSAL_KEYS: - direction = "upCycle"; //$NON-NLS-1$ - break; - case KeyboardFocusManager.DOWN_CYCLE_TRAVERSAL_KEYS: - direction = "downCycle"; //$NON-NLS-1$ - break; - } - propName = direction + propName; - } finally { - toolkit.unlockAWT(); - } - firePropertyChange(propName, oldTraversalKeys, keystrokes); - } - */ + * public void setFocusTraversalKeys(int id, Set + * keystrokes) { Set oldTraversalKeys; String + * propName = "FocusTraversalKeys"; //$NON-NLS-1$ toolkit.lockAWT(); try { + * Integer kId = new Integer(id); + * KeyboardFocusManager.checkTraversalKeysID(traversalKeys, kId); + * Map> keys = new HashMap>(); for (int kid : traversalIDs) { Integer + * key = new Integer(kid); keys.put(key, getFocusTraversalKeys(kid)); } + * KeyboardFocusManager.checkKeyStrokes(traversalIDs, keys, kId, + * keystrokes); oldTraversalKeys = traversalKeys.get(new Integer(id)); // + * put a copy of keystrokes object into map: Set + * newKeys = keystrokes; if (keystrokes != null) { newKeys = new + * HashSet(keystrokes); } traversalKeys.put(kId, newKeys); + * String direction = ""; //$NON-NLS-1$ switch (id) { case + * KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS: direction = "forward"; + * //$NON-NLS-1$ break; case KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS: + * direction = "backward"; //$NON-NLS-1$ break; case + * KeyboardFocusManager.UP_CYCLE_TRAVERSAL_KEYS: direction = "upCycle"; + * //$NON-NLS-1$ break; case KeyboardFocusManager.DOWN_CYCLE_TRAVERSAL_KEYS: + * direction = "downCycle"; //$NON-NLS-1$ break; } propName = direction + + * propName; } finally { toolkit.unlockAWT(); } firePropertyChange(propName, + * oldTraversalKeys, keystrokes); } + */ /** * Sets the focus traversal keys state for this component. * - * @param value true if the focus traversal keys state is enabled, - * false if the focus traversal keys state is disabled. + * @param value + * true if the focus traversal keys state is enabled, false if + * the focus traversal keys state is disabled. */ public void setFocusTraversalKeysEnabled(boolean value) { boolean oldFocusTraversalKeysEnabled; @@ -4368,38 +4038,23 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali focusTraversalKeysEnabled); } - //???AWT + // ???AWT /* - public void setFocusable(boolean focusable) { - boolean oldFocusable; - toolkit.lockAWT(); - try { - calledSetFocusable = true; - oldFocusable = this.focusable; - this.focusable = focusable; - if (!focusable) { - moveFocus(); - } - } finally { - toolkit.unlockAWT(); - } - firePropertyChange("focusable", oldFocusable, focusable); //$NON-NLS-1$ - } - - public Font getFont() { - toolkit.lockAWT(); - try { - return (font == null) && (parent != null) ? parent.getFont() : font; - } finally { - toolkit.unlockAWT(); - } - } - */ + * public void setFocusable(boolean focusable) { boolean oldFocusable; + * toolkit.lockAWT(); try { calledSetFocusable = true; oldFocusable = + * this.focusable; this.focusable = focusable; if (!focusable) { + * moveFocus(); } } finally { toolkit.unlockAWT(); } + * firePropertyChange("focusable", oldFocusable, focusable); //$NON-NLS-1$ } + * public Font getFont() { toolkit.lockAWT(); try { return (font == null) && + * (parent != null) ? parent.getFont() : font; } finally { + * toolkit.unlockAWT(); } } + */ /** * Sets the font for this Component. * - * @param f the new font of the Component. + * @param f + * the new font of the Component. */ public void setFont(Font f) { Font oldFont; @@ -4416,7 +4071,8 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali /** * Sets the font impl. * - * @param f the new font impl + * @param f + * the new font impl. */ void setFontImpl(Font f) { font = f; @@ -4426,12 +4082,11 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali } } - /** * Invalidate the component if it inherits the font from the parent. This * method is overridden in Container. * - * @return true if the component was invalidated, false otherwise + * @return true if the component was invalidated, false otherwise. */ boolean propagateFont() { if (font == null) { @@ -4444,7 +4099,8 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali /** * Sets the foreground color for this Component. * - * @param c the new foreground color. + * @param c + * the new foreground color. */ public void setForeground(Color c) { Color oldFgColor; @@ -4462,7 +4118,8 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali /** * Sets the background color for the Component. * - * @param c the new background color for this component. + * @param c + * the new background color for this component. */ public void setBackground(Color c) { Color oldBkColor; @@ -4478,11 +4135,12 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali } /** - * Sets the flag for whether paint messages received from the operating - * system should be ignored or not. + * Sets the flag for whether paint messages received from the operating + * system should be ignored or not. * - * @param value true if paint messages received from the operating - * system should be ignored, false otherwise. + * @param value + * true if paint messages received from the operating system + * should be ignored, false otherwise. */ public void setIgnoreRepaint(boolean value) { toolkit.lockAWT(); @@ -4496,7 +4154,8 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali /** * Sets the locale of the component. * - * @param locale the new Locale. + * @param locale + * the new Locale. */ public void setLocale(Locale locale) { Locale oldLocale; @@ -4513,7 +4172,8 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali /** * Sets the location of the Component to the specified point. * - * @param p the new location of the Component + * @param p + * the new location of the Component. */ public void setLocation(Point p) { toolkit.lockAWT(); @@ -4525,10 +4185,12 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali } /** - * Sets the location of the Component to the specified x, y coordinates. + * Sets the location of the Component to the specified x, y coordinates. * - * @param x the x coordinate. - * @param y the y coordinate. + * @param x + * the x coordinate. + * @param y + * the y coordinate. */ public void setLocation(int x, int y) { toolkit.lockAWT(); @@ -4542,8 +4204,9 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali /** * Sets the visibility state of the component. * - * @param b true if the component is visible, false if the component - * is not shown. + * @param b + * true if the component is visible, false if the component is + * not shown. */ public void setVisible(boolean b) { // show() & hide() are not deprecated for Window, @@ -4569,9 +4232,9 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali visible = true; behaviour.setVisible(true); postEvent(new ComponentEvent(this, ComponentEvent.COMPONENT_SHOWN)); - //???AWT: finishHierarchyChange(this, parent, 0); + // ???AWT: finishHierarchyChange(this, parent, 0); notifyInputMethod(new Rectangle(x, y, w, h)); - //???AWT: invalidateRealParent(); + // ???AWT: invalidateRealParent(); } finally { toolkit.unlockAWT(); } @@ -4580,8 +4243,8 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali /** * Deprecated: replaced by setVisible(boolean) method. * - * @param b the visibility's state. - * + * @param b + * the visibility's state. * @deprecated Replaced by setVisible(boolean) method. */ @Deprecated @@ -4593,97 +4256,40 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali } } - //???AWT + // ???AWT /* - void transferFocus(int dir) { - Container root = null; - if (this instanceof Container) { - Container cont = (Container) this; - if (cont.isFocusCycleRoot()) { - root = cont.getFocusTraversalRoot(); - } - } - if (root == null) { - root = getFocusCycleRootAncestor(); - } - // transfer focus up cycle if root is unreachable - Component comp = this; - while ((root != null) - && !(root.isFocusCycleRoot() && root.isShowing() && root.isEnabled() && root - .isFocusable())) { - comp = root; - root = root.getFocusCycleRootAncestor(); - } - if (root == null) { - return; - } - FocusTraversalPolicy policy = root.getFocusTraversalPolicy(); - Component nextComp = null; - switch (dir) { - case KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS: - nextComp = policy.getComponentAfter(root, comp); - break; - case KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS: - nextComp = policy.getComponentBefore(root, comp); - break; - } - if (nextComp != null) { - nextComp.requestFocus(false); - } - } - - public void transferFocus() { - toolkit.lockAWT(); - try { - nextFocus(); - } finally { - toolkit.unlockAWT(); - } - } - - public void transferFocusBackward() { - toolkit.lockAWT(); - try { - transferFocus(KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS); - } finally { - toolkit.unlockAWT(); - } - } - - public void transferFocusUpCycle() { - toolkit.lockAWT(); - try { - KeyboardFocusManager kfm = KeyboardFocusManager.getCurrentKeyboardFocusManager(); - Container root = kfm.getCurrentFocusCycleRoot(); - - if(root == null) { - return; - } - - boolean success = false; - Component nextComp = null; - Container newRoot = root; - do { - nextComp = newRoot instanceof Window ? newRoot.getFocusTraversalPolicy() - .getDefaultComponent(newRoot) : newRoot; - newRoot = newRoot.getFocusCycleRootAncestor(); - if (nextComp == null) { - break; - } - success = nextComp.requestFocusInWindow(); - if (newRoot == null) { - break; - } - kfm.setGlobalCurrentFocusCycleRoot(newRoot); - } while (!success); - if (!success && root != newRoot) { - kfm.setGlobalCurrentFocusCycleRoot(root); - } - } finally { - toolkit.unlockAWT(); - } - } - */ + * void transferFocus(int dir) { Container root = null; if (this instanceof + * Container) { Container cont = (Container) this; if + * (cont.isFocusCycleRoot()) { root = cont.getFocusTraversalRoot(); } } if + * (root == null) { root = getFocusCycleRootAncestor(); } // transfer focus + * up cycle if root is unreachable Component comp = this; while ((root != + * null) && !(root.isFocusCycleRoot() && root.isShowing() && + * root.isEnabled() && root .isFocusable())) { comp = root; root = + * root.getFocusCycleRootAncestor(); } if (root == null) { return; } + * FocusTraversalPolicy policy = root.getFocusTraversalPolicy(); Component + * nextComp = null; switch (dir) { case + * KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS: nextComp = + * policy.getComponentAfter(root, comp); break; case + * KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS: nextComp = + * policy.getComponentBefore(root, comp); break; } if (nextComp != null) { + * nextComp.requestFocus(false); } } public void transferFocus() { + * toolkit.lockAWT(); try { nextFocus(); } finally { toolkit.unlockAWT(); } + * } public void transferFocusBackward() { toolkit.lockAWT(); try { + * transferFocus(KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS); } finally { + * toolkit.unlockAWT(); } } public void transferFocusUpCycle() { + * toolkit.lockAWT(); try { KeyboardFocusManager kfm = + * KeyboardFocusManager.getCurrentKeyboardFocusManager(); Container root = + * kfm.getCurrentFocusCycleRoot(); if(root == null) { return; } boolean + * success = false; Component nextComp = null; Container newRoot = root; do + * { nextComp = newRoot instanceof Window ? + * newRoot.getFocusTraversalPolicy() .getDefaultComponent(newRoot) : + * newRoot; newRoot = newRoot.getFocusCycleRootAncestor(); if (nextComp == + * null) { break; } success = nextComp.requestFocusInWindow(); if (newRoot + * == null) { break; } kfm.setGlobalCurrentFocusCycleRoot(newRoot); } while + * (!success); if (!success && root != newRoot) { + * kfm.setGlobalCurrentFocusCycleRoot(root); } } finally { + * toolkit.unlockAWT(); } } + */ /** * Validates that this component has a valid layout. @@ -4710,7 +4316,7 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali /** * Gets the native window. * - * @return the native window + * @return the native window. */ NativeWindow getNativeWindow() { return behaviour.getNativeWindow(); @@ -4719,8 +4325,8 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali /** * Checks whether or not a maximum size is set for the Component. * - * @return true, if the maximum size is set for the Component, - * false otherwise. + * @return true, if the maximum size is set for the Component, false + * otherwise. */ public boolean isMaximumSizeSet() { toolkit.lockAWT(); @@ -4734,8 +4340,8 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali /** * Checks whether or not the minimum size is set for the component. * - * @return true, if the minimum size is set for the component, - * false otherwise. + * @return true, if the minimum size is set for the component, false + * otherwise. */ public boolean isMinimumSizeSet() { toolkit.lockAWT(); @@ -4749,8 +4355,8 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali /** * Checks whether or not the preferred size is set for the Component. * - * @return true, if the preferred size is set for the Component, - * false otherwise. + * @return true, if the preferred size is set for the Component, false + * otherwise. */ public boolean isPreferredSizeSet() { toolkit.lockAWT(); @@ -4769,8 +4375,8 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali public Dimension getMaximumSize() { toolkit.lockAWT(); try { - return isMaximumSizeSet() ? new Dimension(maximumSize) : new Dimension( - Short.MAX_VALUE, Short.MAX_VALUE); + return isMaximumSizeSet() ? new Dimension(maximumSize) : new Dimension(Short.MAX_VALUE, + Short.MAX_VALUE); } finally { toolkit.unlockAWT(); } @@ -4794,7 +4400,6 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali * Deprecated: replaced by getMinimumSize() method. * * @return the Dimension. - * * @deprecated Replaced by getMinimumSize() method. */ @Deprecated @@ -4808,7 +4413,7 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali if (defSize != null) { return (Dimension)defSize.clone(); } - return isDisplayable()? new Dimension(1, 1) : new Dimension(w, h); + return isDisplayable() ? new Dimension(1, 1) : new Dimension(w, h); } finally { toolkit.unlockAWT(); } @@ -4832,7 +4437,6 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali * Deprecated: replaced by getPreferredSize() method. * * @return the Dimension. - * * @deprecated Replaced by getPreferredSize() method. */ @Deprecated @@ -4855,7 +4459,8 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali /** * Sets the maximum size of the Component. * - * @param maximumSize the new maximum size of the Component. + * @param maximumSize + * the new maximum size of the Component. */ public void setMaximumSize(Dimension maximumSize) { Dimension oldMaximumSize; @@ -4882,7 +4487,7 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali firePropertyChange("maximumSize", oldMaximumSize, this.maximumSize); //$NON-NLS-1$ toolkit.lockAWT(); try { - //???AWT: invalidateRealParent(); + // ???AWT: invalidateRealParent(); } finally { toolkit.unlockAWT(); } @@ -4891,7 +4496,8 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali /** * Sets the minimum size of the Component. * - * @param minimumSize the new minimum size of the Component. + * @param minimumSize + * the new minimum size of the Component. */ public void setMinimumSize(Dimension minimumSize) { Dimension oldMinimumSize; @@ -4918,7 +4524,7 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali firePropertyChange("minimumSize", oldMinimumSize, this.minimumSize); //$NON-NLS-1$ toolkit.lockAWT(); try { - //???AWT: invalidateRealParent(); + // ???AWT: invalidateRealParent(); } finally { toolkit.unlockAWT(); } @@ -4927,7 +4533,8 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali /** * Sets the preferred size of the Component. * - * @param preferredSize the new preferred size of the Component. + * @param preferredSize + * the new preferred size of the Component. */ public void setPreferredSize(Dimension preferredSize) { Dimension oldPreferredSize; @@ -4954,47 +4561,38 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali firePropertyChange("preferredSize", oldPreferredSize, this.preferredSize); //$NON-NLS-1$ toolkit.lockAWT(); try { - //???AWT: invalidateRealParent(); + // ???AWT: invalidateRealParent(); } finally { toolkit.unlockAWT(); } } - //???AWT + // ???AWT /* - RedrawManager getRedrawManager() { - if (parent == null) { - return null; - } - return parent.getRedrawManager(); - } - */ + * RedrawManager getRedrawManager() { if (parent == null) { return null; } + * return parent.getRedrawManager(); } + */ /** * Checks if is focusability explicitly set. * - * @return true if component has a focusable peer + * @return true if component has a focusable peer. */ - //???AWT + // ???AWT /* - boolean isPeerFocusable() { - // The recommendations for Windows and Unix are that - // Canvases, Labels, Panels, Scrollbars, ScrollPanes, Windows, - // and lightweight Components have non-focusable peers, - // and all other Components have focusable peers. - if (this instanceof Canvas || this instanceof Label || this instanceof Panel - || this instanceof Scrollbar || this instanceof ScrollPane - || this instanceof Window || isLightweight()) { - return false; - } - return true; - } - */ + * boolean isPeerFocusable() { // The recommendations for Windows and Unix + * are that // Canvases, Labels, Panels, Scrollbars, ScrollPanes, Windows, + * // and lightweight Components have non-focusable peers, // and all other + * Components have focusable peers. if (this instanceof Canvas || this + * instanceof Label || this instanceof Panel || this instanceof Scrollbar || + * this instanceof ScrollPane || this instanceof Window || isLightweight()) + * { return false; } return true; } + */ /** * @return true if focusability was explicitly set via a call to * setFocusable() or via overriding isFocusable() or - * isFocusTraversable() + * isFocusTraversable(). */ boolean isFocusabilityExplicitlySet() { return calledSetFocusable || overridenIsFocusable; @@ -5003,7 +4601,8 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali /** * Paints the component and all of its subcomponents. * - * @param g the Graphics to be used for painting. + * @param g + * the Graphics to be used for painting. */ public void paintAll(Graphics g) { toolkit.lockAWT(); @@ -5017,7 +4616,8 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali /** * Updates this Component. * - * @param g the Graphics to be used for updating. + * @param g + * the Graphics to be used for updating. */ public void update(Graphics g) { toolkit.lockAWT(); @@ -5036,7 +4636,8 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali /** * Paints this component. * - * @param g the Graphics to be used for painting. + * @param g + * the Graphics to be used for painting. */ public void paint(Graphics g) { toolkit.lockAWT(); @@ -5050,7 +4651,8 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali /** * Prepares the component to be painted. * - * @param g the Graphics to be used for painting. + * @param g + * the Graphics to be used for painting. */ void prepaint(Graphics g) { // Just to nothing. For overriding. @@ -5059,7 +4661,7 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali /** * Checks if is prepainter. * - * @return true, if is prepainter + * @return true, if is prepainter. */ boolean isPrepainter() { return false; @@ -5083,41 +4685,29 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali // To be inherited by Container } - //???AWT + // ???AWT /* - void finishHierarchyChange(Component changed, Container changedParent, int ancestorFlags) { - if (--hierarchyChangingCounter == 0) { - int changeFlags = ancestorFlags; - if (wasShowing != isShowing()) { - changeFlags |= HierarchyEvent.SHOWING_CHANGED; - } - if (wasDisplayable != isDisplayable()) { - changeFlags |= HierarchyEvent.DISPLAYABILITY_CHANGED; - } - if (changeFlags > 0) { - postEvent(new HierarchyEvent(this, HierarchyEvent.HIERARCHY_CHANGED, changed, - changedParent, changeFlags)); - } - finishChildrenHierarchyChange(changed, changedParent, ancestorFlags); - } - } - - - void finishChildrenHierarchyChange(Component changed, Container changedParent, - int ancestorFlags) { - // To be inherited by Container - } + * void finishHierarchyChange(Component changed, Container changedParent, + * int ancestorFlags) { if (--hierarchyChangingCounter == 0) { int + * changeFlags = ancestorFlags; if (wasShowing != isShowing()) { changeFlags + * |= HierarchyEvent.SHOWING_CHANGED; } if (wasDisplayable != + * isDisplayable()) { changeFlags |= HierarchyEvent.DISPLAYABILITY_CHANGED; + * } if (changeFlags > 0) { postEvent(new HierarchyEvent(this, + * HierarchyEvent.HIERARCHY_CHANGED, changed, changedParent, changeFlags)); + * } finishChildrenHierarchyChange(changed, changedParent, ancestorFlags); } + * } void finishChildrenHierarchyChange(Component changed, Container + * changedParent, int ancestorFlags) { // To be inherited by Container } + * void postHierarchyBoundsEvents(Component changed, int id) { postEvent(new + * HierarchyEvent(this, id, changed, null, 0)); } + */ - void postHierarchyBoundsEvents(Component changed, int id) { - postEvent(new HierarchyEvent(this, id, changed, null, 0)); - } - */ - /** * Spread hierarchy bounds events. * - * @param changed the changed - * @param id the id + * @param changed + * the changed. + * @param id + * the id. */ void spreadHierarchyBoundsEvents(Component changed, int id) { // To be inherited by Container @@ -5126,59 +4716,40 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali /** * Dispatches an event to this component. * - * @param e the Event. + * @param e + * the Event. */ public final void dispatchEvent(AWTEvent e) { - //???AWT + // ???AWT /* - if (e.isConsumed()) { - return; - } - if (e instanceof PaintEvent) { - toolkit.dispatchAWTEvent(e); - processPaintEvent((PaintEvent) e); - return; - } - KeyboardFocusManager kfm = KeyboardFocusManager.getCurrentKeyboardFocusManager(); - if (!e.dispatchedByKFM && kfm.dispatchEvent(e)) { - return; - } - if (e instanceof KeyEvent) { - KeyEvent ke = (KeyEvent) e; - // consumes KeyEvent which represents a focus traversal key - if (getFocusTraversalKeysEnabled()) { - kfm.processKeyEvent(this, ke); - if (ke.isConsumed()) { - return; - } - } - } - if (inputMethodsEnabled && dispatchToIM && e.isPosted && dispatchEventToIM(e)) { - return; - } - if (e.getID() == WindowEvent.WINDOW_ICONIFIED) { - notifyInputMethod(null); - } - AWTEvent.EventDescriptor descriptor = toolkit.eventTypeLookup.getEventDescriptor(e); - toolkit.dispatchAWTEvent(e); - if (descriptor != null) { - if (isEventEnabled(descriptor.eventMask) - || (getListeners(descriptor.listenerType).length > 0)) { - processEvent(e); - } - // input events can be consumed by user listeners: - if (!e.isConsumed() && ((enabledAWTEvents & descriptor.eventMask) != 0)) { - postprocessEvent(e, descriptor.eventMask); - } - } - postDeprecatedEvent(e); - */ + * if (e.isConsumed()) { return; } if (e instanceof PaintEvent) { + * toolkit.dispatchAWTEvent(e); processPaintEvent((PaintEvent) e); + * return; } KeyboardFocusManager kfm = + * KeyboardFocusManager.getCurrentKeyboardFocusManager(); if + * (!e.dispatchedByKFM && kfm.dispatchEvent(e)) { return; } if (e + * instanceof KeyEvent) { KeyEvent ke = (KeyEvent) e; // consumes + * KeyEvent which represents a focus traversal key if + * (getFocusTraversalKeysEnabled()) { kfm.processKeyEvent(this, ke); if + * (ke.isConsumed()) { return; } } } if (inputMethodsEnabled && + * dispatchToIM && e.isPosted && dispatchEventToIM(e)) { return; } if + * (e.getID() == WindowEvent.WINDOW_ICONIFIED) { + * notifyInputMethod(null); } AWTEvent.EventDescriptor descriptor = + * toolkit.eventTypeLookup.getEventDescriptor(e); + * toolkit.dispatchAWTEvent(e); if (descriptor != null) { if + * (isEventEnabled(descriptor.eventMask) || + * (getListeners(descriptor.listenerType).length > 0)) { + * processEvent(e); } // input events can be consumed by user listeners: + * if (!e.isConsumed() && ((enabledAWTEvents & descriptor.eventMask) != + * 0)) { postprocessEvent(e, descriptor.eventMask); } } + * postDeprecatedEvent(e); + */ } /** * Post deprecated event. * - * @param e the e + * @param e + * the e. */ private void postDeprecatedEvent(AWTEvent e) { if (deprecatedEventHandler) { @@ -5192,27 +4763,29 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali /** * Postprocess event. * - * @param e the e - * @param eventMask the event mask + * @param e + * the e. + * @param eventMask + * the event mask. */ void postprocessEvent(AWTEvent e, long eventMask) { toolkit.lockAWT(); try { // call system listeners under AWT lock if (eventMask == AWTEvent.FOCUS_EVENT_MASK) { - preprocessFocusEvent((FocusEvent) e); + preprocessFocusEvent((FocusEvent)e); } else if (eventMask == AWTEvent.KEY_EVENT_MASK) { - preprocessKeyEvent((KeyEvent) e); + preprocessKeyEvent((KeyEvent)e); } else if (eventMask == AWTEvent.MOUSE_EVENT_MASK) { - preprocessMouseEvent((MouseEvent) e); + preprocessMouseEvent((MouseEvent)e); } else if (eventMask == AWTEvent.MOUSE_MOTION_EVENT_MASK) { - preprocessMouseMotionEvent((MouseEvent) e); + preprocessMouseMotionEvent((MouseEvent)e); } else if (eventMask == AWTEvent.COMPONENT_EVENT_MASK) { - preprocessComponentEvent((ComponentEvent) e); + preprocessComponentEvent((ComponentEvent)e); } else if (eventMask == AWTEvent.MOUSE_WHEEL_EVENT_MASK) { - preprocessMouseWheelEvent((MouseWheelEvent) e); + preprocessMouseWheelEvent((MouseWheelEvent)e); } else if (eventMask == AWTEvent.INPUT_METHOD_EVENT_MASK) { - preprocessInputMethodEvent((InputMethodEvent) e); + preprocessInputMethodEvent((InputMethodEvent)e); } } finally { toolkit.unlockAWT(); @@ -5222,7 +4795,8 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali /** * Preprocess input method event. * - * @param e the e + * @param e + * the e. */ private void preprocessInputMethodEvent(InputMethodEvent e) { processInputMethodEventImpl(e, inputMethodListeners.getSystemListeners()); @@ -5231,7 +4805,8 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali /** * Preprocess mouse wheel event. * - * @param e the e + * @param e + * the e. */ private void preprocessMouseWheelEvent(MouseWheelEvent e) { processMouseWheelEventImpl(e, mouseWheelListeners.getSystemListeners()); @@ -5240,8 +4815,10 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali /** * Process mouse wheel event impl. * - * @param e the e - * @param c the c + * @param e + * the e. + * @param c + * the c. */ private void processMouseWheelEventImpl(MouseWheelEvent e, Collection c) { for (MouseWheelListener listener : c) { @@ -5256,7 +4833,8 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali /** * Preprocess component event. * - * @param e the e + * @param e + * the e. */ private void preprocessComponentEvent(ComponentEvent e) { processComponentEventImpl(e, componentListeners.getSystemListeners()); @@ -5265,7 +4843,8 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali /** * Preprocess mouse motion event. * - * @param e the e + * @param e + * the e. */ void preprocessMouseMotionEvent(MouseEvent e) { processMouseMotionEventImpl(e, mouseMotionListeners.getSystemListeners()); @@ -5274,7 +4853,8 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali /** * Preprocess mouse event. * - * @param e the e + * @param e + * the e */ void preprocessMouseEvent(MouseEvent e) { processMouseEventImpl(e, mouseListeners.getSystemListeners()); @@ -5283,7 +4863,8 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali /** * Preprocess key event. * - * @param e the e + * @param e + * the e. */ void preprocessKeyEvent(KeyEvent e) { processKeyEventImpl(e, keyListeners.getSystemListeners()); @@ -5292,79 +4873,82 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali /** * Preprocess focus event. * - * @param e the e + * @param e + * the e. */ void preprocessFocusEvent(FocusEvent e) { processFocusEventImpl(e, focusListeners.getSystemListeners()); } /** - * Processes AWTEvent occurred on this component. + * Processes AWTEvent occurred on this component. * - * @param e the AWTEvent. + * @param e + * the AWTEvent. */ protected void processEvent(AWTEvent e) { long eventMask = toolkit.eventTypeLookup.getEventMask(e); if (eventMask == AWTEvent.COMPONENT_EVENT_MASK) { - processComponentEvent((ComponentEvent) e); + processComponentEvent((ComponentEvent)e); } else if (eventMask == AWTEvent.FOCUS_EVENT_MASK) { - processFocusEvent((FocusEvent) e); + processFocusEvent((FocusEvent)e); } else if (eventMask == AWTEvent.KEY_EVENT_MASK) { - processKeyEvent((KeyEvent) e); + processKeyEvent((KeyEvent)e); } else if (eventMask == AWTEvent.MOUSE_EVENT_MASK) { - processMouseEvent((MouseEvent) e); + processMouseEvent((MouseEvent)e); } else if (eventMask == AWTEvent.MOUSE_WHEEL_EVENT_MASK) { - processMouseWheelEvent((MouseWheelEvent) e); + processMouseWheelEvent((MouseWheelEvent)e); } else if (eventMask == AWTEvent.MOUSE_MOTION_EVENT_MASK) { - processMouseMotionEvent((MouseEvent) e); + processMouseMotionEvent((MouseEvent)e); } else if (eventMask == AWTEvent.HIERARCHY_EVENT_MASK) { - processHierarchyEvent((HierarchyEvent) e); + processHierarchyEvent((HierarchyEvent)e); } else if (eventMask == AWTEvent.HIERARCHY_BOUNDS_EVENT_MASK) { - processHierarchyBoundsEvent((HierarchyEvent) e); + processHierarchyBoundsEvent((HierarchyEvent)e); } else if (eventMask == AWTEvent.INPUT_METHOD_EVENT_MASK) { - processInputMethodEvent((InputMethodEvent) e); + processInputMethodEvent((InputMethodEvent)e); } } /** - * Gets an array of all listener's objects based on the specified - * listener type and registered to this Component. - * - * @param listenerType the listener type. + * Gets an array of all listener's objects based on the specified listener + * type and registered to this Component. * + * @param listenerType + * the listener type. * @return an array of all listener's objects based on the specified - * listener type and registered to this Component. + * listener type and registered to this Component. */ @SuppressWarnings("unchecked") public T[] getListeners(Class listenerType) { if (ComponentListener.class.isAssignableFrom(listenerType)) { - return (T[]) getComponentListeners(); + return (T[])getComponentListeners(); } else if (FocusListener.class.isAssignableFrom(listenerType)) { - return (T[]) getFocusListeners(); + return (T[])getFocusListeners(); } else if (HierarchyBoundsListener.class.isAssignableFrom(listenerType)) { - return (T[]) getHierarchyBoundsListeners(); + return (T[])getHierarchyBoundsListeners(); } else if (HierarchyListener.class.isAssignableFrom(listenerType)) { - return (T[]) getHierarchyListeners(); + return (T[])getHierarchyListeners(); } else if (InputMethodListener.class.isAssignableFrom(listenerType)) { - return (T[]) getInputMethodListeners(); + return (T[])getInputMethodListeners(); } else if (KeyListener.class.isAssignableFrom(listenerType)) { - return (T[]) getKeyListeners(); + return (T[])getKeyListeners(); } else if (MouseWheelListener.class.isAssignableFrom(listenerType)) { - return (T[]) getMouseWheelListeners(); + return (T[])getMouseWheelListeners(); } else if (MouseMotionListener.class.isAssignableFrom(listenerType)) { - return (T[]) getMouseMotionListeners(); + return (T[])getMouseMotionListeners(); } else if (MouseListener.class.isAssignableFrom(listenerType)) { - return (T[]) getMouseListeners(); + return (T[])getMouseListeners(); } else if (PropertyChangeListener.class.isAssignableFrom(listenerType)) { - return (T[]) getPropertyChangeListeners(); + return (T[])getPropertyChangeListeners(); } - return (T[]) Array.newInstance(listenerType, 0); + return (T[])Array.newInstance(listenerType, 0); } /** * Process paint event. * - * @param event the event + * @param event + * the event. */ private void processPaintEvent(PaintEvent event) { if (redrawManager == null) { @@ -5392,13 +4976,15 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali /** * Inits the graphics. * - * @param g the g - * @param e the e + * @param g + * the g. + * @param e + * the e. */ void initGraphics(Graphics g, PaintEvent e) { Rectangle clip = e.getUpdateRect(); if (clip instanceof ClipRegion) { - g.setClip(((ClipRegion) clip).getClip()); + g.setClip(((ClipRegion)clip).getClip()); } else { g.setClip(clip); } @@ -5413,11 +4999,11 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali } /** - * Enables the events with the specified event mask to be delivered to - * this component. + * Enables the events with the specified event mask to be delivered to this + * component. * - * @param eventsToEnable the events mask which specifies the types - * of events to enable. + * @param eventsToEnable + * the events mask which specifies the types of events to enable. */ protected final void enableEvents(long eventsToEnable) { toolkit.lockAWT(); @@ -5432,17 +5018,19 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali /** * Enable awt events. * - * @param eventsToEnable the events to enable + * @param eventsToEnable + * the events to enable. */ private void enableAWTEvents(long eventsToEnable) { enabledAWTEvents |= eventsToEnable; } /** - * Disables the events with types specified by the specified event mask - * from being delivered to this component. + * Disables the events with types specified by the specified event mask from + * being delivered to this component. * - * @param eventsToDisable the event mask specifying the event types. + * @param eventsToDisable + * the event mask specifying the event types. */ protected final void disableEvents(long eventsToDisable) { toolkit.lockAWT(); @@ -5459,9 +5047,9 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali /** * Checks if is mouse event enabled. * - * @param eventMask the event mask - * - * @return true, if is mouse event enabled + * @param eventMask + * the event mask. + * @return true, if is mouse event enabled. */ boolean isMouseEventEnabled(long eventMask) { return (isEventEnabled(eventMask) || (enabledAWTEvents & eventMask) != 0); @@ -5470,18 +5058,19 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali /** * Checks if is event enabled. * - * @param eventMask the event mask - * - * @return true, if is event enabled + * @param eventMask + * the event mask. + * @return true, if is event enabled. */ boolean isEventEnabled(long eventMask) { return ((enabledEvents & eventMask) != 0); } /** - * Enables or disables input method support for this component. + * Enables or disables input method support for this component. * - * @param enable true to enable input method support, false to disable it. + * @param enable + * true to enable input method support, false to disable it. */ public void enableInputMethods(boolean enable) { toolkit.lockAWT(); @@ -5496,11 +5085,10 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali } /** - * Gets an array of all component's listeners registered for this - * component. + * Gets an array of all component's listeners registered for this component. * * @return an array of all component's listeners registered for this - * component. + * component. */ public ComponentListener[] getComponentListeners() { return componentListeners.getUserListeners(new ComponentListener[0]); @@ -5510,7 +5098,8 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali * Adds the specified component listener to the Component for receiving * component's event. * - * @param l the ComponentListener. + * @param l + * the ComponentListener. */ public void addComponentListener(ComponentListener l) { componentListeners.addUserListener(l); @@ -5519,17 +5108,19 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali /** * Removes the component listener registered for this Component. * - * @param l the ComponentListener. + * @param l + * the ComponentListener. */ public void removeComponentListener(ComponentListener l) { componentListeners.removeUserListener(l); } /** - * Processes a component event that has occurred on this component - * by dispatching them to any registered ComponentListener objects. + * Processes a component event that has occurred on this component by + * dispatching them to any registered ComponentListener objects. * - * @param e the ComponentEvent. + * @param e + * the ComponentEvent. */ protected void processComponentEvent(ComponentEvent e) { processComponentEventImpl(e, componentListeners.getUserListeners()); @@ -5538,8 +5129,10 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali /** * Process component event impl. * - * @param e the e - * @param c the c + * @param e + * the e. + * @param c + * the c. */ private void processComponentEventImpl(ComponentEvent e, Collection c) { for (ComponentListener listener : c) { @@ -5570,10 +5163,11 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali } /** - * Adds the specified focus listener to the Component for receiving - * focus events. + * Adds the specified focus listener to the Component for receiving focus + * events. * - * @param l the FocusListener. + * @param l + * the FocusListener. */ public void addFocusListener(FocusListener l) { focusListeners.addUserListener(l); @@ -5582,7 +5176,8 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali /** * Adds the awt focus listener. * - * @param l the l + * @param l + * the l. */ void addAWTFocusListener(FocusListener l) { enableAWTEvents(AWTEvent.FOCUS_EVENT_MASK); @@ -5592,17 +5187,19 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali /** * Removes the focus listener registered for this Component. * - * @param l the FocusListener. + * @param l + * the FocusListener. */ public void removeFocusListener(FocusListener l) { focusListeners.removeUserListener(l); } /** - * Processes a FocusEvent that has occurred on this component - * by dispatching it to the registered listeners. - * - * @param e the FocusEvent. + * Processes a FocusEvent that has occurred on this component by dispatching + * it to the registered listeners. + * + * @param e + * the FocusEvent. */ protected void processFocusEvent(FocusEvent e) { processFocusEventImpl(e, focusListeners.getUserListeners()); @@ -5611,8 +5208,10 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali /** * Process focus event impl. * - * @param e the e - * @param c the c + * @param e + * the e. + * @param c + * the c. */ private void processFocusEventImpl(FocusEvent e, Collection c) { for (FocusListener listener : c) { @@ -5628,11 +5227,9 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali } /** - * Gets an array of registered HierarchyListeners for - * this Component. + * Gets an array of registered HierarchyListeners for this Component. * - * @return an array of registered HierarchyListeners for - * this Component. + * @return an array of registered HierarchyListeners for this Component. */ public HierarchyListener[] getHierarchyListeners() { return hierarchyListeners.getUserListeners(new HierarchyListener[0]); @@ -5641,7 +5238,8 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali /** * Adds the specified hierarchy listener. * - * @param l the HierarchyListener. + * @param l + * the HierarchyListener. */ public void addHierarchyListener(HierarchyListener l) { hierarchyListeners.addUserListener(l); @@ -5650,17 +5248,19 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali /** * Removes the hierarchy listener registered for this component. * - * @param l the HierarchyListener. + * @param l + * the HierarchyListener. */ public void removeHierarchyListener(HierarchyListener l) { hierarchyListeners.removeUserListener(l); } /** - * Processes a hierarchy event that has occurred on this component - * by dispatching it to the registered listeners. + * Processes a hierarchy event that has occurred on this component by + * dispatching it to the registered listeners. * - * @param e the HierarchyEvent. + * @param e + * the HierarchyEvent. */ protected void processHierarchyEvent(HierarchyEvent e) { for (HierarchyListener listener : hierarchyListeners.getUserListeners()) { @@ -5673,8 +5273,8 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali } /** - * Gets an array of HierarchyBoundsListener objects registered - * to this Component. + * Gets an array of HierarchyBoundsListener objects registered to this + * Component. * * @return an array of HierarchyBoundsListener objects. */ @@ -5685,7 +5285,8 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali /** * Adds the specified hierarchy bounds listener. * - * @param l the HierarchyBoundsListener. + * @param l + * the HierarchyBoundsListener. */ public void addHierarchyBoundsListener(HierarchyBoundsListener l) { hierarchyBoundsListeners.addUserListener(l); @@ -5694,17 +5295,19 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali /** * Removes the hierarchy bounds listener registered for this Component. * - * @param l the HierarchyBoundsListener. + * @param l + * the HierarchyBoundsListener. */ public void removeHierarchyBoundsListener(HierarchyBoundsListener l) { hierarchyBoundsListeners.removeUserListener(l); } /** - * Processes a hierarchy bounds event that has occurred on this component - * by dispatching it to the registered listeners. - * - * @param e the HierarchyBoundsEvent. + * Processes a hierarchy bounds event that has occurred on this component by + * dispatching it to the registered listeners. + * + * @param e + * the HierarchyBoundsEvent. */ protected void processHierarchyBoundsEvent(HierarchyEvent e) { for (HierarchyBoundsListener listener : hierarchyBoundsListeners.getUserListeners()) { @@ -5731,7 +5334,8 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali /** * Adds the specified key listener. * - * @param l the KeyListener. + * @param l + * the KeyListener. */ public void addKeyListener(KeyListener l) { keyListeners.addUserListener(l); @@ -5740,7 +5344,8 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali /** * Adds the awt key listener. * - * @param l the l + * @param l + * the l. */ void addAWTKeyListener(KeyListener l) { enableAWTEvents(AWTEvent.KEY_EVENT_MASK); @@ -5750,17 +5355,19 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali /** * Removes the key listener registered for this Component. * - * @param l the KeyListener. + * @param l + * the KeyListener. */ public void removeKeyListener(KeyListener l) { keyListeners.removeUserListener(l); } /** - * Processes a key event that has occurred on this component - * by dispatching it to the registered listeners. + * Processes a key event that has occurred on this component by dispatching + * it to the registered listeners. * - * @param e the KeyEvent. + * @param e + * the KeyEvent. */ protected void processKeyEvent(KeyEvent e) { processKeyEventImpl(e, keyListeners.getUserListeners()); @@ -5769,8 +5376,10 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali /** * Process key event impl. * - * @param e the e - * @param c the c + * @param e + * the e. + * @param c + * the c. */ private void processKeyEventImpl(KeyEvent e, Collection c) { for (KeyListener listener : c) { @@ -5800,7 +5409,8 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali /** * Adds the specified mouse listener. * - * @param l the MouseListener. + * @param l + * the MouseListener. */ public void addMouseListener(MouseListener l) { mouseListeners.addUserListener(l); @@ -5809,7 +5419,8 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali /** * Adds the awt mouse listener. * - * @param l the l + * @param l + * the l. */ void addAWTMouseListener(MouseListener l) { enableAWTEvents(AWTEvent.MOUSE_EVENT_MASK); @@ -5819,7 +5430,8 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali /** * Adds the awt mouse motion listener. * - * @param l the l + * @param l + * the l. */ void addAWTMouseMotionListener(MouseMotionListener l) { enableAWTEvents(AWTEvent.MOUSE_MOTION_EVENT_MASK); @@ -5829,7 +5441,8 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali /** * Adds the awt component listener. * - * @param l the l + * @param l + * the l. */ void addAWTComponentListener(ComponentListener l) { enableAWTEvents(AWTEvent.COMPONENT_EVENT_MASK); @@ -5839,7 +5452,8 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali /** * Adds the awt input method listener. * - * @param l the l + * @param l + * the l. */ void addAWTInputMethodListener(InputMethodListener l) { enableAWTEvents(AWTEvent.INPUT_METHOD_EVENT_MASK); @@ -5849,7 +5463,8 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali /** * Adds the awt mouse wheel listener. * - * @param l the l + * @param l + * the l. */ void addAWTMouseWheelListener(MouseWheelListener l) { enableAWTEvents(AWTEvent.MOUSE_WHEEL_EVENT_MASK); @@ -5859,17 +5474,19 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali /** * Removes the mouse listener registered for this Component. * - * @param l the MouseListener. + * @param l + * the MouseListener. */ public void removeMouseListener(MouseListener l) { mouseListeners.removeUserListener(l); } /** - * Processes a mouse event that has occurred on this component - * by dispatching it to the registered listeners. + * Processes a mouse event that has occurred on this component by + * dispatching it to the registered listeners. * - * @param e the MouseEvent. + * @param e + * the MouseEvent. */ protected void processMouseEvent(MouseEvent e) { processMouseEventImpl(e, mouseListeners.getUserListeners()); @@ -5878,8 +5495,10 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali /** * Process mouse event impl. * - * @param e the e - * @param c the c + * @param e + * the e. + * @param c + * the c. */ private void processMouseEventImpl(MouseEvent e, Collection c) { for (MouseListener listener : c) { @@ -5906,8 +5525,10 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali /** * Process mouse motion event impl. * - * @param e the e - * @param c the c + * @param e + * the e. + * @param c + * the c. */ private void processMouseMotionEventImpl(MouseEvent e, Collection c) { for (MouseMotionListener listener : c) { @@ -5923,11 +5544,9 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali } /** - * Gets an array of the mouse motion listeners registered to - * the Component. + * Gets an array of the mouse motion listeners registered to the Component. * - * @return an array of the MouseMotionListeners registered to - * the Component. + * @return an array of the MouseMotionListeners registered to the Component. */ public MouseMotionListener[] getMouseMotionListeners() { return mouseMotionListeners.getUserListeners(new MouseMotionListener[0]); @@ -5936,7 +5555,8 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali /** * Adds the specified mouse motion listener. * - * @param l the MouseMotionListener. + * @param l + * the MouseMotionListener. */ public void addMouseMotionListener(MouseMotionListener l) { mouseMotionListeners.addUserListener(l); @@ -5945,28 +5565,28 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali /** * Removes the mouse motion listener registered for this component. * - * @param l the MouseMotionListener. + * @param l + * the MouseMotionListener. */ public void removeMouseMotionListener(MouseMotionListener l) { mouseMotionListeners.removeUserListener(l); } /** - * Processes a mouse motion event that has occurred on this component - * by dispatching it to the registered listeners. + * Processes a mouse motion event that has occurred on this component by + * dispatching it to the registered listeners. * - * @param e the MouseEvent. + * @param e + * the MouseEvent. */ protected void processMouseMotionEvent(MouseEvent e) { processMouseMotionEventImpl(e, mouseMotionListeners.getUserListeners()); } /** - * Gets an array of the mouse wheel listeners registered to - * the Component. + * Gets an array of the mouse wheel listeners registered to the Component. * - * @return an array of the MouseWheelListeners registered to - * the Component. + * @return an array of the MouseWheelListeners registered to the Component. */ public MouseWheelListener[] getMouseWheelListeners() { return mouseWheelListeners.getUserListeners(new MouseWheelListener[0]); @@ -5975,7 +5595,8 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali /** * Adds the specified mouse wheel listener. * - * @param l the MouseWheelListener. + * @param l + * the MouseWheelListener. */ public void addMouseWheelListener(MouseWheelListener l) { mouseWheelListeners.addUserListener(l); @@ -5984,28 +5605,30 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali /** * Removes the mouse wheel listener registered for this component. * - * @param l the MouseWheelListener. + * @param l + * the MouseWheelListener. */ public void removeMouseWheelListener(MouseWheelListener l) { mouseWheelListeners.removeUserListener(l); } /** - * Processes a mouse wheel event that has occurred on this component - * by dispatching it to the registered listeners. + * Processes a mouse wheel event that has occurred on this component by + * dispatching it to the registered listeners. * - * @param e the MouseWheelEvent. + * @param e + * the MouseWheelEvent. */ protected void processMouseWheelEvent(MouseWheelEvent e) { processMouseWheelEventImpl(e, mouseWheelListeners.getUserListeners()); } /** - * Gets an array of the InputMethodListener listeners - * registered to the Component. + * Gets an array of the InputMethodListener listeners registered to the + * Component. * - * @return an array of the InputMethodListener listeners - * registered to the Component. + * @return an array of the InputMethodListener listeners registered to the + * Component. */ public InputMethodListener[] getInputMethodListeners() { return inputMethodListeners.getUserListeners(new InputMethodListener[0]); @@ -6014,7 +5637,8 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali /** * Adds the specified input method listener. * - * @param l the InputMethodListener. + * @param l + * the InputMethodListener. */ public void addInputMethodListener(InputMethodListener l) { inputMethodListeners.addUserListener(l); @@ -6023,17 +5647,19 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali /** * Removes the input method listener registered for this component. * - * @param l the InputMethodListener. + * @param l + * the InputMethodListener. */ public void removeInputMethodListener(InputMethodListener l) { inputMethodListeners.removeUserListener(l); } /** - * Processes an input method event that has occurred on this component - * by dispatching it to the registered listeners. + * Processes an input method event that has occurred on this component by + * dispatching it to the registered listeners. * - * @param e the InputMethodEvent. + * @param e + * the InputMethodEvent. */ protected void processInputMethodEvent(InputMethodEvent e) { processInputMethodEventImpl(e, inputMethodListeners.getUserListeners()); @@ -6042,11 +5668,12 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali /** * Process input method event impl. * - * @param e the e - * @param c the c + * @param e + * the e. + * @param c + * the c. */ - private void processInputMethodEventImpl(InputMethodEvent e, - Collection c) { + private void processInputMethodEventImpl(InputMethodEvent e, Collection c) { for (InputMethodListener listener : c) { switch (e.getID()) { case InputMethodEvent.CARET_POSITION_CHANGED: @@ -6059,31 +5686,28 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali } } - //???AWT + // ???AWT /* - public Point getMousePosition() throws HeadlessException { - Point absPointerPos = MouseInfo.getPointerInfo().getLocation(); - Window winUnderPtr = toolkit.dispatcher.mouseDispatcher.findWindowAt(absPointerPos); - Point pointerPos = MouseDispatcher.convertPoint(null, absPointerPos, winUnderPtr); - boolean isUnderPointer = false; - if (winUnderPtr == null) { - return null; - } - isUnderPointer = winUnderPtr.isComponentAt(this, pointerPos); - if (isUnderPointer) { - return MouseDispatcher.convertPoint(null, absPointerPos, this); - } - return null; - } - */ + * public Point getMousePosition() throws HeadlessException { Point + * absPointerPos = MouseInfo.getPointerInfo().getLocation(); Window + * winUnderPtr = + * toolkit.dispatcher.mouseDispatcher.findWindowAt(absPointerPos); Point + * pointerPos = MouseDispatcher.convertPoint(null, absPointerPos, + * winUnderPtr); boolean isUnderPointer = false; if (winUnderPtr == null) { + * return null; } isUnderPointer = winUnderPtr.isComponentAt(this, + * pointerPos); if (isUnderPointer) { return + * MouseDispatcher.convertPoint(null, absPointerPos, this); } return null; } + */ /** * Set native caret at the given position
* Note: this method takes AWT lock inside because it walks through the * component hierarchy. * - * @param x the x - * @param y the y + * @param x + * the x. + * @param y + * the y. */ void setCaretPos(final int x, final int y) { Runnable r = new Runnable() { @@ -6106,35 +5730,34 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali /** * This method should be called only at event dispatch thread. * - * @param x the x - * @param y the y + * @param x + * the x. + * @param y + * the y. */ void setCaretPosImpl(int x, int y) { Component c = this; while ((c != null) && c.behaviour.isLightweight()) { x += c.x; y += c.y; - //???AWT: c = c.getParent(); + // ???AWT: c = c.getParent(); } if (c == null) { return; } - //???AWT + // ???AWT /* - if (c instanceof Window) { - Insets insets = c.getNativeInsets(); - x -= insets.left; - y -= insets.top; - } - toolkit.getWindowFactory().setCaretPosition(x, y); - */ + * if (c instanceof Window) { Insets insets = c.getNativeInsets(); x -= + * insets.left; y -= insets.top; } + * toolkit.getWindowFactory().setCaretPosition(x, y); + */ } // to be overridden in standard components such as Button and List /** * Gets the default minimum size. * - * @return the default minimum size + * @return the default minimum size. */ Dimension getDefaultMinimumSize() { return null; @@ -6144,7 +5767,7 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali /** * Gets the default preferred size. * - * @return the default preferred size + * @return the default preferred size. */ Dimension getDefaultPreferredSize() { return null; @@ -6157,30 +5780,28 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali void resetDefaultSize() { } - //???AWT + // ???AWT /* - ComponentBehavior createBehavior() { - return new LWBehavior(this); - } - */ + * ComponentBehavior createBehavior() { return new LWBehavior(this); } + */ /** * Gets the default background. * - * @return the default background + * @return the default background. */ Color getDefaultBackground() { - //???AWT: return getWindowAncestor().getDefaultBackground(); + // ???AWT: return getWindowAncestor().getDefaultBackground(); return getBackground(); } /** * Gets the default foreground. * - * @return the default foreground + * @return the default foreground. */ Color getDefaultForeground() { - //???AWT return getWindowAncestor().getDefaultForeground(); + // ???AWT return getWindowAncestor().getDefaultForeground(); return getForeground(); } @@ -6188,7 +5809,8 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali * Called when native resource for this component is created (for * heavyweights only). * - * @param win the win + * @param win + * the win. */ void nativeWindowCreated(NativeWindow win) { // to be overridden @@ -6198,48 +5820,37 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali * Determine the component's area hidden behind the windows that have higher * Z-order, including windows of other applications. * - * @param image the image - * @param destLocation the dest location - * @param destSize the dest size - * @param source the source - * - * @return the calculated region, or null if it cannot be determined - */ - //???AWT + * @param image + * the image. + * @param destLocation + * the dest location. + * @param destSize + * the dest size. + * @param source + * the source. + * @return the calculated region, or null if it cannot be determined. + */ + // ???AWT /* - MultiRectArea getObscuredRegion(Rectangle part) { - if (!visible || parent == null || !parent.visible) { - return null; - } - Rectangle r = new Rectangle(0, 0, w, h); - if (part != null) { - r = r.intersection(part); - } - if (r.isEmpty()) { - return null; - } - r.translate(x, y); - MultiRectArea ret = parent.getObscuredRegion(r); - if (ret != null) { - parent.addObscuredRegions(ret, this); - ret.translate(-x, -y); - ret.intersect(new Rectangle(0, 0, w, h)); - } - return ret; - } - */ + * MultiRectArea getObscuredRegion(Rectangle part) { if (!visible || parent + * == null || !parent.visible) { return null; } Rectangle r = new + * Rectangle(0, 0, w, h); if (part != null) { r = r.intersection(part); } if + * (r.isEmpty()) { return null; } r.translate(x, y); MultiRectArea ret = + * parent.getObscuredRegion(r); if (ret != null) { + * parent.addObscuredRegions(ret, this); ret.translate(-x, -y); + * ret.intersect(new Rectangle(0, 0, w, h)); } return ret; } + */ - //???AWT + // ???AWT /* - private void readObject(ObjectInputStream stream) throws IOException, - ClassNotFoundException { - stream.defaultReadObject(); - FieldsAccessor accessor = new FieldsAccessor(Component.class, this); - accessor.set("toolkit", Toolkit.getDefaultToolkit()); //$NON-NLS-1$ - accessor.set("behaviour", createBehavior()); //$NON-NLS-1$ - accessor.set("componentLock", new Object()); // $NON-LOCK-1$ //$NON-NLS-1$ - } - */ + * private void readObject(ObjectInputStream stream) throws IOException, + * ClassNotFoundException { stream.defaultReadObject(); FieldsAccessor + * accessor = new FieldsAccessor(Component.class, this); + * accessor.set("toolkit", Toolkit.getDefaultToolkit()); //$NON-NLS-1$ + * accessor.set("behaviour", createBehavior()); //$NON-NLS-1$ + * accessor.set("componentLock", new Object()); // $NON-LOCK-1$ + * //$NON-NLS-1$ } + */ final void onDrawImage(Image image, Point destLocation, Dimension destSize, Rectangle source) { ImageParameters imageParams; @@ -6272,33 +5883,37 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali } } - //???AWT + // ???AWT /* - private void invalidateRealParent() { - Container realParent = getRealParent(); - if ((realParent != null) && realParent.isValid()) { - realParent.invalidate(); - } - } - */ + * private void invalidateRealParent() { Container realParent = + * getRealParent(); if ((realParent != null) && realParent.isValid()) { + * realParent.invalidate(); } } + */ /** * The Class ImageParameters. */ private class ImageParameters { - - /** The drawing params. */ + + /** + * The drawing params. + */ private final LinkedList drawingParams = new LinkedList(); - /** The size. */ + /** + * The size. + */ Dimension size = new Dimension(Component.this.w, Component.this.h); /** * Adds the drawing. * - * @param destLocation the dest location - * @param destSize the dest size - * @param source the source + * @param destLocation + * the dest location. + * @param destSize + * the dest size. + * @param source + * the source. */ void addDrawing(Point destLocation, Dimension destSize, Rectangle source) { drawingParams.add(new DrawingParameters(destLocation, destSize, source)); @@ -6307,7 +5922,7 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali /** * Drawing parameters iterator. * - * @return the iterator< drawing parameters> + * @return the iterator< drawing parameters>. */ Iterator drawingParametersIterator() { return drawingParams.iterator(); @@ -6317,22 +5932,31 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali * The Class DrawingParameters. */ class DrawingParameters { - - /** The dest location. */ + + /** + * The dest location. + */ Point destLocation; - /** The dest size. */ + /** + * The dest size. + */ Dimension destSize; - /** The source. */ + /** + * The source. + */ Rectangle source; /** * Instantiates a new drawing parameters. * - * @param destLocation the dest location - * @param destSize the dest size - * @param source the source + * @param destLocation + * the dest location. + * @param destSize + * the dest size. + * @param source + * the source. */ DrawingParameters(Point destLocation, Dimension destSize, Rectangle source) { this.destLocation = new Point(destLocation); @@ -6353,44 +5977,32 @@ public abstract class Component implements ImageObserver, MenuContainer, Seriali /** * TextComponent support. * - * @param e the e - * - * @return true, if dispatch event to im + * @param e + * the e. + * @return true, if dispatch event to im. */ - //???AWT + // ???AWT /* - private TextKit textKit = null; - - TextKit getTextKit() { - return textKit; - } - - void setTextKit(TextKit kit) { - textKit = kit; - } - */ + * private TextKit textKit = null; TextKit getTextKit() { return textKit; } + * void setTextKit(TextKit kit) { textKit = kit; } + */ /** - * TextField support + * TextField support. */ - //???AWT + // ???AWT /* - private TextFieldKit textFieldKit = null; - - TextFieldKit getTextFieldKit() { - return textFieldKit; - } - - void setTextFieldKit(TextFieldKit kit) { - textFieldKit = kit; - } - */ + * private TextFieldKit textFieldKit = null; TextFieldKit getTextFieldKit() + * { return textFieldKit; } void setTextFieldKit(TextFieldKit kit) { + * textFieldKit = kit; } + */ /** - * Dispatches input & focus events to input method - * context. - * @param e event to pass to InputContext.dispatchEvent() - * @return true if event was consumed by IM, false otherwise + * Dispatches input & focus events to input method context. + * + * @param e + * event to pass to InputContext.dispatchEvent(). + * @return true if event was consumed by IM, false otherwise. */ private boolean dispatchEventToIM(AWTEvent e) { InputContext ic = getInputContext(); diff --git a/awt/java/awt/ComponentBehavior.java b/awt/java/awt/ComponentBehavior.java index 89c9999a622e2..f4e8ffbf20452 100644 --- a/awt/java/awt/ComponentBehavior.java +++ b/awt/java/awt/ComponentBehavior.java @@ -24,7 +24,7 @@ import org.apache.harmony.awt.wtk.NativeWindow; /** * The interface of the helper object that encapsulates the difference - * between lightweight and heavyweight components. + * between lightweight and heavyweight components. */ interface ComponentBehavior { diff --git a/awt/java/awt/ComponentOrientation.java b/awt/java/awt/ComponentOrientation.java index ddb118d592d41..5acc11a341951 100644 --- a/awt/java/awt/ComponentOrientation.java +++ b/awt/java/awt/ComponentOrientation.java @@ -18,44 +18,59 @@ * @author Michael Danilov, Dmitry A. Durnev * @version $Revision$ */ + package java.awt; import java.io.Serializable; import java.util.*; /** - * The ComponentOrientation class specifies the language-sensitive orientation - * of component's elements or text. It is used to reflect the differences in this - * ordering between different writting systems. The ComponentOrientation class - * indicates the orientation of the elements/text in the horizontal direction - * ("left to right" or "right to left") and in the vertical direction + * The ComponentOrientation class specifies the language-sensitive orientation + * of component's elements or text. It is used to reflect the differences in + * this ordering between different writing systems. The ComponentOrientation + * class indicates the orientation of the elements/text in the horizontal + * direction ("left to right" or "right to left") and in the vertical direction * ("top to bottom" or "bottom to top"). + * + * @since Android 1.0 */ public final class ComponentOrientation implements Serializable { - - /** The Constant serialVersionUID. */ + + /** + * The Constant serialVersionUID. + */ private static final long serialVersionUID = -4113291392143563828L; - /** + /** * The Constant LEFT_TO_RIGHT indicates that items run left to right. */ public static final ComponentOrientation LEFT_TO_RIGHT = new ComponentOrientation(true, true); - /** + /** * The Constant RIGHT_TO_LEFT indicates that items run right to left. */ public static final ComponentOrientation RIGHT_TO_LEFT = new ComponentOrientation(true, false); - /** The Constant UNKNOWN indicates that a component's orientation is not set. */ + /** + * The Constant UNKNOWN indicates that a component's orientation is not set. + */ public static final ComponentOrientation UNKNOWN = new ComponentOrientation(true, true); - /** The Constant rlLangs. */ - private static final Set rlLangs = new HashSet(); //RIGHT_TO_LEFT languages + /** + * The Constant rlLangs. + */ + private static final Set rlLangs = new HashSet(); // RIGHT_TO_LEFT - /** The horizontal. */ + // languages + + /** + * The horizontal. + */ private final boolean horizontal; - /** The left2right. */ + /** + * The left2right. + */ private final boolean left2right; static { @@ -68,10 +83,9 @@ public final class ComponentOrientation implements Serializable { /** * Gets the orientation for the given ResourceBundle's localization. * - * @param bdl the ResourceBundle. - * + * @param bdl + * the ResourceBundle. * @return the ComponentOrientation. - * * @deprecated Use getOrientation(java.util.Locale) method. */ @Deprecated @@ -79,12 +93,11 @@ public final class ComponentOrientation implements Serializable { Object obj = null; try { obj = bdl.getObject("Orientation"); //$NON-NLS-1$ - } - catch (MissingResourceException mre) { + } catch (MissingResourceException mre) { obj = null; } if (obj instanceof ComponentOrientation) { - return (ComponentOrientation) obj; + return (ComponentOrientation)obj; } Locale locale = bdl.getLocale(); if (locale == null) { @@ -96,8 +109,8 @@ public final class ComponentOrientation implements Serializable { /** * Gets the orientation for the specified locale. * - * @param locale the specified Locale. - * + * @param locale + * the specified Locale. * @return the ComponentOrientation. */ public static ComponentOrientation getOrientation(Locale locale) { @@ -108,8 +121,10 @@ public final class ComponentOrientation implements Serializable { /** * Instantiates a new component orientation. * - * @param hor whether the items should be arranged horizontally - * @param l2r whether this orientation specifies a left-to-right flow + * @param hor + * whether the items should be arranged horizontally. + * @param l2r + * whether this orientation specifies a left-to-right flow. */ private ComponentOrientation(boolean hor, boolean l2r) { horizontal = hor; @@ -117,11 +132,10 @@ public final class ComponentOrientation implements Serializable { } /** - * Returns true if the text of the of writing systems arranged - * horizontally. + * Returns true if the text of the of writing systems arranged horizontally. * - * @return true, if the text is written horizontally, false - * for a vertical arrangement. + * @return true, if the text is written horizontally, false for a vertical + * arrangement. */ public boolean isHorizontal() { return horizontal; @@ -130,8 +144,8 @@ public final class ComponentOrientation implements Serializable { /** * Returns true if the text is arranged from left to right. * - * @return true, for writing systems written from left to right; - * false for right-to-left. + * @return true, for writing systems written from left to right; false for + * right-to-left. */ public boolean isLeftToRight() { return left2right; diff --git a/awt/java/awt/Composite.java b/awt/java/awt/Composite.java index 8e5b90a676b1f..d1730fef4a677 100644 --- a/awt/java/awt/Composite.java +++ b/awt/java/awt/Composite.java @@ -18,30 +18,34 @@ * @author Igor V. Stolyarov * @version $Revision$ */ + package java.awt; import java.awt.image.ColorModel; /** - * The Composite interface allows the methods to compose a draw primitive - * on the graphics area. The classes implementing this interface provides - * the rules and a method to create the context for a particular operation. + * The Composite interface allows the methods to compose a draw primitive on the + * graphics area. The classes implementing this interface provides the rules and + * a method to create the context for a particular operation. + * + * @since Android 1.0 */ public interface Composite { /** - * Creates a CompositeContext which defines the encapsulated and - * optimized environment for a compositing operation. Several contexts - * can exist for a single Composite object. - * - * @param srcColorModel the source's ColorModel. - * @param dstColorModel the destination's ColorModel. - * @param hints the RenderingHints. + * Creates a CompositeContext which defines the encapsulated and optimized + * environment for a compositing operation. Several contexts can exist for a + * single Composite object. * + * @param srcColorModel + * the source's ColorModel. + * @param dstColorModel + * the destination's ColorModel. + * @param hints + * the RenderingHints. * @return the CompositeContext object. */ - public CompositeContext createContext(ColorModel srcColorModel, - ColorModel dstColorModel, RenderingHints hints); + public CompositeContext createContext(ColorModel srcColorModel, ColorModel dstColorModel, + RenderingHints hints); } - diff --git a/awt/java/awt/CompositeContext.java b/awt/java/awt/CompositeContext.java index c6760325b6ad6..795640d429a4c 100644 --- a/awt/java/awt/CompositeContext.java +++ b/awt/java/awt/CompositeContext.java @@ -18,25 +18,31 @@ * @author Igor V. Stolyarov * @version $Revision$ */ + package java.awt; import java.awt.image.Raster; import java.awt.image.WritableRaster; /** - * The CompositeContext interface specifies the encapsulated and optimized - * environment for a compositing operation. + * The CompositeContext interface specifies the encapsulated and optimized + * environment for a compositing operation. + * + * @since Android 1.0 */ public interface CompositeContext { /** - * Composes the two source Raster objects and places the result in the - * destination WritableRaster. + * Composes the two source Raster objects and places the result in the + * destination WritableRaster. * - * @param src the source Raster. - * @param dstIn the destination Raster. - * @param dstOut the WritableRaster object where the result of - * composing operation is stored. + * @param src + * the source Raster. + * @param dstIn + * the destination Raster. + * @param dstOut + * the WritableRaster object where the result of composing + * operation is stored. */ public void compose(Raster src, Raster dstIn, WritableRaster dstOut); @@ -46,4 +52,3 @@ public interface CompositeContext { public void dispose(); } - diff --git a/awt/java/awt/Cursor.java b/awt/java/awt/Cursor.java index 625686c90ab5e..0a0cc8498722b 100644 --- a/awt/java/awt/Cursor.java +++ b/awt/java/awt/Cursor.java @@ -18,6 +18,7 @@ * @author Dmitry A. Durnev * @version $Revision$ */ + package java.awt; import java.io.File; @@ -35,61 +36,99 @@ import org.apache.harmony.awt.wtk.NativeCursor; /** * The Cursor class represents the bitmap of the mouse cursor. + * + * @since Android 1.0 */ public class Cursor implements Serializable { - - /** The Constant serialVersionUID. */ + + /** + * The Constant serialVersionUID. + */ private static final long serialVersionUID = 8028237497568985504L; - - /** The Constant DEFAULT_CURSOR indicates the default cursor type. */ + + /** + * The Constant DEFAULT_CURSOR indicates the default cursor type. + */ public static final int DEFAULT_CURSOR = 0; - /** The Constant CROSSHAIR_CURSOR cursor type. */ + /** + * The Constant CROSSHAIR_CURSOR cursor type. + */ public static final int CROSSHAIR_CURSOR = 1; - /** The Constant TEXT_CURSOR cursor type. */ + /** + * The Constant TEXT_CURSOR cursor type. + */ public static final int TEXT_CURSOR = 2; - /** The Constant WAIT_CURSOR cursor type. */ + /** + * The Constant WAIT_CURSOR cursor type. + */ public static final int WAIT_CURSOR = 3; - /** The Constant SW_RESIZE_CURSOR cursor type. */ + /** + * The Constant SW_RESIZE_CURSOR cursor type. + */ public static final int SW_RESIZE_CURSOR = 4; - /** The Constant SE_RESIZE_CURSOR cursor type. */ + /** + * The Constant SE_RESIZE_CURSOR cursor type. + */ public static final int SE_RESIZE_CURSOR = 5; - /** The Constant NW_RESIZE_CURSOR cursor type. */ + /** + * The Constant NW_RESIZE_CURSOR cursor type. + */ public static final int NW_RESIZE_CURSOR = 6; - /** The Constant NE_RESIZE_CURSOR cursor type. */ + /** + * The Constant NE_RESIZE_CURSOR cursor type. + */ public static final int NE_RESIZE_CURSOR = 7; - /** The Constant N_RESIZE_CURSOR cursor type. */ + /** + * The Constant N_RESIZE_CURSOR cursor type. + */ public static final int N_RESIZE_CURSOR = 8; - /** The Constant S_RESIZE_CURSOR cursor type. */ + /** + * The Constant S_RESIZE_CURSOR cursor type. + */ public static final int S_RESIZE_CURSOR = 9; - /** The Constant W_RESIZE_CURSOR cursor type. */ + /** + * The Constant W_RESIZE_CURSOR cursor type. + */ public static final int W_RESIZE_CURSOR = 10; - /** The Constant E_RESIZE_CURSOR cursor type. */ + /** + * The Constant E_RESIZE_CURSOR cursor type. + */ public static final int E_RESIZE_CURSOR = 11; - /** The Constant HAND_CURSOR cursor type. */ + /** + * The Constant HAND_CURSOR cursor type. + */ public static final int HAND_CURSOR = 12; - /** The Constant MOVE_CURSOR cursor type. */ + /** + * The Constant MOVE_CURSOR cursor type. + */ public static final int MOVE_CURSOR = 13; - /** A mapping from names to system custom cursors. */ + /** + * A mapping from names to system custom cursors. + */ static Map systemCustomCursors; - - /** The cursor props. */ + + /** + * The cursor props. + */ static Properties cursorProps; - /** The Constant predefinedNames. */ + /** + * The Constant predefinedNames. + */ static final String[] predefinedNames = { "Default", "Crosshair", "Text", "Wait", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ "Southwest Resize", "Southeast Resize", //$NON-NLS-1$ //$NON-NLS-2$ @@ -99,41 +138,52 @@ public class Cursor implements Serializable { }; - /** The predefined set of cursors. */ + /** + * The predefined set of cursors. + */ protected static Cursor[] predefined = { - new Cursor(DEFAULT_CURSOR), null, null, null, - null, null, null, null, - null, null, null, null, - null, null + new Cursor(DEFAULT_CURSOR), null, null, null, null, null, null, null, null, null, null, + null, null, null }; - /** The Constant CUSTOM_CURSOR is associated with all custom cursor types. + /** + * The Constant CUSTOM_CURSOR is associated with all custom cursor types. * (Those which are not predefined) */ public static final int CUSTOM_CURSOR = -1; - /** The name of the cursor. */ + /** + * The name of the cursor. + */ protected String name; - /** The type of the cursor, chosen from the list of cursor type constants. */ + /** + * The type of the cursor, chosen from the list of cursor type constants. + */ private final int type; - - /** The native cursor. */ + + /** + * The native cursor. + */ private transient NativeCursor nativeCursor; - - /** The exact point on the cursor image that indicates which point - * the cursor is selecting (pointing to). The coordinates are given - * with respect the origin of the Image (its upper left corner). + + /** + * The exact point on the cursor image that indicates which point the cursor + * is selecting (pointing to). The coordinates are given with respect the + * origin of the Image (its upper left corner). */ private Point hotSpot; - - /** The image to draw on the screen representing the cursor. */ + + /** + * The image to draw on the screen representing the cursor. + */ private Image image; /** * Instantiates a new cursor with the specified name. * - * @param name the name of cursor. + * @param name + * the name of cursor. */ protected Cursor(String name) { this(name, null, new Point()); @@ -142,7 +192,8 @@ public class Cursor implements Serializable { /** * Instantiates a new cursor of the specified type. * - * @param type the type of cursor. + * @param type + * the type of cursor. */ public Cursor(int type) { checkType(type); @@ -155,9 +206,12 @@ public class Cursor implements Serializable { /** * Instantiates a new cursor. * - * @param name the name - * @param img the img - * @param hotSpot the hot spot + * @param name + * the name. + * @param img + * the img. + * @param hotSpot + * the hot spot. */ Cursor(String name, Image img, Point hotSpot) { this.name = name; @@ -167,10 +221,11 @@ public class Cursor implements Serializable { } /** - * Finalize method overrided finalize method from Object class. + * Finalize method overrides the finalize method from Object class. * - * @throws Throwable if the native cursor is not null and throws - * a throwable when destroyed. + * @throws Throwable + * if the native cursor is not null and throws a Throwable when + * destroyed. */ @Override protected void finalize() throws Throwable { @@ -201,7 +256,7 @@ public class Cursor implements Serializable { /** * Gets the cursor type. * - * @return the cursor type + * @return the cursor type. */ public int getType() { return type; @@ -210,8 +265,8 @@ public class Cursor implements Serializable { /** * Gets the predefined cursor with the specified type. * - * @param type the type of cursor. - * + * @param type + * the type of cursor. * @return the predefined cursor with the specified type. */ public static Cursor getPredefinedCursor(int type) { @@ -236,33 +291,33 @@ public class Cursor implements Serializable { /** * Gets the specified system custom cursor. * - * @param name the name of the desired system cursor. - * + * @param name + * the name of the desired system cursor. * @return the specific system cursor with the specified name. - * - * @throws AWTException if the desired cursor has malformed data - * such as an incorrectly defined hot spot. - * @throws HeadlessException if the isHeadless method of the GraphicsEnvironment - * returns true. + * @throws AWTException + * if the desired cursor has malformed data such as an + * incorrectly defined hot spot. + * @throws HeadlessException + * if the isHeadless method of the GraphicsEnvironment returns + * true. */ - public static Cursor getSystemCustomCursor(String name) - throws AWTException, HeadlessException { + public static Cursor getSystemCustomCursor(String name) throws AWTException, HeadlessException { Toolkit.checkHeadless(); return getSystemCustomCursorFromMap(name); } /** - * Gets the specified system custom cursor from the map of system custom cursors. + * Gets the specified system custom cursor from the map of system custom + * cursors. * - * @param name the name of the desired cursor. - * - * @return the desired system custom cursor from the - * map of system custom cursors. - * - * @throws AWTException the AWT exception + * @param name + * the name of the desired cursor. + * @return the desired system custom cursor from the map of system custom + * cursors. + * @throws AWTException + * the AWT exception. */ - private static Cursor getSystemCustomCursorFromMap (String name) - throws AWTException { + private static Cursor getSystemCustomCursorFromMap(String name) throws AWTException { loadCursorProps(); if (systemCustomCursors == null) { systemCustomCursors = new HashMap(); @@ -284,8 +339,7 @@ public class Cursor implements Serializable { int x, y; try { x = new Integer(hotSpotStr.substring(0, idx)).intValue(); - y = new Integer(hotSpotStr.substring(idx + 1, - hotSpotStr.length())).intValue(); + y = new Integer(hotSpotStr.substring(idx + 1, hotSpotStr.length())).intValue(); } catch (NumberFormatException nfe) { throw new AWTException(exMsg); } @@ -299,7 +353,8 @@ public class Cursor implements Serializable { /** * Load cursor props. * - * @throws AWTException the AWT exception + * @throws AWTException + * the AWT exception. */ private static void loadCursorProps() throws AWTException { if (cursorProps != null) { @@ -308,18 +363,18 @@ public class Cursor implements Serializable { String sep = File.separator; String cursorsDir = "lib" + sep + "images" + sep + "cursors"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ String cursorsAbsDir = System.getProperty("java.home") + sep + //$NON-NLS-1$ - cursorsDir; + cursorsDir; String cursorPropsFileName = "cursors.properties"; //$NON-NLS-1$ - String cursorPropsFullFileName = (cursorsAbsDir + sep + - cursorPropsFileName); + String cursorPropsFullFileName = (cursorsAbsDir + sep + cursorPropsFileName); cursorProps = new Properties(); try { - cursorProps.load(new FileInputStream(new File( - cursorPropsFullFileName))); + cursorProps.load(new FileInputStream(new File(cursorPropsFullFileName))); } catch (FileNotFoundException e) { // awt.142=Exception: class {0} {1} occurred while loading: {2} throw new AWTException(Messages.getString("awt.142",//$NON-NLS-1$ - new Object[]{e.getClass(), e.getMessage(), cursorPropsFullFileName})); + new Object[] { + e.getClass(), e.getMessage(), cursorPropsFullFileName + })); } catch (IOException e) { throw new AWTException(e.getMessage()); } @@ -329,7 +384,8 @@ public class Cursor implements Serializable { /** * Check type. * - * @param type the type + * @param type + * the type. */ static void checkType(int type) { // can't use predefined array here because it may not have been @@ -344,7 +400,7 @@ public class Cursor implements Serializable { /** * Gets the native cursor. * - * @return the native cursor + * @return the native cursor. */ NativeCursor getNativeCursor() { if (nativeCursor != null) { @@ -354,8 +410,7 @@ public class Cursor implements Serializable { if (type != CUSTOM_CURSOR) { nativeCursor = toolkit.createNativeCursor(type); } else { - nativeCursor = toolkit.createCustomNativeCursor(image, hotSpot, - name); + nativeCursor = toolkit.createCustomNativeCursor(image, hotSpot, name); } return nativeCursor; } @@ -363,10 +418,10 @@ public class Cursor implements Serializable { /** * Sets the native cursor. * - * @param nativeCursor the new native cursor + * @param nativeCursor + * the new native cursor. */ void setNativeCursor(NativeCursor nativeCursor) { this.nativeCursor = nativeCursor; } } - diff --git a/awt/java/awt/Dimension.java b/awt/java/awt/Dimension.java index 8137846018d2d..6777962e7a37a 100644 --- a/awt/java/awt/Dimension.java +++ b/awt/java/awt/Dimension.java @@ -18,6 +18,7 @@ * @author Denis M. Kishenko * @version $Revision$ */ + package java.awt; import java.awt.geom.Dimension2D; @@ -26,26 +27,36 @@ import java.io.Serializable; import org.apache.harmony.misc.HashCode; /** - * The Dimension represents the size (width and height) of a component. - * The width and height values can be negative, but in that case the - * behavior of some methods is unexpected. + * The Dimension represents the size (width and height) of a component. The + * width and height values can be negative, but in that case the behavior of + * some methods is unexpected. + * + * @since Android 1.0 */ public class Dimension extends Dimension2D implements Serializable { - /** The Constant serialVersionUID. */ + /** + * The Constant serialVersionUID. + */ private static final long serialVersionUID = 4723952579491349524L; - /** The width dimension. */ + /** + * The width dimension. + */ public int width; - - /** The height dimension. */ + + /** + * The height dimension. + */ public int height; /** - * Instantiates a new Dimension with the same data as the specified Dimension. + * Instantiates a new Dimension with the same data as the specified + * Dimension. * - * @param d the Dimension to copy the data from when creating the - * new Dimension object. + * @param d + * the Dimension to copy the data from when creating the new + * Dimension object. */ public Dimension(Dimension d) { this(d.width, d.height); @@ -61,8 +72,10 @@ public class Dimension extends Dimension2D implements Serializable { /** * Instantiates a new Dimension with the specified width and height. * - * @param width the width of the new Dimension. - * @param height the height of the new Dimension. + * @param width + * the width of the new Dimension. + * @param height + * the height of the new Dimension. */ public Dimension(int width, int height) { setSize(width, height); @@ -84,10 +97,10 @@ public class Dimension extends Dimension2D implements Serializable { /** * Compares this Dimension object with the specified object. * - * @param obj the Object to be compared. - * - * @return true, if the specified Object is a Dimension with - * the same width and height data as this Dimension. + * @param obj + * the Object to be compared. + * @return true, if the specified Object is a Dimension with the same width + * and height data as this Dimension. */ @Override public boolean equals(Object obj) { @@ -108,16 +121,20 @@ public class Dimension extends Dimension2D implements Serializable { */ @Override public String toString() { - // The output format based on 1.5 release behaviour. It could be obtained in the following way + // The output format based on 1.5 release behaviour. It could be + // obtained in the following way // System.out.println(new Dimension().toString()) return getClass().getName() + "[width=" + width + ",height=" + height + "]"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ } /** - * Sets the size of this Dimension object with the specified width and height. + * Sets the size of this Dimension object with the specified width and + * height. * - * @param width the width of the Dimension. - * @param height the height of the Dimension. + * @param width + * the width of the Dimension. + * @param height + * the height of the Dimension. */ public void setSize(int width, int height) { this.width = width; @@ -125,22 +142,24 @@ public class Dimension extends Dimension2D implements Serializable { } /** - * Sets the size of this Dimension object by copying the - * data from the specified Dimension object. + * Sets the size of this Dimension object by copying the data from the + * specified Dimension object. * - * @param d the Dimension that gives the new size values. + * @param d + * the Dimension that gives the new size values. */ public void setSize(Dimension d) { setSize(d.width, d.height); } /** - * Sets the size of this Dimension object with the specified double width + * Sets the size of this Dimension object with the specified double width * and height. * - * @param width the width of the Dimension. - * @param height the height of the Dimension. - * + * @param width + * the width of the Dimension. + * @param height + * the height of the Dimension. * @see java.awt.geom.Dimension2D#setSize(double, double) */ @Override @@ -161,7 +180,6 @@ public class Dimension extends Dimension2D implements Serializable { * Gets the height of the Dimension. * * @return the height of the Dimension. - * * @see java.awt.geom.Dimension2D#getHeight() */ @Override @@ -173,7 +191,6 @@ public class Dimension extends Dimension2D implements Serializable { * Gets the width of the Dimension. * * @return the width of the Dimension. - * * @see java.awt.geom.Dimension2D#getWidth() */ @Override @@ -182,4 +199,3 @@ public class Dimension extends Dimension2D implements Serializable { } } - diff --git a/awt/java/awt/DisplayMode.java b/awt/java/awt/DisplayMode.java index 082c7b8aeaa58..8021010198f45 100644 --- a/awt/java/awt/DisplayMode.java +++ b/awt/java/awt/DisplayMode.java @@ -18,41 +18,60 @@ * @author Alexey A. Petrenko * @version $Revision$ */ + package java.awt; /** - * The DisplayMode class containes the bit depth, height, width and - * refresh rate of a GraphicsDevice. + * The DisplayMode class contains the bit depth, height, width and refresh rate + * of a GraphicsDevice. + * + * @since Android 1.0 */ public final class DisplayMode { - - /** The width. */ + + /** + * The width. + */ private final int width; - /** The height. */ + /** + * The height. + */ private final int height; - /** The bit depth. */ + /** + * The bit depth. + */ private final int bitDepth; - /** The refresh rate. */ + /** + * The refresh rate. + */ private final int refreshRate; - /** The Constant Value BIT_DEPTH_MULTI indicates the bit depth */ + /** + * The Constant Value BIT_DEPTH_MULTI indicates the bit depth + */ public static final int BIT_DEPTH_MULTI = -1; - /** The Constant REFRESH_RATE_UNKNOWN indicates the refresh rate. */ + /** + * The Constant REFRESH_RATE_UNKNOWN indicates the refresh rate. + */ public static final int REFRESH_RATE_UNKNOWN = 0; - /** - * Creates a new DisplayMode object with the specified parameters. - * - * @param width the width of the display. - * @param height the height of the display. - * @param bitDepth the bit depth of the display. - * @param refreshRate the refresh rate of the display. - */ + /** + * Creates a new DisplayMode object with the specified parameters. + * + * @param width + * the width of the display. + * @param height + * the height of the display. + * @param bitDepth + * the bit depth of the display. + * @param refreshRate + * the refresh rate of the display. + */ public DisplayMode(int width, int height, int bitDepth, int refreshRate) { this.width = width; @@ -61,15 +80,14 @@ public final class DisplayMode { this.refreshRate = refreshRate; } - - /** - * Compares if this DisplayMode is equal to the specified object or not. - * - * @param dm the Object to be compared. - * - * @return true, if the specified object is a DisplayMode with the same - * data values as this DisplayMode, false otherwise. - */ + /** + * Compares if this DisplayMode is equal to the specified object or not. + * + * @param dm + * the Object to be compared. + * @return true, if the specified object is a DisplayMode with the same data + * values as this DisplayMode, false otherwise. + */ @Override public boolean equals(Object dm) { @@ -80,13 +98,13 @@ public final class DisplayMode { } /** - * Compares if this DisplayMode is equal to the specified DisplayMode object - * or not. - * - * @param dm the DisplayMode to be compared. - * - * @return true, if all of the data values of this DisplayMode are equal - * to the values of the specified DisplayMode object, false otherwise. + * Compares if this DisplayMode is equal to the specified DisplayMode object + * or not. + * + * @param dm + * the DisplayMode to be compared. + * @return true, if all of the data values of this DisplayMode are equal to + * the values of the specified DisplayMode object, false otherwise. */ public boolean equals(DisplayMode dm) { if (dm == null) { @@ -108,8 +126,8 @@ public final class DisplayMode { } /** - * Gets the bit depth of the DisplayMode, returns BIT_DEPTH_MULTI value - * if multiple bit depths are supported in this display mode. + * Gets the bit depth of the DisplayMode, returns BIT_DEPTH_MULTI value if + * multiple bit depths are supported in this display mode. * * @return the bit depth of the DisplayMode. */ diff --git a/awt/java/awt/Event.java b/awt/java/awt/Event.java index f074258db7f48..226a61fffed33 100644 --- a/awt/java/awt/Event.java +++ b/awt/java/awt/Event.java @@ -18,224 +18,293 @@ * @author Dmitry A. Durnev * @version $Revision$ */ + package java.awt; import java.io.Serializable; /** - * The Event Class is obsolete and has been replaced by AWTEvent class. + * The Event class is obsolete and has been replaced by AWTEvent class. * + * @since Android 1.0 */ public class Event implements Serializable { - - /** The Constant serialVersionUID. */ + + /** + * The Constant serialVersionUID. + */ private static final long serialVersionUID = 5488922509400504703L; - - /** - * The Constant SHIFT_MASK indicates that the Shift key is down when - * the event occurred. + + /** + * The Constant SHIFT_MASK indicates that the Shift key is down when the + * event occurred. */ public static final int SHIFT_MASK = 1; - /** - * The Constant CTRL_MASK indicates that the Control key is down when - * the event occurred. + /** + * The Constant CTRL_MASK indicates that the Control key is down when the + * event occurred. */ public static final int CTRL_MASK = 2; - /** The Constant META_MASK indicates that the Meta key is down when t - * he event occurred (or the right mouse button). */ + /** + * The Constant META_MASK indicates that the Meta key is down when t he + * event occurred (or the right mouse button). + */ public static final int META_MASK = 4; - /** - * The Constant ALT_MASK indicates that the Alt key is down when - * the event occurred (or the middle mouse button). + /** + * The Constant ALT_MASK indicates that the Alt key is down when the event + * occurred (or the middle mouse button). */ public static final int ALT_MASK = 8; - /** The Constant HOME indicates Home key. */ + /** + * The Constant HOME indicates Home key. + */ public static final int HOME = 1000; - /** The Constant END indicates End key. */ + /** + * The Constant END indicates End key. + */ public static final int END = 1001; - /** The Constant PGUP indicates Page Up key. */ + /** + * The Constant PGUP indicates Page Up key. + */ public static final int PGUP = 1002; - /** The Constant PGDN indicates Page Down key. */ + /** + * The Constant PGDN indicates Page Down key. + */ public static final int PGDN = 1003; - /** The Constant UP indicates Up key. */ + /** + * The Constant UP indicates Up key. + */ public static final int UP = 1004; - /** The Constant DOWN indicates Down key. */ + /** + * The Constant DOWN indicates Down key. + */ public static final int DOWN = 1005; - /** The Constant LEFT indicates Left key. */ + /** + * The Constant LEFT indicates Left key. + */ public static final int LEFT = 1006; - /** The Constant RIGHT indicates Right key. */ + /** + * The Constant RIGHT indicates Right key. + */ public static final int RIGHT = 1007; - /** The Constant F1 indicates F1 key. */ + /** + * The Constant F1 indicates F1 key. + */ public static final int F1 = 1008; - /** The Constant F2 indicates F2 key. */ + /** + * The Constant F2 indicates F2 key. + */ public static final int F2 = 1009; - /** The Constant F3 indicates F3 key. */ + /** + * The Constant F3 indicates F3 key. + */ public static final int F3 = 1010; - /** The Constant F4 indicates F4 key. */ + /** + * The Constant F4 indicates F4 key. + */ public static final int F4 = 1011; - /** The Constant F5 indicates F5 key. */ + /** + * The Constant F5 indicates F5 key. + */ public static final int F5 = 1012; - /** The Constant F6 indicates F6 key. */ + /** + * The Constant F6 indicates F6 key. + */ public static final int F6 = 1013; - /** The Constant F7 indicates F7 key. */ + /** + * The Constant F7 indicates F7 key. + */ public static final int F7 = 1014; - /** The Constant F8 indicates F8 key. */ + /** + * The Constant F8 indicates F8 key. + */ public static final int F8 = 1015; - /** The Constant F9 indicates F9 key. */ + /** + * The Constant F9 indicates F9 key. + */ public static final int F9 = 1016; - /** The Constant F10 indicates F10 key. */ + /** + * The Constant F10 indicates F10 key. + */ public static final int F10 = 1017; - /** The Constant F11 indicates F11 key. */ + /** + * The Constant F11 indicates F11 key. + */ public static final int F11 = 1018; - /** The Constant F12 indicates F12 key. */ + /** + * The Constant F12 indicates F12 key. + */ public static final int F12 = 1019; - /** The Constant PRINT_SCREEN indicates Print Screen key. */ + /** + * The Constant PRINT_SCREEN indicates Print Screen key. + */ public static final int PRINT_SCREEN = 1020; - /** The Constant SCROLL_LOCK indicates Scroll Lock key. */ + /** + * The Constant SCROLL_LOCK indicates Scroll Lock key. + */ public static final int SCROLL_LOCK = 1021; - /** The Constant CAPS_LOCK indicates Caps Lock key. */ + /** + * The Constant CAPS_LOCK indicates Caps Lock key. + */ public static final int CAPS_LOCK = 1022; - /** The Constant NUM_LOCK indicates Num Lock key. */ + /** + * The Constant NUM_LOCK indicates Num Lock key. + */ public static final int NUM_LOCK = 1023; - /** The Constant PAUSE indicates Pause key. */ + /** + * The Constant PAUSE indicates Pause key. + */ public static final int PAUSE = 1024; - /** The Constant INSERT indicates Insert key. */ + /** + * The Constant INSERT indicates Insert key. + */ public static final int INSERT = 1025; - /** The Constant ENTER indicates Enter key. */ + /** + * The Constant ENTER indicates Enter key. + */ public static final int ENTER = 10; - /** The Constant BACK_SPACE indicates Back Space key. */ + /** + * The Constant BACK_SPACE indicates Back Space key. + */ public static final int BACK_SPACE = 8; - /** The Constant TAB indicates TAb key. */ + /** + * The Constant TAB indicates TAb key. + */ public static final int TAB = 9; - /** The Constant ESCAPE indicates Escape key. */ + /** + * The Constant ESCAPE indicates Escape key. + */ public static final int ESCAPE = 27; - /** The Constant DELETE indicates Delete key. */ + /** + * The Constant DELETE indicates Delete key. + */ public static final int DELETE = 127; - /** - * The Constant WINDOW_DESTROY indicates an event when the user has asked the - * window manager to kill the window. + /** + * The Constant WINDOW_DESTROY indicates an event when the user has asked + * the window manager to kill the window. */ public static final int WINDOW_DESTROY = 201; - /** + /** * The Constant WINDOW_EXPOSE indicates an event when the user has asked the * window manager to expose the window. */ public static final int WINDOW_EXPOSE = 202; - /** - * The Constant WINDOW_ICONIFY indicates an event when the user has asked the - * window manager to inconify the window. + /** + * The Constant WINDOW_ICONIFY indicates an event when the user has asked + * the window manager to iconify the window. */ public static final int WINDOW_ICONIFY = 203; - /** - * The Constant WINDOW_DEICONIFY indicates an event when the user has asked the - * window manager to deinconify the window. + /** + * The Constant WINDOW_DEICONIFY indicates an event when the user has asked + * the window manager to deiconify the window. */ public static final int WINDOW_DEICONIFY = 204; - /** + /** * The Constant WINDOW_MOVED indicates an event when the user has asked the - * window manager to move the window. + * window manager to move the window. */ public static final int WINDOW_MOVED = 205; - /** - * The Constant KEY_PRESS indicates an event when the user presses - * a normal key. + /** + * The Constant KEY_PRESS indicates an event when the user presses a normal + * key. */ public static final int KEY_PRESS = 401; - /** - * The Constant KEY_RELEASE indicates an event when the user releases - * a normal key. + /** + * The Constant KEY_RELEASE indicates an event when the user releases a + * normal key. */ public static final int KEY_RELEASE = 402; - /** - * The Constant KEY_ACTION indicates an event when the user pressed - * a non-ASCII action key. + /** + * The Constant KEY_ACTION indicates an event when the user pressed a + * non-ASCII action key. */ public static final int KEY_ACTION = 403; /** - * The Constant KEY_ACTION_RELEASE indicates an event when the user released - * a non-ASCII action key. + * The Constant KEY_ACTION_RELEASE indicates an event when the user released + * a non-ASCII action key. */ public static final int KEY_ACTION_RELEASE = 404; - /** - * The Constant MOUSE_DOWN indicates an event when the user has pressed - * the mouse button. + /** + * The Constant MOUSE_DOWN indicates an event when the user has pressed the + * mouse button. */ public static final int MOUSE_DOWN = 501; - /** - * The Constant MOUSE_UP indicates an event when the user has released - * the mouse button. + /** + * The Constant MOUSE_UP indicates an event when the user has released the + * mouse button. */ public static final int MOUSE_UP = 502; - /** - * The Constant MOUSE_MOVE indicates an event when the user has moved - * the mouse with no button pressed. + /** + * The Constant MOUSE_MOVE indicates an event when the user has moved the + * mouse with no button pressed. */ public static final int MOUSE_MOVE = 503; - /** - * The Constant MOUSE_ENTER indicates an event when the mouse - * has entered a component. + /** + * The Constant MOUSE_ENTER indicates an event when the mouse has entered a + * component. */ public static final int MOUSE_ENTER = 504; - /** - * The Constant MOUSE_EXIT indicates an event when the mouse - * has exited a component. + /** + * The Constant MOUSE_EXIT indicates an event when the mouse has exited a + * component. */ public static final int MOUSE_EXIT = 505; - /** The Constant MOUSE_DRAG indicates an event when the user - * has moved a mouse with the pressed button. + /** + * The Constant MOUSE_DRAG indicates an event when the user has moved a + * mouse with the pressed button. */ public static final int MOUSE_DRAG = 506; - /** + /** * The Constant SCROLL_LINE_UP indicates an event when the user has * activated line-up area of scrollbar. */ @@ -243,101 +312,136 @@ public class Event implements Serializable { /** * The Constant SCROLL_LINE_DOWN indicates an event when the user has - * activated line-down area of scrollbar. + * activated line-down area of scrollbar. */ public static final int SCROLL_LINE_DOWN = 602; /** * The Constant SCROLL_PAGE_UP indicates an event when the user has - * activated page up area of scrollbar. + * activated page up area of scrollbar. */ public static final int SCROLL_PAGE_UP = 603; /** * The Constant SCROLL_PAGE_DOWN indicates an event when the user has - * activated page down area of scrollbar. + * activated page down area of scrollbar. */ public static final int SCROLL_PAGE_DOWN = 604; /** - * The Constant SCROLL_ABSOLUTE indicates an event when the user - * has moved the bubble in a scroll bar. + * The Constant SCROLL_ABSOLUTE indicates an event when the user has moved + * the bubble in a scroll bar. */ public static final int SCROLL_ABSOLUTE = 605; - /** The Constant SCROLL_BEGIN indicates a scroll begin event. */ + /** + * The Constant SCROLL_BEGIN indicates a scroll begin event. + */ public static final int SCROLL_BEGIN = 606; - /** The Constant SCROLL_END indicates a scroll end event. */ + /** + * The Constant SCROLL_END indicates a scroll end event. + */ public static final int SCROLL_END = 607; - /** - * The Constant LIST_SELECT indicates that an item in a list - * has been selected. + /** + * The Constant LIST_SELECT indicates that an item in a list has been + * selected. */ public static final int LIST_SELECT = 701; - /** - * The Constant LIST_DESELECT indicates that an item in a list - * has been deselected. + /** + * The Constant LIST_DESELECT indicates that an item in a list has been + * unselected. */ public static final int LIST_DESELECT = 702; - /** - * The Constant ACTION_EVENT indicates that the user wants some - * action to occur. + /** + * The Constant ACTION_EVENT indicates that the user wants some action to + * occur. */ public static final int ACTION_EVENT = 1001; - /** The Constant LOAD_FILE indicates a file loading event. */ + /** + * The Constant LOAD_FILE indicates a file loading event. + */ public static final int LOAD_FILE = 1002; - /** The Constant SAVE_FILE indicates a file saving event. */ + /** + * The Constant SAVE_FILE indicates a file saving event. + */ public static final int SAVE_FILE = 1003; - /** The Constant GOT_FOCUS indicates that a component got the focus. */ + /** + * The Constant GOT_FOCUS indicates that a component got the focus. + */ public static final int GOT_FOCUS = 1004; - /** The Constant LOST_FOCUS indicates that the component lost the focus. */ + /** + * The Constant LOST_FOCUS indicates that the component lost the focus. + */ public static final int LOST_FOCUS = 1005; - /** The target is the component with which the event is associated. */ + /** + * The target is the component with which the event is associated. + */ public Object target; - /** The when is timestamp when event has occured. */ + /** + * The when is timestamp when event has occured. + */ public long when; - /** The id indicates the type of the event. */ + /** + * The id indicates the type of the event. + */ public int id; - /** The x coordinate of event. */ + /** + * The x coordinate of event. + */ public int x; - /** The y coordinate of event. */ + /** + * The y coordinate of event. + */ public int y; - /** The key code of key event. */ + /** + * The key code of key event. + */ public int key; - /** The state of the modifier keys (given by a bitmask). */ + /** + * The state of the modifier keys (given by a bitmask). + */ public int modifiers; - /** The click count indicates the number of consecutive clicks. */ + /** + * The click count indicates the number of consecutive clicks. + */ public int clickCount; - /** The argument of the event. */ + /** + * The argument of the event. + */ public Object arg; - /** The next event. */ + /** + * The next event. + */ public Event evt; /** - * Instantiates a new event with the specified target component, - * event type, and argument. + * Instantiates a new event with the specified target component, event type, + * and argument. * - * @param target the target component. - * @param id the event type. - * @param arg the argument. + * @param target + * the target component. + * @param id + * the event type. + * @param arg + * the argument. */ public Event(Object target, int id, Object arg) { this(target, 0l, id, 0, 0, 0, 0, arg); @@ -348,13 +452,20 @@ public class Event implements Serializable { * event type, x and y coordinates, keyboard key, state of the modifier * keys, and an argument set to null. * - * @param target the target component. - * @param when the time stamp. - * @param id the event type. - * @param x the x coordinate. - * @param y the y coordinate. - * @param key the key. - * @param modifiers the modifier keys state. + * @param target + * the target component. + * @param when + * the time stamp. + * @param id + * the event type. + * @param x + * the x coordinate. + * @param y + * the y coordinate. + * @param key + * the key. + * @param modifiers + * the modifier keys state. */ public Event(Object target, long when, int id, int x, int y, int key, int modifiers) { this(target, when, id, x, y, key, modifiers, null); @@ -365,14 +476,22 @@ public class Event implements Serializable { * event type, x and y coordinates, keyboard key, state of the modifier * keys, and an argument. * - * @param target the target component. - * @param when the time stamp. - * @param id the event type. - * @param x the x coordinate. - * @param y the y coordinate. - * @param key the key. - * @param modifiers the modifier keys state. - * @param arg the specified argument. + * @param target + * the target component. + * @param when + * the time stamp. + * @param id + * the event type. + * @param x + * the x coordinate. + * @param y + * the y coordinate. + * @param key + * the key. + * @param modifiers + * the modifier keys state. + * @param arg + * the specified argument. */ public Event(Object target, long when, int id, int x, int y, int key, int modifiers, Object arg) { this.target = target; @@ -392,11 +511,10 @@ public class Event implements Serializable { */ @Override public String toString() { - /* The format is based on 1.5 release behavior - * which can be revealed by the following code: - * - * Event e = new Event(new Button(), 0l, Event.KEY_PRESS, - * 0, 0, Event.TAB, Event.SHIFT_MASK, "arg"); + /* + * The format is based on 1.5 release behavior which can be revealed by + * the following code: Event e = new Event(new Button(), 0l, + * Event.KEY_PRESS, 0, 0, Event.TAB, Event.SHIFT_MASK, "arg"); * System.out.println(e); */ @@ -410,15 +528,15 @@ public class Event implements Serializable { */ protected String paramString() { return "id=" + id + ",x=" + x + ",y=" + y + //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - (key != 0 ? ",key=" + key + getModifiersString() : "") + //$NON-NLS-1$ //$NON-NLS-2$ - ",target=" + target + //$NON-NLS-1$ - (arg != null ? ",arg=" + arg : ""); //$NON-NLS-1$ //$NON-NLS-2$ + (key != 0 ? ",key=" + key + getModifiersString() : "") + //$NON-NLS-1$ //$NON-NLS-2$ + ",target=" + target + //$NON-NLS-1$ + (arg != null ? ",arg=" + arg : ""); //$NON-NLS-1$ //$NON-NLS-2$ } /** * Gets a string representation of the modifiers. * - * @return a string representation of the modifiers + * @return a string representation of the modifiers. */ private String getModifiersString() { String strMod = ""; //$NON-NLS-1$ @@ -435,13 +553,13 @@ public class Event implements Serializable { } /** - * Translates x and y coordinates of his event to the x+dx and x+dy + * Translates x and y coordinates of his event to the x+dx and x+dy * coordinates. * - * @param dx the dx - the distance by which the event's x coordinate - * is increased - * @param dy the dy - the distance by which the event's y coordinate - * is increased + * @param dx + * the distance by which the event's x coordinate is increased. + * @param dy + * the distance by which the event's y coordinate is increased. */ public void translate(int dx, int dy) { x += dx; @@ -476,4 +594,3 @@ public class Event implements Serializable { } } - diff --git a/awt/java/awt/EventQueue.java b/awt/java/awt/EventQueue.java index 3997546190c90..126a593061ed4 100644 --- a/awt/java/awt/EventQueue.java +++ b/awt/java/awt/EventQueue.java @@ -18,6 +18,7 @@ * @author Michael Danilov, Pavel Dolgov * @version $Revision$ */ + package java.awt; import java.awt.event.InvocationEvent; @@ -25,60 +26,69 @@ import java.lang.reflect.InvocationTargetException; import java.util.EmptyStackException; /** - * The EventQueue class manages events. It is a platform-independent class - * that queues events both from the underlying peer classes and from trusted + * The EventQueue class manages events. It is a platform-independent class that + * queues events both from the underlying peer classes and from trusted * application classes. + * + * @since Android 1.0 */ public class EventQueue { - - /** The core ref. */ - private final EventQueueCoreAtomicReference coreRef = - new EventQueueCoreAtomicReference(); - + + /** + * The core ref. + */ + private final EventQueueCoreAtomicReference coreRef = new EventQueueCoreAtomicReference(); + /** * The Class EventQueueCoreAtomicReference. */ private static final class EventQueueCoreAtomicReference { - - /** The core. */ + + /** + * The core. + */ private EventQueueCore core; - /*synchronized*/ /** + /* synchronized */ + /** * Gets the. * - * @return the event queue core + * @return the event queue core. */ - EventQueueCore get() { + EventQueueCore get() { return core; } - /*synchronized*/ /** + /* synchronized */ + /** * Sets the. * - * @param newCore the new core + * @param newCore + * the new core. */ - void set(EventQueueCore newCore) { + void set(EventQueueCore newCore) { core = newCore; } } /** - * Returns true if the calling thread is the current - * AWT EventQueue's dispatch thread. + * Returns true if the calling thread is the current AWT EventQueue's + * dispatch thread. * - * @return true, if the calling thread is the current - * AWT EventQueue's dispatch thread; false otherwise. + * @return true, if the calling thread is the current AWT EventQueue's + * dispatch thread; false otherwise. */ public static boolean isDispatchThread() { return Thread.currentThread() instanceof EventDispatchThread; } /** - * Posts an InvocationEvent which executes the run() method on a Runnable + * Posts an InvocationEvent which executes the run() method on a Runnable * when dispatched by the AWT event dispatcher thread. * - * @param runnable the Runnable whose run method should be executed - * synchronously on the EventQueue. + * @param runnable + * the Runnable whose run method should be executed synchronously + * on the EventQueue. */ public static void invokeLater(Runnable runnable) { Toolkit toolkit = Toolkit.getDefaultToolkit(); @@ -87,29 +97,28 @@ public class EventQueue { } /** - * Posts an InvocationEvent which executes the run() method on a Runnable - * when dispatched by the AWT event dispatcher thread and the - * notifyAll method is called on it immediately after run returns. - * - * @param runnable the Runnable whose run method should be executed - * synchronously on the EventQueue. + * Posts an InvocationEvent which executes the run() method on a Runnable + * when dispatched by the AWT event dispatcher thread and the notifyAll + * method is called on it immediately after run returns. * - * @throws InterruptedException if another thread has interrupted - * this thread. - * @throws InvocationTargetException if a throwable is thrown - * when running the runnable. + * @param runnable + * the Runnable whose run method should be executed synchronously + * on the EventQueue. + * @throws InterruptedException + * if another thread has interrupted this thread. + * @throws InvocationTargetException + * if an error occurred while running the runnable. */ - public static void invokeAndWait(Runnable runnable) - throws InterruptedException, InvocationTargetException { + public static void invokeAndWait(Runnable runnable) throws InterruptedException, + InvocationTargetException { if (isDispatchThread()) { throw new Error(); } final Toolkit toolkit = Toolkit.getDefaultToolkit(); - final Object notifier = new Object(); //$NON-LOCK-1$ - InvocationEvent event = new InvocationEvent( - toolkit, runnable, notifier, true); + final Object notifier = new Object(); // $NON-LOCK-1$ + InvocationEvent event = new InvocationEvent(toolkit, runnable, notifier, true); synchronized (notifier) { toolkit.getSystemEventQueueImpl().postEvent(event); @@ -126,7 +135,7 @@ public class EventQueue { /** * Gets the system event queue. * - * @return the system event queue + * @return the system event queue. */ private static EventQueue getSystemEventQueue() { Thread th = Thread.currentThread(); @@ -135,48 +144,45 @@ public class EventQueue { } return null; } - + /** - * Gets the most recent event's timestamp. - * This event was dispatched from the EventQueue associated with the - * calling thread. + * Gets the most recent event's timestamp. This event was dispatched from + * the EventQueue associated with the calling thread. * - * @return the timestamp of the last Event to be dispatched, - * or System.currentTimeMillis() if this method is invoked from - * a thread other than an event-dispatching thread. + * @return the timestamp of the last Event to be dispatched, or + * System.currentTimeMillis() if this method is invoked from a + * thread other than an event-dispatching thread. */ public static long getMostRecentEventTime() { EventQueue eq = getSystemEventQueue(); - return (eq != null) ? - eq.getMostRecentEventTimeImpl() : System.currentTimeMillis(); + return (eq != null) ? eq.getMostRecentEventTimeImpl() : System.currentTimeMillis(); } - + /** * Gets the most recent event time impl. * - * @return the most recent event time impl + * @return the most recent event time impl. */ private long getMostRecentEventTimeImpl() { return getCore().getMostRecentEventTime(); } /** - * Returns the the currently dispatched event by the EventQueue - * associated with the calling thread. + * Returns the the currently dispatched event by the EventQueue associated + * with the calling thread. * - * @return the currently dispatched event or null if this method - * is invoked from a thread other than an event-dispatching thread. + * @return the currently dispatched event or null if this method is invoked + * from a thread other than an event-dispatching thread. */ public static AWTEvent getCurrentEvent() { EventQueue eq = getSystemEventQueue(); - return (eq != null) ? - eq.getCurrentEventImpl() : null; + return (eq != null) ? eq.getCurrentEventImpl() : null; } /** * Gets the current event impl. * - * @return the current event impl + * @return the current event impl. */ private AWTEvent getCurrentEventImpl() { return getCore().getCurrentEvent(); @@ -192,7 +198,8 @@ public class EventQueue { /** * Instantiates a new event queue. * - * @param t the t + * @param t + * the t. */ EventQueue(Toolkit t) { setCore(new EventQueueCore(this, t)); @@ -201,7 +208,8 @@ public class EventQueue { /** * Posts a event to the EventQueue. * - * @param event AWTEvent. + * @param event + * AWTEvent. */ public void postEvent(AWTEvent event) { event.isPosted = true; @@ -209,29 +217,28 @@ public class EventQueue { } /** - * Returns an event from the EventQueue and removes it from this queue. - * - * @return the next AWTEvent. + * Returns an event from the EventQueue and removes it from this queue. * - * @throws InterruptedException is thrown if another thread - * interrupts this thread. + * @return the next AWTEvent. + * @throws InterruptedException + * is thrown if another thread interrupts this thread. */ public AWTEvent getNextEvent() throws InterruptedException { return getCore().getNextEvent(); } - + /** * Gets the next event no wait. * - * @return the next event no wait + * @return the next event no wait. */ AWTEvent getNextEventNoWait() { return getCore().getNextEventNoWait(); } /** - * Returns the first event of the EventQueue (without removing it - * from the queue). + * Returns the first event of the EventQueue (without removing it from the + * queue). * * @return the the first AWT event of the EventQueue. */ @@ -240,11 +247,11 @@ public class EventQueue { } /** - * Returns the first event of the EventQueue with the specified ID - * (without removing it from the queue). - * - * @param id the type ID of event. + * Returns the first event of the EventQueue with the specified ID (without + * removing it from the queue). * + * @param id + * the type ID of event. * @return the first event of the EventQueue with the specified ID. */ public AWTEvent peekEvent(int id) { @@ -252,21 +259,22 @@ public class EventQueue { } /** - * Replaces the existing EventQueue with the specified EventQueue. - * Any pending events are transferred to the new EventQueue. + * Replaces the existing EventQueue with the specified EventQueue. Any + * pending events are transferred to the new EventQueue. * - * @param newEventQueue the new event queue. + * @param newEventQueue + * the new event queue. */ public void push(EventQueue newEventQueue) { getCore().push(newEventQueue); } - + /** - * Stops dispatching events using this EventQueue. - * Any pending events are transferred to the previous EventQueue. + * Stops dispatching events using this EventQueue. Any pending events are + * transferred to the previous EventQueue. * - * @throws EmptyStackException is thrown if no previous push - * was made on this EventQueue. + * @throws EmptyStackException + * is thrown if no previous push was made on this EventQueue. */ protected void pop() throws EmptyStackException { getCore().pop(); @@ -275,7 +283,8 @@ public class EventQueue { /** * Dispatches the specified event. * - * @param event the AWTEvent. + * @param event + * the AWTEvent. */ protected void dispatchEvent(AWTEvent event) { getCore().dispatchEventImpl(event); @@ -284,7 +293,7 @@ public class EventQueue { /** * Checks if the queue is empty. * - * @return true, if is empty + * @return true, if is empty. */ boolean isEmpty() { return getCore().isEmpty(); @@ -293,16 +302,17 @@ public class EventQueue { /** * Gets the core. * - * @return the core + * @return the core. */ EventQueueCore getCore() { return coreRef.get(); } - + /** * Sets the core. * - * @param newCore the new core + * @param newCore + * the new core. */ void setCore(EventQueueCore newCore) { coreRef.set((newCore != null) ? newCore : new EventQueueCore(this)); diff --git a/awt/java/awt/Font.java b/awt/java/awt/Font.java index 139ae6827a376..4ed93438d3892 100644 --- a/awt/java/awt/Font.java +++ b/awt/java/awt/Font.java @@ -46,130 +46,165 @@ import org.apache.harmony.awt.gl.font.FontPeerImpl; import org.apache.harmony.awt.gl.font.FontMetricsImpl; import org.apache.harmony.awt.gl.font.LineMetricsImpl; import org.apache.harmony.awt.internal.nls.Messages; +import org.apache.harmony.luni.util.NotImplementedException; import org.apache.harmony.misc.HashCode; - /** - * The Font class represents fonts for rendering text. - * This class allow to map characters to glyphs. - *

- * A glyph is a shape used to render a character or a sequence of - * characters. For example one character of Latin writing system - * represented by one glyth, but in complex writing system such as - * South and South-East Asian there is more complicated correspondence - * between characters and glyphs. + * The Font class represents fonts for rendering text. This class allow to map + * characters to glyphs. + *

+ * A glyph is a shape used to render a character or a sequence of characters. + * For example one character of Latin writing system represented by one glyph, + * but in complex writing system such as South and South-East Asian there is + * more complicated correspondence between characters and glyphs. *

- * The Font object is identified by two types of names. The logical font name - * is the name that is used to construct the font. The font name - * is the name of a particular font face (for example, Arial Bold). - * The family name is the font's family name that specifies - * the typographic design across several faces (for example, Arial). In - * all the Font is identified by three attributes: the family name, - * the style (such as bold or italic), and the size. + * The Font object is identified by two types of names. The logical font name is + * the name that is used to construct the font. The font name is the name of a + * particular font face (for example, Arial Bold). The family name is the font's + * family name that specifies the typographic design across several faces (for + * example, Arial). In all the Font is identified by three attributes: the + * family name, the style (such as bold or italic), and the size. + * + * @since Android 1.0 */ public class Font implements Serializable { - /** The Constant serialVersionUID. */ + /** + * The Constant serialVersionUID. + */ private static final long serialVersionUID = -4206021311591459213L; // Identity Transform attribute - /** The Constant IDENTITY_TRANSFORM. */ + /** + * The Constant IDENTITY_TRANSFORM. + */ private static final TransformAttribute IDENTITY_TRANSFORM = new TransformAttribute( new AffineTransform()); - /** The Constant PLAIN indicates font's plain style. */ + /** + * The Constant PLAIN indicates font's plain style. + */ public static final int PLAIN = 0; - /** The Constant BOLD indicates font's bold style. */ + /** + * The Constant BOLD indicates font's bold style. + */ public static final int BOLD = 1; - /** The Constant ITALIC indicates font's italic style. */ + /** + * The Constant ITALIC indicates font's italic style. + */ public static final int ITALIC = 2; - /** The Constant ROMAN_BASELINE indicated roman baseline. */ + /** + * The Constant ROMAN_BASELINE indicated roman baseline. + */ public static final int ROMAN_BASELINE = 0; - /** The Constant CENTER_BASELINE indicates center baseline. */ + /** + * The Constant CENTER_BASELINE indicates center baseline. + */ public static final int CENTER_BASELINE = 1; - /** The Constant HANGING_BASELINE indicates hanging baseline. */ + /** + * The Constant HANGING_BASELINE indicates hanging baseline. + */ public static final int HANGING_BASELINE = 2; - /** - * The Constant TRUETYPE_FONT indicates a font resource of - * type TRUETYPE. + /** + * The Constant TRUETYPE_FONT indicates a font resource of type TRUETYPE. */ public static final int TRUETYPE_FONT = 0; - /** - * The Constant TYPE1_FONT indicates a font resource of - * type TYPE1. + /** + * The Constant TYPE1_FONT indicates a font resource of type TYPE1. */ public static final int TYPE1_FONT = 1; - /** - * The Constant LAYOUT_LEFT_TO_RIGHT indicates that text is - * left to right. + /** + * The Constant LAYOUT_LEFT_TO_RIGHT indicates that text is left to right. */ public static final int LAYOUT_LEFT_TO_RIGHT = 0; - /** - * The Constant LAYOUT_RIGHT_TO_LEFT indicates that text is - * right to left. + /** + * The Constant LAYOUT_RIGHT_TO_LEFT indicates that text is right to left. */ public static final int LAYOUT_RIGHT_TO_LEFT = 1; - /** - * The Constant LAYOUT_NO_START_CONTEXT indicates that the text - * in the char array before the indicated start should not be examined. + /** + * The Constant LAYOUT_NO_START_CONTEXT indicates that the text in the char + * array before the indicated start should not be examined. */ public static final int LAYOUT_NO_START_CONTEXT = 2; - /** The Constant LAYOUT_NO_LIMIT_CONTEXT indicates that text in - * the char array after the indicated limit should not be examined. */ + /** + * The Constant LAYOUT_NO_LIMIT_CONTEXT indicates that text in the char + * array after the indicated limit should not be examined. + */ public static final int LAYOUT_NO_LIMIT_CONTEXT = 4; - /** The Constant DEFAULT_FONT. */ + /** + * The Constant DEFAULT_FONT. + */ static final Font DEFAULT_FONT = new Font("Dialog", Font.PLAIN, 12); //$NON-NLS-1$ - /** The name of the Font. */ + /** + * The name of the Font. + */ protected String name; - /** The style of the Font. */ + /** + * The style of the Font. + */ protected int style; - /** The size of the Font. */ + /** + * The size of the Font. + */ protected int size; - /** The point size of the Font. */ + /** + * The point size of the Font. + */ protected float pointSize; // Flag if the Font object transformed - /** The transformed. */ + /** + * The transformed. + */ private boolean transformed; // Set of font attributes - /** The requested attributes. */ + /** + * The requested attributes. + */ private Hashtable fRequestedAttributes; // font peer object corresponding to this Font - /** The font peer. */ + /** + * The font peer. + */ private transient FontPeerImpl fontPeer; // number of glyphs in this Font - /** The num glyphs. */ + /** + * The num glyphs. + */ private transient int numGlyphs = -1; // code for missing glyph for this Font - /** The missing glyph code. */ + /** + * The missing glyph code. + */ private transient int missingGlyphCode = -1; /** * Writes object to ObjectOutputStream. * - * @param out ObjectOutputStream - * - * @throws IOException Signals that an I/O exception has occurred. + * @param out + * ObjectOutputStream. + * @throws IOException + * Signals that an I/O exception has occurred. */ private void writeObject(java.io.ObjectOutputStream out) throws IOException { out.defaultWriteObject(); @@ -179,10 +214,12 @@ public class Font implements Serializable { * Reads object from ObjectInputStream object and set native platform * dependent fields to default values. * - * @param in ObjectInputStream object - * - * @throws IOException Signals that an I/O exception has occurred. - * @throws ClassNotFoundException the class not found exception + * @param in + * ObjectInputStream object. + * @throws IOException + * Signals that an I/O exception has occurred. + * @throws ClassNotFoundException + * the class not found exception. */ private void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException { @@ -194,11 +231,11 @@ public class Font implements Serializable { } /** - * Instantiates a new Font with the specified attributes. - * The Font will be created with default attributes - * if the attribute's parameter is null. + * Instantiates a new Font with the specified attributes. The Font will be + * created with default attributes if the attribute's parameter is null. * - * @param attributes the attributes to be assigned to the new Font, or null. + * @param attributes + * the attributes to be assigned to the new Font, or null. */ public Font(Map attributes) { Object currAttr; @@ -217,43 +254,38 @@ public class Font implements Serializable { currAttr = attributes.get(TextAttribute.SIZE); if (currAttr != null) { - this.pointSize = ((Float) currAttr).floatValue(); - this.size = (int) Math.ceil(this.pointSize); + this.pointSize = ((Float)currAttr).floatValue(); + this.size = (int)Math.ceil(this.pointSize); } currAttr = attributes.get(TextAttribute.POSTURE); - if (currAttr != null - && currAttr.equals(TextAttribute.POSTURE_OBLIQUE)) { + if (currAttr != null && currAttr.equals(TextAttribute.POSTURE_OBLIQUE)) { this.style |= Font.ITALIC; } currAttr = attributes.get(TextAttribute.WEIGHT); if ((currAttr != null) - && (((Float) currAttr).floatValue() >= (TextAttribute.WEIGHT_BOLD) - .floatValue())) { + && (((Float)currAttr).floatValue() >= (TextAttribute.WEIGHT_BOLD).floatValue())) { this.style |= Font.BOLD; } currAttr = attributes.get(TextAttribute.FAMILY); if (currAttr != null) { - this.name = (String) currAttr; + this.name = (String)currAttr; } currAttr = attributes.get(TextAttribute.TRANSFORM); if (currAttr != null) { if (currAttr instanceof TransformAttribute) { - this.transformed = !((TransformAttribute) currAttr) - .getTransform().isIdentity(); + this.transformed = !((TransformAttribute)currAttr).getTransform().isIdentity(); } else if (currAttr instanceof AffineTransform) { - this.transformed = !((AffineTransform) currAttr) - .isIdentity(); + this.transformed = !((AffineTransform)currAttr).isIdentity(); } } } else { fRequestedAttributes = new Hashtable(5); - fRequestedAttributes.put(TextAttribute.TRANSFORM, - IDENTITY_TRANSFORM); + fRequestedAttributes.put(TextAttribute.TRANSFORM, IDENTITY_TRANSFORM); this.transformed = false; @@ -262,18 +294,14 @@ public class Font implements Serializable { fRequestedAttributes.put(TextAttribute.SIZE, new Float(this.size)); if ((this.style & Font.BOLD) != 0) { - fRequestedAttributes.put(TextAttribute.WEIGHT, - TextAttribute.WEIGHT_BOLD); + fRequestedAttributes.put(TextAttribute.WEIGHT, TextAttribute.WEIGHT_BOLD); } else { - fRequestedAttributes.put(TextAttribute.WEIGHT, - TextAttribute.WEIGHT_REGULAR); + fRequestedAttributes.put(TextAttribute.WEIGHT, TextAttribute.WEIGHT_REGULAR); } if ((this.style & Font.ITALIC) != 0) { - fRequestedAttributes.put(TextAttribute.POSTURE, - TextAttribute.POSTURE_OBLIQUE); + fRequestedAttributes.put(TextAttribute.POSTURE, TextAttribute.POSTURE_OBLIQUE); } else { - fRequestedAttributes.put(TextAttribute.POSTURE, - TextAttribute.POSTURE_REGULAR); + fRequestedAttributes.put(TextAttribute.POSTURE, TextAttribute.POSTURE_REGULAR); } } @@ -282,9 +310,12 @@ public class Font implements Serializable { /** * Instantiates a new Font with the specified name, style and size. * - * @param name the name of font. - * @param style the style of font. - * @param size the size of font. + * @param name + * the name of font. + * @param style + * the style of font. + * @param size + * the size of font. */ public Font(String name, int style, int size) { @@ -303,46 +334,43 @@ public class Font implements Serializable { fRequestedAttributes.put(TextAttribute.SIZE, new Float(this.size)); if ((this.style & Font.BOLD) != 0) { - fRequestedAttributes.put(TextAttribute.WEIGHT, - TextAttribute.WEIGHT_BOLD); + fRequestedAttributes.put(TextAttribute.WEIGHT, TextAttribute.WEIGHT_BOLD); } else { - fRequestedAttributes.put(TextAttribute.WEIGHT, - TextAttribute.WEIGHT_REGULAR); + fRequestedAttributes.put(TextAttribute.WEIGHT, TextAttribute.WEIGHT_REGULAR); } if ((this.style & Font.ITALIC) != 0) { - fRequestedAttributes.put(TextAttribute.POSTURE, - TextAttribute.POSTURE_OBLIQUE); + fRequestedAttributes.put(TextAttribute.POSTURE, TextAttribute.POSTURE_OBLIQUE); } else { - fRequestedAttributes.put(TextAttribute.POSTURE, - TextAttribute.POSTURE_REGULAR); + fRequestedAttributes.put(TextAttribute.POSTURE, TextAttribute.POSTURE_REGULAR); } } /** * Returns true if this Font has a glyph for the specified character. * - * @param c the character. - * - * @return true if this Font has a glyph for the specified character, - * false otherwise. + * @param c + * the character. + * @return true if this Font has a glyph for the specified character, false + * otherwise. */ public boolean canDisplay(char c) { - FontPeerImpl peer = (FontPeerImpl) this.getPeer(); + FontPeerImpl peer = (FontPeerImpl)this.getPeer(); return peer.canDisplay(c); } /** - * Returns true if the Font can display the characters of the - * the specified text from the specified start position - * to the specified limit position. - * - * @param text the text. - * @param start the start offset (in the character array). - * @param limit the limit offset (in the character array). - * - * @return the a character's position in the text that this Font - * can not display, or -1 if this Font can display all characters - * in this text. + * Returns true if the Font can display the characters of the the specified + * text from the specified start position to the specified limit position. + * + * @param text + * the text. + * @param start + * the start offset (in the character array). + * @param limit + * the limit offset (in the character array). + * @return the a character's position in the text that this Font can not + * display, or -1 if this Font can display all characters in this + * text. */ public int canDisplayUpTo(char[] text, int start, int limit) { int st = start; @@ -361,17 +389,19 @@ public class Font implements Serializable { } /** - * Returns true if the Font can display the characters of the - * the specified CharacterIterator from the specified start position - * and the specified limit position. - * - * @param iter the CharacterIterator. - * @param start the start offset. - * @param limit the limit offset. - * - * @return the a character's position in the CharacterIterator - * that this Font can not display, or -1 if this Font can display - * all characters in this text. + * Returns true if the Font can display the characters of the the specified + * CharacterIterator from the specified start position and the specified + * limit position. + * + * @param iter + * the CharacterIterator. + * @param start + * the start offset. + * @param limit + * the limit offset. + * @return the a character's position in the CharacterIterator that this + * Font can not display, or -1 if this Font can display all + * characters in this text. */ public int canDisplayUpTo(CharacterIterator iter, int start, int limit) { int st = start; @@ -394,11 +424,11 @@ public class Font implements Serializable { /** * Returns true if this Font can display a specified String. * - * @param str the String. - * - * @return the a character's position in the String that - * this Font can not display, or -1 if this Font can display - * all characters in this text. + * @param str + * the String. + * @return the a character's position in the String that this Font can not + * display, or -1 if this Font can display all characters in this + * text. */ public int canDisplayUpTo(String str) { char[] chars = str.toCharArray(); @@ -406,45 +436,49 @@ public class Font implements Serializable { } /** - * Creates a GlyphVector of associating characters to glyphs - * based on the unicode map of this Font. - * - * @param frc the FontRenderContext. - * @param chars the characters array. + * Creates a GlyphVector of associating characters to glyphs based on the + * Unicode map of this Font. * - * @return the GlyphVector of associating characters to glyphs - * based on the unicode map of this Font. + * @param frc + * the FontRenderContext. + * @param chars + * the characters array. + * @return the GlyphVector of associating characters to glyphs based on the + * Unicode map of this Font. */ public GlyphVector createGlyphVector(FontRenderContext frc, char[] chars) { return new AndroidGlyphVector(chars, frc, this, 0); } /** - * Creates a GlyphVector of associating characters contained - * in the specified CharacterIterator to glyphs based on - * the unicode map of this Font. - * - * @param frc the FontRenderContext. - * @param iter the CharacterIterator. - * - * @return the GlyphVector of associating characters contained - * in the specified CharacterIterator to glyphs - * based on the unicode map of this Font. - */ - public GlyphVector createGlyphVector(FontRenderContext frc, - CharacterIterator iter) { - throw new RuntimeException("Not implemented!"); //$NON-NLS-1$ + * Creates a GlyphVector of associating characters contained in the + * specified CharacterIterator to glyphs based on the Unicode map of this + * Font. + * + * @param frc + * the FontRenderContext. + * @param iter + * the CharacterIterator. + * @return the GlyphVector of associating characters contained in the + * specified CharacterIterator to glyphs based on the Unicode map of + * this Font. + */ + public GlyphVector createGlyphVector(FontRenderContext frc, CharacterIterator iter) { + throw new RuntimeException("Not implemented!"); //$NON-NLS-1$ } /** - * Creates a GlyphVector of associating characters to glyphs based on - * the unicode map of this Font. - * - * @param frc the FontRenderContext. - * @param glyphCodes the specified integer array of glyph codes. - * - * @return the GlyphVector of associating characters to glyphs - * based on the unicode map of this Font. + * Creates a GlyphVector of associating characters to glyphs based on the + * Unicode map of this Font. + * + * @param frc + * the FontRenderContext. + * @param glyphCodes + * the specified integer array of glyph codes. + * @return the GlyphVector of associating characters to glyphs based on the + * Unicode map of this Font. + * @throws NotImplementedException + * if this method is not implemented by a subclass. */ public GlyphVector createGlyphVector(FontRenderContext frc, int[] glyphCodes) throws org.apache.harmony.luni.util.NotImplementedException { @@ -452,14 +486,15 @@ public class Font implements Serializable { } /** - * Creates a GlyphVector of associating characters to glyphs based on - * the unicode map of this Font. + * Creates a GlyphVector of associating characters to glyphs based on the + * Unicode map of this Font. * - * @param frc the FontRenderContext. - * @param str the specified String. - * - * @return the GlyphVector of associating characters to glyphs - * based on the unicode map of this Font. + * @param frc + * the FontRenderContext. + * @param str + * the specified String. + * @return the GlyphVector of associating characters to glyphs based on the + * Unicode map of this Font. */ public GlyphVector createGlyphVector(FontRenderContext frc, String str) { return new AndroidGlyphVector(str.toCharArray(), frc, this, 0); @@ -467,14 +502,14 @@ public class Font implements Serializable { } /** - * Returns the font style constant value corresponding to one of the font style - * names ("BOLD", "ITALIC", "BOLDITALIC"). This method returns Font.PLAIN if - * the argument is not one of the predefined style names. - * - * @param fontStyleName font style name + * Returns the font style constant value corresponding to one of the font + * style names ("BOLD", "ITALIC", "BOLDITALIC"). This method returns + * Font.PLAIN if the argument is not one of the predefined style names. * + * @param fontStyleName + * font style name. * @return font style constant value corresponding to the font style name - * specified. + * specified. */ private static int getFontStyle(String fontStyleName) { int result = Font.PLAIN; @@ -491,12 +526,12 @@ public class Font implements Serializable { } /** - * Decodes the specified string which described the Font. The string - * should have the following format: fontname-style-pointsize. - * The style can be PLAIN, BOLD, BOLDITALIC, or ITALIC. - * - * @param str the string which describes the font. + * Decodes the specified string which described the Font. The string should + * have the following format: fontname-style-pointsize. The style can be + * PLAIN, BOLD, BOLDITALIC, or ITALIC. * + * @param str + * the string which describes the font. * @return the Font from the specified string. */ public static Font decode(String str) { @@ -553,15 +588,14 @@ public class Font implements Serializable { } /** - * Perfoms the specified affine transform to the Font and returns - * a new Font. - * - * @param trans the AffineTransform. + * Performs the specified affine transform to the Font and returns a new + * Font. * + * @param trans + * the AffineTransform. * @return the Font object. - * - * @throws IllegalArgumentException if affine transform parameter - * is null. + * @throws IllegalArgumentException + * if affine transform parameter is null. */ @SuppressWarnings("unchecked") public Font deriveFont(AffineTransform trans) { @@ -571,55 +605,52 @@ public class Font implements Serializable { throw new IllegalArgumentException(Messages.getString("awt.94")); //$NON-NLS-1$ } - Hashtable derivefRequestedAttributes = (Hashtable) fRequestedAttributes + Hashtable derivefRequestedAttributes = (Hashtable)fRequestedAttributes .clone(); - derivefRequestedAttributes.put(TextAttribute.TRANSFORM, - new TransformAttribute(trans)); + derivefRequestedAttributes.put(TextAttribute.TRANSFORM, new TransformAttribute(trans)); return new Font(derivefRequestedAttributes); } /** - * Returns a new Font that is a copy of the current Font - * modified so that the size is the specified size. - * - * @param size the size of font. + * Returns a new Font that is a copy of the current Font modified so that + * the size is the specified size. * + * @param size + * the size of font. * @return the Font object. */ @SuppressWarnings("unchecked") public Font deriveFont(float size) { - Hashtable derivefRequestedAttributes = (Hashtable) fRequestedAttributes + Hashtable derivefRequestedAttributes = (Hashtable)fRequestedAttributes .clone(); derivefRequestedAttributes.put(TextAttribute.SIZE, new Float(size)); return new Font(derivefRequestedAttributes); } /** - * Returns a new Font that is a copy of the current Font - * modified so that the style is the specified style. - * - * @param style the style of font. + * Returns a new Font that is a copy of the current Font modified so that + * the style is the specified style. * + * @param style + * the style of font. * @return the Font object. */ @SuppressWarnings("unchecked") public Font deriveFont(int style) { - Hashtable derivefRequestedAttributes = (Hashtable) fRequestedAttributes + Hashtable derivefRequestedAttributes = (Hashtable)fRequestedAttributes .clone(); if ((style & Font.BOLD) != 0) { - derivefRequestedAttributes.put(TextAttribute.WEIGHT, - TextAttribute.WEIGHT_BOLD); + derivefRequestedAttributes.put(TextAttribute.WEIGHT, TextAttribute.WEIGHT_BOLD); } else if (derivefRequestedAttributes.get(TextAttribute.WEIGHT) != null) { derivefRequestedAttributes.remove(TextAttribute.WEIGHT); } if ((style & Font.ITALIC) != 0) { - derivefRequestedAttributes.put(TextAttribute.POSTURE, - TextAttribute.POSTURE_OBLIQUE); + derivefRequestedAttributes.put(TextAttribute.POSTURE, TextAttribute.POSTURE_OBLIQUE); } else if (derivefRequestedAttributes.get(TextAttribute.POSTURE) != null) { derivefRequestedAttributes.remove(TextAttribute.POSTURE); } @@ -628,13 +659,14 @@ public class Font implements Serializable { } /** - * Returns a new Font that is a copy of the current Font - * modified to match the specified style and with the specified - * affine transform applied to its glyphs. - * - * @param style the style of font. - * @param trans the AffineTransform. - * + * Returns a new Font that is a copy of the current Font modified to match + * the specified style and with the specified affine transform applied to + * its glyphs. + * + * @param style + * the style of font. + * @param trans + * the AffineTransform. * @return the Font object. */ @SuppressWarnings("unchecked") @@ -644,53 +676,48 @@ public class Font implements Serializable { // awt.94=transform can not be null throw new IllegalArgumentException(Messages.getString("awt.94")); //$NON-NLS-1$ } - Hashtable derivefRequestedAttributes = (Hashtable) fRequestedAttributes + Hashtable derivefRequestedAttributes = (Hashtable)fRequestedAttributes .clone(); if ((style & BOLD) != 0) { - derivefRequestedAttributes.put(TextAttribute.WEIGHT, - TextAttribute.WEIGHT_BOLD); + derivefRequestedAttributes.put(TextAttribute.WEIGHT, TextAttribute.WEIGHT_BOLD); } else if (derivefRequestedAttributes.get(TextAttribute.WEIGHT) != null) { derivefRequestedAttributes.remove(TextAttribute.WEIGHT); } if ((style & ITALIC) != 0) { - derivefRequestedAttributes.put(TextAttribute.POSTURE, - TextAttribute.POSTURE_OBLIQUE); + derivefRequestedAttributes.put(TextAttribute.POSTURE, TextAttribute.POSTURE_OBLIQUE); } else if (derivefRequestedAttributes.get(TextAttribute.POSTURE) != null) { derivefRequestedAttributes.remove(TextAttribute.POSTURE); } - derivefRequestedAttributes.put(TextAttribute.TRANSFORM, - new TransformAttribute(trans)); + derivefRequestedAttributes.put(TextAttribute.TRANSFORM, new TransformAttribute(trans)); return new Font(derivefRequestedAttributes); } /** - * Returns a new Font that is a copy of the current Font - * modified so that the size and style are the specified - * size and style. - * - * @param style the style of font. - * @param size the size of font. + * Returns a new Font that is a copy of the current Font modified so that + * the size and style are the specified size and style. * + * @param style + * the style of font. + * @param size + * the size of font. * @return the Font object. */ @SuppressWarnings("unchecked") public Font deriveFont(int style, float size) { - Hashtable derivefRequestedAttributes = (Hashtable) fRequestedAttributes + Hashtable derivefRequestedAttributes = (Hashtable)fRequestedAttributes .clone(); if ((style & BOLD) != 0) { - derivefRequestedAttributes.put(TextAttribute.WEIGHT, - TextAttribute.WEIGHT_BOLD); + derivefRequestedAttributes.put(TextAttribute.WEIGHT, TextAttribute.WEIGHT_BOLD); } else if (derivefRequestedAttributes.get(TextAttribute.WEIGHT) != null) { derivefRequestedAttributes.remove(TextAttribute.WEIGHT); } if ((style & ITALIC) != 0) { - derivefRequestedAttributes.put(TextAttribute.POSTURE, - TextAttribute.POSTURE_OBLIQUE); + derivefRequestedAttributes.put(TextAttribute.POSTURE, TextAttribute.POSTURE_OBLIQUE); } else if (derivefRequestedAttributes.get(TextAttribute.POSTURE) != null) { derivefRequestedAttributes.remove(TextAttribute.POSTURE); } @@ -703,15 +730,15 @@ public class Font implements Serializable { /** * Returns a new Font object with a new set of font attributes. * - * @param attributes the map of attributes. - * + * @param attributes + * the map of attributes. * @return the Font. */ @SuppressWarnings("unchecked") public Font deriveFont(Map attributes) { Attribute[] avalAttributes = this.getAvailableAttributes(); - Hashtable derivefRequestedAttributes = (Hashtable) fRequestedAttributes + Hashtable derivefRequestedAttributes = (Hashtable)fRequestedAttributes .clone(); Object currAttribute; for (Attribute element : avalAttributes) { @@ -726,10 +753,10 @@ public class Font implements Serializable { /** * Compares the specified Object with the current Font. * - * @param obj the Object to be compared. - * - * @return true, if the specified Object is an instance of Font - * with the same family, size, and style as this Font, false otherwise. + * @param obj + * the Object to be compared. + * @return true, if the specified Object is an instance of Font with the + * same family, size, and style as this Font, false otherwise. */ @Override public boolean equals(Object obj) { @@ -739,11 +766,10 @@ public class Font implements Serializable { if (obj != null) { try { - Font font = (Font) obj; + Font font = (Font)obj; return ((this.style == font.style) && (this.size == font.size) - && this.name.equals(font.name) - && (this.pointSize == font.pointSize) && (this + && this.name.equals(font.name) && (this.pointSize == font.pointSize) && (this .getTransform()).equals(font.getTransform())); } catch (ClassCastException e) { } @@ -759,7 +785,7 @@ public class Font implements Serializable { */ @SuppressWarnings("unchecked") public Map getAttributes() { - return (Map) fRequestedAttributes.clone(); + return (Map)fRequestedAttributes.clone(); } /** @@ -768,18 +794,19 @@ public class Font implements Serializable { * @return the keys array of all available attributes. */ public Attribute[] getAvailableAttributes() { - Attribute[] attrs = { TextAttribute.FAMILY, TextAttribute.POSTURE, - TextAttribute.SIZE, TextAttribute.TRANSFORM, - TextAttribute.WEIGHT, TextAttribute.SUPERSCRIPT, - TextAttribute.WIDTH }; + Attribute[] attrs = { + TextAttribute.FAMILY, TextAttribute.POSTURE, TextAttribute.SIZE, + TextAttribute.TRANSFORM, TextAttribute.WEIGHT, TextAttribute.SUPERSCRIPT, + TextAttribute.WIDTH + }; return attrs; } /** * Gets the baseline for this character. * - * @param c the character. - * + * @param c + * the character. * @return the baseline for this character. */ public byte getBaselineFor(char c) { @@ -800,19 +827,18 @@ public class Font implements Serializable { } /** - * Returns the family name of this Font associated with - * the specified locale. - * - * @param l the locale. + * Returns the family name of this Font associated with the specified + * locale. * - * @return the family name of this Font associated with - * the specified locale. + * @param l + * the locale. + * @return the family name of this Font associated with the specified + * locale. */ public String getFamily(Locale l) { if (l == null) { // awt.01='{0}' parameter is null - throw new NullPointerException(Messages.getString( - "awt.01", "Locale")); //$NON-NLS-1$ //$NON-NLS-2$ + throw new NullPointerException(Messages.getString("awt.01", "Locale")); //$NON-NLS-1$ //$NON-NLS-2$ } return getFamily(); } @@ -820,12 +846,12 @@ public class Font implements Serializable { /** * Gets a Font with the specified attribute set. * - * @param attributes the attributes to be assigned to the new Font. - * + * @param attributes + * the attributes to be assigned to the new Font. * @return the Font. */ public static Font getFont(Map attributes) { - Font fnt = (Font) attributes.get(TextAttribute.FONT); + Font fnt = (Font)attributes.get(TextAttribute.FONT); if (fnt != null) { return fnt; } @@ -833,14 +859,16 @@ public class Font implements Serializable { } /** - * Gets a Font object from the system properties list with the specified name - * or returns the specified Font if there is no such property. - * - * @param sp the specified property name. - * @param f the Font. + * Gets a Font object from the system properties list with the specified + * name or returns the specified Font if there is no such property. * - * @return the Font object from the system properties list with the specified name - * or the specified Font if there is no such property. + * @param sp + * the specified property name. + * @param f + * the Font. + * @return the Font object from the system properties list with the + * specified name or the specified Font if there is no such + * property. */ public static Font getFont(String sp, Font f) { String pr = System.getProperty(sp); @@ -851,12 +879,13 @@ public class Font implements Serializable { } /** - * Gets a Font object from the system properties list with the specified name. - * - * @param sp the system property name. + * Gets a Font object from the system properties list with the specified + * name. * - * @return the Font, or null if there is no shuch property - * with the specified name. + * @param sp + * the system property name. + * @return the Font, or null if there is no such property with the specified + * name. */ public static Font getFont(String sp) { return getFont(sp, null); @@ -877,8 +906,8 @@ public class Font implements Serializable { /** * Returns the font name associated with the specified locale. * - * @param l the locale. - * + * @param l + * the locale. * @return the font name associated with the specified locale. */ public String getFontName(Locale l) { @@ -888,38 +917,45 @@ public class Font implements Serializable { /** * Returns a LineMetrics object created with the specified parameters. * - * @param chars the chars array. - * @param start the start offset. - * @param end the end offset. - * @param frc the FontRenderContext. - * + * @param chars + * the chars array. + * @param start + * the start offset. + * @param end + * the end offset. + * @param frc + * the FontRenderContext. * @return the LineMetrics for the specified parameters. */ - public LineMetrics getLineMetrics(char[] chars, int start, int end, - FontRenderContext frc) { + public LineMetrics getLineMetrics(char[] chars, int start, int end, FontRenderContext frc) { if (frc == null) { // awt.00=FontRenderContext is null throw new NullPointerException(Messages.getString("awt.00")); //$NON-NLS-1$ } - //FontMetrics fm = AndroidGraphics2D.getInstance().getFontMetrics(); + // FontMetrics fm = AndroidGraphics2D.getInstance().getFontMetrics(); FontMetrics fm = new FontMetricsImpl(this); - float[] fmet = {fm.getAscent(), fm.getDescent(), fm.getLeading()}; + float[] fmet = { + fm.getAscent(), fm.getDescent(), fm.getLeading() + }; return new LineMetricsImpl(chars.length, fmet, null); } /** * Returns a LineMetrics object created with the specified parameters. * - * @param iter the CharacterIterator. - * @param start the start offset. - * @param end the end offset. - * @param frc the FontRenderContext. - * + * @param iter + * the CharacterIterator. + * @param start + * the start offset. + * @param end + * the end offset. + * @param frc + * the FontRenderContext. * @return the LineMetrics for the specified parameters. */ - public LineMetrics getLineMetrics(CharacterIterator iter, int start, - int end, FontRenderContext frc) { + public LineMetrics getLineMetrics(CharacterIterator iter, int start, int end, + FontRenderContext frc) { if (frc == null) { // awt.00=FontRenderContext is null @@ -935,8 +971,8 @@ public class Font implements Serializable { } else { char[] chars = new char[iterCount]; int i = 0; - for (char c = iter.setIndex(start); c != CharacterIterator.DONE - && (i < iterCount); c = iter.next()) { + for (char c = iter.setIndex(start); c != CharacterIterator.DONE && (i < iterCount); c = iter + .next()) { chars[i] = c; i++; } @@ -948,16 +984,19 @@ public class Font implements Serializable { /** * Returns a LineMetrics object created with the specified parameters. * - * @param str the String. - * @param frc the FontRenderContext. - * + * @param str + * the String. + * @param frc + * the FontRenderContext. * @return the LineMetrics for the specified parameters. */ public LineMetrics getLineMetrics(String str, FontRenderContext frc) { - //FontMetrics fm = AndroidGraphics2D.getInstance().getFontMetrics(); + // FontMetrics fm = AndroidGraphics2D.getInstance().getFontMetrics(); FontMetrics fm = new FontMetricsImpl(this); - float[] fmet = {fm.getAscent(), fm.getDescent(), fm.getLeading()}; - //Log.i("FONT FMET", fmet.toString()); + float[] fmet = { + fm.getAscent(), fm.getDescent(), fm.getLeading() + }; + // Log.i("FONT FMET", fmet.toString()); return new LineMetricsImpl(str.length(), fmet, null); } @@ -965,45 +1004,48 @@ public class Font implements Serializable { /** * Returns a LineMetrics object created with the specified parameters. * - * @param str the String. - * @param start the start offset. - * @param end the end offset. - * @param frc the FontRenderContext. - * + * @param str + * the String. + * @param start + * the start offset. + * @param end + * the end offset. + * @param frc + * the FontRenderContext. * @return the LineMetrics for the specified parameters. */ - public LineMetrics getLineMetrics(String str, int start, int end, - FontRenderContext frc) { + public LineMetrics getLineMetrics(String str, int start, int end, FontRenderContext frc) { return this.getLineMetrics(str.substring(start, end), frc); } /** - * Gets the logical bounds of the specified String in - * the specified FontRenderContext. The logical bounds contains - * the origin, ascent, advance, and height. - * - * @param ci the specified CharacterIterator. - * @param start the start offset. - * @param end the end offset. - * @param frc the FontRenderContext. - * + * Gets the logical bounds of the specified String in the specified + * FontRenderContext. The logical bounds contains the origin, ascent, + * advance, and height. + * + * @param ci + * the specified CharacterIterator. + * @param start + * the start offset. + * @param end + * the end offset. + * @param frc + * the FontRenderContext. * @return a Rectangle2D object. */ - public Rectangle2D getStringBounds(CharacterIterator ci, int start, - int end, FontRenderContext frc) { + public Rectangle2D getStringBounds(CharacterIterator ci, int start, int end, + FontRenderContext frc) { int first = ci.getBeginIndex(); int finish = ci.getEndIndex(); char[] chars; if (start < first) { // awt.95=Wrong start index: {0} - throw new IndexOutOfBoundsException(Messages.getString( - "awt.95", start)); //$NON-NLS-1$ + throw new IndexOutOfBoundsException(Messages.getString("awt.95", start)); //$NON-NLS-1$ } if (end > finish) { // awt.96=Wrong finish index: {0} - throw new IndexOutOfBoundsException(Messages.getString( - "awt.96", end)); //$NON-NLS-1$ + throw new IndexOutOfBoundsException(Messages.getString("awt.96", end)); //$NON-NLS-1$ } if (start > end) { // awt.97=Wrong range length: {0} @@ -1028,13 +1070,14 @@ public class Font implements Serializable { } /** - * Gets the logical bounds of the specified String in - * the specified FontRenderContext. The logical bounds contains - * the origin, ascent, advance, and height. - * - * @param str the specified String. - * @param frc the FontRenderContext. - * + * Gets the logical bounds of the specified String in the specified + * FontRenderContext. The logical bounds contains the origin, ascent, + * advance, and height. + * + * @param str + * the specified String. + * @param frc + * the FontRenderContext. * @return a Rectangle2D object. */ public Rectangle2D getStringBounds(String str, FontRenderContext frc) { @@ -1044,46 +1087,48 @@ public class Font implements Serializable { } /** - * Gets the logical bounds of the specified String in - * the specified FontRenderContext. The logical bounds contains - * the origin, ascent, advance, and height. - * - * @param str the specified String. - * @param start the start offset. - * @param end the end offset. - * @param frc the FontRenderContext. - * + * Gets the logical bounds of the specified String in the specified + * FontRenderContext. The logical bounds contains the origin, ascent, + * advance, and height. + * + * @param str + * the specified String. + * @param start + * the start offset. + * @param end + * the end offset. + * @param frc + * the FontRenderContext. * @return a Rectangle2D object. */ - public Rectangle2D getStringBounds(String str, int start, int end, - FontRenderContext frc) { + public Rectangle2D getStringBounds(String str, int start, int end, FontRenderContext frc) { return this.getStringBounds((str.substring(start, end)), frc); } /** - * Gets the logical bounds of the specified String in - * the specified FontRenderContext. The logical bounds contains - * the origin, ascent, advance, and height. - * - * @param chars the specified character array. - * @param start the start offset. - * @param end the end offset. - * @param frc the FontRenderContext. - * + * Gets the logical bounds of the specified String in the specified + * FontRenderContext. The logical bounds contains the origin, ascent, + * advance, and height. + * + * @param chars + * the specified character array. + * @param start + * the start offset. + * @param end + * the end offset. + * @param frc + * the FontRenderContext. * @return a Rectangle2D object. */ - public Rectangle2D getStringBounds(char[] chars, int start, int end, - FontRenderContext frc) { + public Rectangle2D getStringBounds(char[] chars, int start, int end, FontRenderContext frc) { if (start < 0) { // awt.95=Wrong start index: {0} - throw new IndexOutOfBoundsException(Messages.getString( - "awt.95", start)); //$NON-NLS-1$ + throw new IndexOutOfBoundsException(Messages.getString("awt.95", start)); //$NON-NLS-1$ } if (end > chars.length) { // awt.96=Wrong finish index: {0} - throw new IndexOutOfBoundsException(Messages.getString( - "awt.96", end)); //$NON-NLS-1$ + throw new IndexOutOfBoundsException(Messages.getString("awt.96", end)); //$NON-NLS-1$ } if (start > end) { // awt.97=Wrong range length: {0} @@ -1095,7 +1140,7 @@ public class Font implements Serializable { throw new NullPointerException(Messages.getString("awt.00")); //$NON-NLS-1$ } - FontPeerImpl peer = (FontPeerImpl) this.getPeer(); + FontPeerImpl peer = (FontPeerImpl)this.getPeer(); final int TRANSFORM_MASK = AffineTransform.TYPE_GENERAL_ROTATION | AffineTransform.TYPE_GENERAL_TRANSFORM; @@ -1110,13 +1155,13 @@ public class Font implements Serializable { for (int i = start; i < end; i++) { width += peer.charWidth(chars[i]); } - //LineMetrics nlm = peer.getLineMetrics(); - + // LineMetrics nlm = peer.getLineMetrics(); + LineMetrics nlm = getLineMetrics(chars, start, end, frc); - + bounds = transform.createTransformedShape( - new Rectangle2D.Float(0, -nlm.getAscent(), width, nlm - .getHeight())).getBounds2D(); + new Rectangle2D.Float(0, -nlm.getAscent(), width, nlm.getHeight())) + .getBounds2D(); } else { int len = end - start; char[] subChars = new char[len]; @@ -1127,11 +1172,11 @@ public class Font implements Serializable { } /** - * Gets the character's maximum bounds as defined in - * the specified FontRenderContext. - * - * @param frc the FontRenderContext. + * Gets the character's maximum bounds as defined in the specified + * FontRenderContext. * + * @param frc + * the FontRenderContext. * @return the character's maximum bounds. */ public Rectangle2D getMaxCharBounds(FontRenderContext frc) { @@ -1140,7 +1185,7 @@ public class Font implements Serializable { throw new NullPointerException(Messages.getString("awt.00")); //$NON-NLS-1$ } - FontPeerImpl peer = (FontPeerImpl) this.getPeer(); + FontPeerImpl peer = (FontPeerImpl)this.getPeer(); Rectangle2D bounds = peer.getMaxCharBounds(frc); AffineTransform transform = getTransform(); @@ -1155,42 +1200,40 @@ public class Font implements Serializable { } /** - * Returns a new GlyphVector object performing full layout of - * the text. - * - * @param frc the FontRenderContext. - * @param chars the character array to be layout. - * @param start the start offset of the text to use for - * the GlyphVector. - * @param count the count of characters to use for - * the GlyphVector. - * @param flags the flag indicating text direction: - * LAYOUT_RIGHT_TO_LEFT, LAYOUT_LEFT_TO_RIGHT. - * + * Returns a new GlyphVector object performing full layout of the text. + * + * @param frc + * the FontRenderContext. + * @param chars + * the character array to be layout. + * @param start + * the start offset of the text to use for the GlyphVector. + * @param count + * the count of characters to use for the GlyphVector. + * @param flags + * the flag indicating text direction: LAYOUT_RIGHT_TO_LEFT, + * LAYOUT_LEFT_TO_RIGHT. * @return the GlyphVector. */ - public GlyphVector layoutGlyphVector(FontRenderContext frc, char[] chars, - int start, int count, int flags) { + public GlyphVector layoutGlyphVector(FontRenderContext frc, char[] chars, int start, int count, + int flags) { // TODO: implement method for bidirectional text. // At the moment only LTR and RTL texts supported. if (start < 0) { // awt.95=Wrong start index: {0} - throw new ArrayIndexOutOfBoundsException(Messages.getString( - "awt.95", //$NON-NLS-1$ + throw new ArrayIndexOutOfBoundsException(Messages.getString("awt.95", //$NON-NLS-1$ start)); } if (count < 0) { // awt.98=Wrong count value, can not be negative: {0} - throw new ArrayIndexOutOfBoundsException(Messages.getString( - "awt.98", //$NON-NLS-1$ + throw new ArrayIndexOutOfBoundsException(Messages.getString("awt.98", //$NON-NLS-1$ count)); } if (start + count > chars.length) { // awt.99=Wrong [start + count] is out of range: {0} - throw new ArrayIndexOutOfBoundsException(Messages.getString( - "awt.99", //$NON-NLS-1$ + throw new ArrayIndexOutOfBoundsException(Messages.getString("awt.99", //$NON-NLS-1$ (start + count))); } @@ -1234,7 +1277,7 @@ public class Font implements Serializable { * @return the postscript name of this Font. */ public String getPSName() { - FontPeerImpl peer = (FontPeerImpl) this.getPeer(); + FontPeerImpl peer = (FontPeerImpl)this.getPeer(); return peer.getPSName(); } @@ -1251,39 +1294,37 @@ public class Font implements Serializable { * Gets the peer of this Font. * * @return the peer of this Font. - * * @deprecated Font rendering is platform independent now. */ @Deprecated public java.awt.peer.FontPeer getPeer() { if (fontPeer == null) { - fontPeer = (FontPeerImpl) Toolkit.getDefaultToolkit() - .getGraphicsFactory().getFontPeer(this); + fontPeer = (FontPeerImpl)Toolkit.getDefaultToolkit().getGraphicsFactory().getFontPeer( + this); } return fontPeer; } /** - * Gets the transform acting on this Font (from the Font's - * attributes). + * Gets the transform acting on this Font (from the Font's attributes). * - * @return the transformation of this Font. + * @return the transformation of this Font. */ public AffineTransform getTransform() { Object transform = fRequestedAttributes.get(TextAttribute.TRANSFORM); if (transform != null) { if (transform instanceof TransformAttribute) { - return ((TransformAttribute) transform).getTransform(); + return ((TransformAttribute)transform).getTransform(); } if (transform instanceof AffineTransform) { - return new AffineTransform((AffineTransform) transform); + return new AffineTransform((AffineTransform)transform); } } else { transform = new AffineTransform(); } - return (AffineTransform) transform; + return (AffineTransform)transform; } @@ -1324,13 +1365,12 @@ public class Font implements Serializable { } /** - * Returns true if this Font has uniform line metrics. + * Returns true if this Font has uniform line metrics. * - * @return true if this Font has uniform line metrics, - * false otherwise. + * @return true if this Font has uniform line metrics, false otherwise. */ public boolean hasUniformLineMetrics() { - FontPeerImpl peer = (FontPeerImpl) this.getPeer(); + FontPeerImpl peer = (FontPeerImpl)this.getPeer(); return peer.hasUniformLineMetrics(); } @@ -1338,7 +1378,6 @@ public class Font implements Serializable { * Returns hash code of this Font object. * * @return the hash code of this Font object. - */ @Override public int hashCode() { @@ -1376,21 +1415,21 @@ public class Font implements Serializable { */ public int getNumGlyphs() { if (numGlyphs == -1) { - FontPeerImpl peer = (FontPeerImpl) this.getPeer(); + FontPeerImpl peer = (FontPeerImpl)this.getPeer(); this.numGlyphs = peer.getNumGlyphs(); } return this.numGlyphs; } /** - * Gets the glyphCode which is used as default glyph when this Font - * does not have a glyph for a specified unicode. + * Gets the glyphCode which is used as default glyph when this Font does not + * have a glyph for a specified Unicode. * * @return the missing glyph code. */ public int getMissingGlyphCode() { if (missingGlyphCode == -1) { - FontPeerImpl peer = (FontPeerImpl) this.getPeer(); + FontPeerImpl peer = (FontPeerImpl)this.getPeer(); this.missingGlyphCode = peer.getMissingGlyphCode(); } return this.missingGlyphCode; @@ -1407,29 +1446,30 @@ public class Font implements Serializable { /** * Gets the italic angle of this Font. - * + * * @return the italic angle of this Font. */ public float getItalicAngle() { - FontPeerImpl peer = (FontPeerImpl) this.getPeer(); + FontPeerImpl peer = (FontPeerImpl)this.getPeer(); return peer.getItalicAngle(); } /** * Creates the font with the specified font format and font file. * - * @param fontFormat the font format. - * @param fontFile the file object represented the input data - * for the font. - * + * @param fontFormat + * the font format. + * @param fontFile + * the file object represented the input data for the font. * @return the Font. - * - * @throws FontFormatException is thrown if fontFile does not contain - * the required font tables for the specified format. - * @throws IOException signals that an I/O exception has occurred. - */ - public static Font createFont(int fontFormat, File fontFile) - throws FontFormatException, IOException { + * @throws FontFormatException + * is thrown if fontFile does not contain the required font + * tables for the specified format. + * @throws IOException + * signals that an I/O exception has occurred. + */ + public static Font createFont(int fontFormat, File fontFile) throws FontFormatException, + IOException { // ???AWT not supported InputStream is = new FileInputStream(fontFile); try { @@ -1442,15 +1482,16 @@ public class Font implements Serializable { /** * Creates the font with the specified font format and input stream. * - * @param fontFormat the font format. - * @param fontStream the input stream represented input data for - * the font. - * + * @param fontFormat + * the font format. + * @param fontStream + * the input stream represented input data for the font. * @return the Font. - * - * @throws FontFormatException is thrown if fontFile does not contain - * the required font tables for the specified format. - * @throws IOException signals that an I/O exception has occurred. + * @throws FontFormatException + * is thrown if fontFile does not contain the required font + * tables for the specified format. + * @throws IOException + * signals that an I/O exception has occurred. */ public static Font createFont(int fontFormat, InputStream fontStream) throws FontFormatException, IOException { @@ -1466,15 +1507,15 @@ public class Font implements Serializable { if (fontFormat != TRUETYPE_FONT) { // awt.9A=Unsupported font format throw new IllegalArgumentException(Messages.getString("awt.9A")); //$NON-NLS-1$ } - + /* Get font file in system-specific directory */ - File fontFile = Toolkit.getDefaultToolkit().getGraphicsFactory() - .getFontManager().getTempFontFile(); + File fontFile = Toolkit.getDefaultToolkit().getGraphicsFactory().getFontManager() + .getTempFontFile(); - // BEGIN android-modified + // BEGIN android-modified buffStream = new BufferedInputStream(fontStream, 8192); - // END android-modified + // END android-modified FileOutputStream fOutStream = new FileOutputStream(fontFile); bRead = buffStream.read(buf, 0, size); diff --git a/awt/java/awt/FontFormatException.java b/awt/java/awt/FontFormatException.java index c017fd24a53a3..806711a76429d 100644 --- a/awt/java/awt/FontFormatException.java +++ b/awt/java/awt/FontFormatException.java @@ -18,21 +18,27 @@ * @author Ilya S. Okomin * @version $Revision$ */ + package java.awt; /** - * The FontFormatException class is used to provide notification - * and information that font can't be created. + * The FontFormatException class is used to provide notification and information + * that font can't be created. + * + * @since Android 1.0 */ public class FontFormatException extends Exception { - - /** The Constant serialVersionUID. */ + + /** + * The Constant serialVersionUID. + */ private static final long serialVersionUID = -4481290147811361272L; /** * Instantiates a new font format exception with detailed message. * - * @param reason the detailed message. + * @param reason + * the detailed message. */ public FontFormatException(String reason) { super(reason); diff --git a/awt/java/awt/FontMetrics.java b/awt/java/awt/FontMetrics.java index 3948d736abead..90826265a7f15 100644 --- a/awt/java/awt/FontMetrics.java +++ b/awt/java/awt/FontMetrics.java @@ -18,6 +18,7 @@ * @author Ilya S. Okomin * @version $Revision$ */ + package java.awt; import java.awt.font.FontRenderContext; @@ -29,34 +30,40 @@ import java.text.CharacterIterator; import org.apache.harmony.awt.internal.nls.Messages; /** - * The FontMetrics class contains information about the rendering - * of a particular font on a particular screen. + * The FontMetrics class contains information about the rendering of a + * particular font on a particular screen. *

- * Each character in the Font has three values that help define where - * to place it: an ascent, a descent, and an advance. The ascent is the - * distance the character extends above the baseline. The descent is - * the distance the character extends below the baseline. - * The advance width defines the position at which the next character - * should be placed. + * Each character in the Font has three values that help define where to place + * it: an ascent, a descent, and an advance. The ascent is the distance the + * character extends above the baseline. The descent is the distance the + * character extends below the baseline. The advance width defines the position + * at which the next character should be placed. *

- * An array of characters or a string has an ascent, a descent, - * and an advance width too. The ascent or descent of the array - * is specified by the maximum ascent or descent of the characters - * in the array. The advance width is the sum of the advance widths - * of each of the characters in the character array. + * An array of characters or a string has an ascent, a descent, and an advance + * width too. The ascent or descent of the array is specified by the maximum + * ascent or descent of the characters in the array. The advance width is the + * sum of the advance widths of each of the characters in the character array. + *

+ * + * @since Android 1.0 */ public abstract class FontMetrics implements Serializable { - - /** The Constant serialVersionUID. */ + + /** + * The Constant serialVersionUID. + */ private static final long serialVersionUID = 1681126225205050147L; - /** The font from which the FontMetrics is created. */ + /** + * The font from which the FontMetrics is created. + */ protected Font font; /** * Instantiates a new font metrics from the specified Font. * - * @param fnt the Font. + * @param fnt + * the Font. */ protected FontMetrics(Font fnt) { this.font = fnt; @@ -65,12 +72,11 @@ public abstract class FontMetrics implements Serializable { /** * Returns the String representation of this FontMetrics. * - * @return the string + * @return the string. */ @Override public String toString() { - return this.getClass().getName() + - "[font=" + this.getFont() + //$NON-NLS-1$ + return this.getClass().getName() + "[font=" + this.getFont() + //$NON-NLS-1$ "ascent=" + this.getAscent() + //$NON-NLS-1$ ", descent=" + this.getDescent() + //$NON-NLS-1$ ", height=" + this.getHeight() + "]"; //$NON-NLS-1$ //$NON-NLS-2$ @@ -95,9 +101,9 @@ public abstract class FontMetrics implements Serializable { } /** - * Gets the font ascent of the Font associated with this FontMetrics. - * The font ascent is the distance from the font's baseline to - * the top of most alphanumeric characters. + * Gets the font ascent of the Font associated with this FontMetrics. The + * font ascent is the distance from the font's baseline to the top of most + * alphanumeric characters. * * @return the ascent of the Font associated with this FontMetrics. */ @@ -106,9 +112,9 @@ public abstract class FontMetrics implements Serializable { } /** - * Gets the font descent of the Font associated with this FontMetrics. - * The font descent is the distance from the font's baseline to - * the bottom of most alphanumeric characters with descenders. + * Gets the font descent of the Font associated with this FontMetrics. The + * font descent is the distance from the font's baseline to the bottom of + * most alphanumeric characters with descenders. * * @return the descent of the Font associated with this FontMetrics. */ @@ -126,192 +132,198 @@ public abstract class FontMetrics implements Serializable { } /** - * Gets the LineMetrics object for the specified CharacterIterator - * in the specified Graphics. - * - * @param ci the CharacterIterator. - * @param beginIndex the offset. - * @param limit the number of characters to be used. - * @param context the Graphics. - * - * @return the LineMetrics object for the specified CharacterIterator - * in the specified Graphics. + * Gets the LineMetrics object for the specified CharacterIterator in the + * specified Graphics. + * + * @param ci + * the CharacterIterator. + * @param beginIndex + * the offset. + * @param limit + * the number of characters to be used. + * @param context + * the Graphics. + * @return the LineMetrics object for the specified CharacterIterator in the + * specified Graphics. */ - public LineMetrics getLineMetrics(CharacterIterator ci, int beginIndex, - int limit, Graphics context) { - return font.getLineMetrics(ci, beginIndex, limit, - this.getFRCFromGraphics(context)); + public LineMetrics getLineMetrics(CharacterIterator ci, int beginIndex, int limit, + Graphics context) { + return font.getLineMetrics(ci, beginIndex, limit, this.getFRCFromGraphics(context)); } /** - * Gets the LineMetrics object for the specified String - * in the specified Graphics. - * - * @param str the String. - * @param context the Graphics. - * - * @return the LineMetrics object for the specified String - * in the specified Graphics. + * Gets the LineMetrics object for the specified String in the specified + * Graphics. + * + * @param str + * the String. + * @param context + * the Graphics. + * @return the LineMetrics object for the specified String in the specified + * Graphics. */ public LineMetrics getLineMetrics(String str, Graphics context) { return font.getLineMetrics(str, this.getFRCFromGraphics(context)); } /** - * Gets the LineMetrics object for the specified character - * array in the specified Graphics. - * - * @param chars the character array. - * @param beginIndex the offset of array. - * @param limit the number of characters to be used. - * @param context the Graphics. - * - * @return the LineMetrics object for the specified character - * array in the specified Graphics. + * Gets the LineMetrics object for the specified character array in the + * specified Graphics. + * + * @param chars + * the character array. + * @param beginIndex + * the offset of array. + * @param limit + * the number of characters to be used. + * @param context + * the Graphics. + * @return the LineMetrics object for the specified character array in the + * specified Graphics. */ - public LineMetrics getLineMetrics(char[] chars, int beginIndex, int limit, - Graphics context) { - return font.getLineMetrics(chars, beginIndex, limit, - this.getFRCFromGraphics(context)); + public LineMetrics getLineMetrics(char[] chars, int beginIndex, int limit, Graphics context) { + return font.getLineMetrics(chars, beginIndex, limit, this.getFRCFromGraphics(context)); } /** - * Gets the LineMetrics object for the specified String - * in the specified Graphics. - * - * @param str the String. - * @param beginIndex the offset. - * @param limit the number of characters to be used. - * @param context the Graphics. - * - * @return the LineMetrics object for the specified String - * in the specified Graphics. + * Gets the LineMetrics object for the specified String in the specified + * Graphics. + * + * @param str + * the String. + * @param beginIndex + * the offset. + * @param limit + * the number of characters to be used. + * @param context + * the Graphics. + * @return the LineMetrics object for the specified String in the specified + * Graphics. */ - public LineMetrics getLineMetrics(String str, int beginIndex, int limit, - Graphics context) { - return font.getLineMetrics(str, beginIndex, limit, - this.getFRCFromGraphics(context)); + public LineMetrics getLineMetrics(String str, int beginIndex, int limit, Graphics context) { + return font.getLineMetrics(str, beginIndex, limit, this.getFRCFromGraphics(context)); } /** - * Returns the character's maximum bounds in the specified - * Graphics context. - * - * @param context the Graphics context. + * Returns the character's maximum bounds in the specified Graphics context. * - * @return the character's maximum bounds in the specified - * Graphics context. + * @param context + * the Graphics context. + * @return the character's maximum bounds in the specified Graphics context. */ public Rectangle2D getMaxCharBounds(Graphics context) { return this.font.getMaxCharBounds(this.getFRCFromGraphics(context)); } - + /** - * Gets the bounds of the specified CharacterIterator - * in the specified Graphics context. - * - * @param ci the CharacterIterator. - * @param beginIndex the begin offset of the array. - * @param limit the number of characters. - * @param context the Graphics. + * Gets the bounds of the specified CharacterIterator in the specified + * Graphics context. * - * @return the bounds of the specified CharacterIterator - * in the specified Graphics context. + * @param ci + * the CharacterIterator. + * @param beginIndex + * the begin offset of the array. + * @param limit + * the number of characters. + * @param context + * the Graphics. + * @return the bounds of the specified CharacterIterator in the specified + * Graphics context. */ - public Rectangle2D getStringBounds(CharacterIterator ci, int beginIndex, - int limit, Graphics context) { - return font.getStringBounds(ci, beginIndex, limit, - this.getFRCFromGraphics(context)); + public Rectangle2D getStringBounds(CharacterIterator ci, int beginIndex, int limit, + Graphics context) { + return font.getStringBounds(ci, beginIndex, limit, this.getFRCFromGraphics(context)); } /** - * Gets the bounds of the specified String - * in the specified Graphics context. - * - * @param str the String. - * @param beginIndex the begin offset of the array. - * @param limit the number of characters. - * @param context the Graphics. - * - * @return the bounds of the specified String - * in the specified Graphics context. + * Gets the bounds of the specified String in the specified Graphics + * context. + * + * @param str + * the String. + * @param beginIndex + * the begin offset of the array. + * @param limit + * the number of characters. + * @param context + * the Graphics. + * @return the bounds of the specified String in the specified Graphics + * context. */ - public Rectangle2D getStringBounds(String str, int beginIndex, int limit, - Graphics context) { - return font.getStringBounds(str, beginIndex, limit, - this.getFRCFromGraphics(context)); + public Rectangle2D getStringBounds(String str, int beginIndex, int limit, Graphics context) { + return font.getStringBounds(str, beginIndex, limit, this.getFRCFromGraphics(context)); } - /** - * Gets the bounds of the specified characters array - * in the specified Graphics context. - * - * @param chars the characters array. - * @param beginIndex the begin offset of the array. - * @param limit the number of characters. - * @param context the Graphics. + * Gets the bounds of the specified characters array in the specified + * Graphics context. * - * @return the bounds of the specified characters array - * in the specified Graphics context. + * @param chars + * the characters array. + * @param beginIndex + * the begin offset of the array. + * @param limit + * the number of characters. + * @param context + * the Graphics. + * @return the bounds of the specified characters array in the specified + * Graphics context. */ - public Rectangle2D getStringBounds(char[] chars, int beginIndex, int limit, - Graphics context) { - return font.getStringBounds(chars, beginIndex, limit, - this.getFRCFromGraphics(context)); + public Rectangle2D getStringBounds(char[] chars, int beginIndex, int limit, Graphics context) { + return font.getStringBounds(chars, beginIndex, limit, this.getFRCFromGraphics(context)); } /** - * Gets the bounds of the specified String - * in the specified Graphics context. - * - * @param str the String. - * @param context the Graphics. - * - * @return the bounds of the specified String - * in the specified Graphics context. + * Gets the bounds of the specified String in the specified Graphics + * context. + * + * @param str + * the String. + * @param context + * the Graphics. + * @return the bounds of the specified String in the specified Graphics + * context. */ public Rectangle2D getStringBounds(String str, Graphics context) { return font.getStringBounds(str, this.getFRCFromGraphics(context)); } /** - * Checks if the Font has uniform line metrics or not. - * The Font can contain characters of other fonts for - * covering character set. In this case the Font isn't - * uniform. - * - * @return true, if the Font has uniform line metrics, - * false otherwise. + * Checks if the Font has uniform line metrics or not. The Font can contain + * characters of other fonts for covering character set. In this case the + * Font isn't uniform. + * + * @return true, if the Font has uniform line metrics, false otherwise. */ public boolean hasUniformLineMetrics() { return this.font.hasUniformLineMetrics(); } /** - * Returns the distance from the leftmost point to the rightmost - * point on the string's baseline showing the specified array - * of bytes in this Font. - * - * @param data the array of bytes to be measured. - * @param off the start offset. - * @param len the number of bytes to be measured. - * + * Returns the distance from the leftmost point to the rightmost point on + * the string's baseline showing the specified array of bytes in this Font. + * + * @param data + * the array of bytes to be measured. + * @param off + * the start offset. + * @param len + * the number of bytes to be measured. * @return the advance width of the array. */ public int bytesWidth(byte[] data, int off, int len) { int width = 0; - if ((off >= data.length) || (off < 0)){ + if ((off >= data.length) || (off < 0)) { // awt.13B=offset off is out of range throw new IllegalArgumentException(Messages.getString("awt.13B")); //$NON-NLS-1$ } - if ((off+len > data.length)){ + if ((off + len > data.length)) { // awt.13C=number of elemets len is out of range throw new IllegalArgumentException(Messages.getString("awt.13C")); //$NON-NLS-1$ } - for (int i = off; i < off+len; i++){ + for (int i = off; i < off + len; i++) { width += charWidth(data[i]); } @@ -319,29 +331,31 @@ public abstract class FontMetrics implements Serializable { } /** - * Returns the distance from the leftmost point to the rightmost - * point on the string's baseline showing the specified array - * of characters in this Font. - * - * @param data the array of characters to be measured. - * @param off the start offset. - * @param len the number of bytes to be measured. - * + * Returns the distance from the leftmost point to the rightmost point on + * the string's baseline showing the specified array of characters in this + * Font. + * + * @param data + * the array of characters to be measured. + * @param off + * the start offset. + * @param len + * the number of bytes to be measured. * @return the advance width of the array. */ - public int charsWidth(char[] data, int off , int len){ + public int charsWidth(char[] data, int off, int len) { int width = 0; - if ((off >= data.length) || (off < 0)){ + if ((off >= data.length) || (off < 0)) { // awt.13B=offset off is out of range throw new IllegalArgumentException(Messages.getString("awt.13B")); //$NON-NLS-1$ } - if ((off+len > data.length)){ + if ((off + len > data.length)) { // awt.13C=number of elemets len is out of range throw new IllegalArgumentException(Messages.getString("awt.13C")); //$NON-NLS-1$ } - for (int i = off; i < off+len; i++){ + for (int i = off; i < off + len; i++) { width += charWidth(data[i]); } @@ -349,12 +363,11 @@ public abstract class FontMetrics implements Serializable { } /** - * Returns the distance from the leftmost point to the rightmost - * point of the specified character in this Font. - * - * @param ch the specified unicode point code of - * character to be measured. + * Returns the distance from the leftmost point to the rightmost point of + * the specified character in this Font. * + * @param ch + * the specified Unicode point code of character to be measured. * @return the advance width of the character. */ public int charWidth(int ch) { @@ -362,11 +375,11 @@ public abstract class FontMetrics implements Serializable { } /** - * Returns the distance from the leftmost point to the rightmost - * point of the specified character in this Font. - * - * @param ch the specified character to be measured. + * Returns the distance from the leftmost point to the rightmost point of + * the specified character in this Font. * + * @param ch + * the specified character to be measured. * @return the advance width of the character. */ public int charWidth(char ch) { @@ -383,11 +396,11 @@ public abstract class FontMetrics implements Serializable { } /** - * Gets the maximum font ascent of the Font associated with - * this FontMetrics. + * Gets the maximum font ascent of the Font associated with this + * FontMetrics. * - * @return the maximum font ascent of the Font associated with - * this FontMetrics. + * @return the maximum font ascent of the Font associated with this + * FontMetrics. */ public int getMaxAscent() { return 0; @@ -397,7 +410,6 @@ public abstract class FontMetrics implements Serializable { * Gets the maximum font descent of character in this Font. * * @return the maximum font descent of character in this Font. - * * @deprecated Replaced by getMaxDescent() method. */ @Deprecated @@ -426,23 +438,22 @@ public abstract class FontMetrics implements Serializable { /** * Returns the advance width for the specified String in this Font. * - * @param str String to be measured. - * - * @return the the advance width for the specified String - * in this Font. + * @param str + * String to be measured. + * @return the the advance width for the specified String in this Font. */ public int stringWidth(String str) { return 0; } - + /** - * Returns FontRenderContext instanse of the Graphics context specified. - * - * @param context the specified Graphics context + * Returns a FontRenderContext instance of the Graphics context specified. * + * @param context + * the specified Graphics context. * @return a FontRenderContext of the specified Graphics context. */ - private FontRenderContext getFRCFromGraphics(Graphics context){ + private FontRenderContext getFRCFromGraphics(Graphics context) { FontRenderContext frc; if (context instanceof Graphics2D) { frc = ((Graphics2D)context).getFontRenderContext(); @@ -453,4 +464,3 @@ public abstract class FontMetrics implements Serializable { return frc; } } - diff --git a/awt/java/awt/GradientPaint.java b/awt/java/awt/GradientPaint.java index 0e06528f98847..3b32ef53040ec 100644 --- a/awt/java/awt/GradientPaint.java +++ b/awt/java/awt/GradientPaint.java @@ -26,56 +26,71 @@ import org.apache.harmony.awt.internal.nls.Messages; /** * The GradientPaint class defines a way to fill a Shape with a linear color - * gradient pattern. + * gradient pattern. *

- * The GradientPaint's fill pattern is determined by two points and two colors, - * plus the cyclic mode option. - * Each of the two points is painted with its corresponding color, and on - * the line segment connecting the two points, the color is proportionally - * changed between the two colors. For points on the same line which are not - * between the two specified points (outside of the connecting segment) their - * color is determined by the cyclic mode option. If the mode is cyclic, then - * the rest of the line repeats the color pattern of the connecting segment, - * cycling back and forth between the two colors. If not, the mode is acyclic - * which means that all points - * on the line outside the connecting line segment are given the same - * color as the closest of the two specified points. + * The GradientPaint's fill pattern is determined by two points and two colors, + * plus the cyclic mode option. Each of the two points is painted with its + * corresponding color, and on the line segment connecting the two points, the + * color is proportionally changed between the two colors. For points on the + * same line which are not between the two specified points (outside of the + * connecting segment) their color is determined by the cyclic mode option. If + * the mode is cyclic, then the rest of the line repeats the color pattern of + * the connecting segment, cycling back and forth between the two colors. If + * not, the mode is acyclic which means that all points on the line outside the + * connecting line segment are given the same color as the closest of the two + * specified points. *

- * The color of points that are not on the line connecting the two - * specified points are given by perpendicular projection: by taking - * the set of lines perpendicular to the connecting line and for each - * one, the whole line is colored with the same color. + * The color of points that are not on the line connecting the two specified + * points are given by perpendicular projection: by taking the set of lines + * perpendicular to the connecting line and for each one, the whole line is + * colored with the same color. + * + * @since Android 1.0 */ public class GradientPaint implements Paint { - - /** The start point color. */ + + /** + * The start point color. + */ Color color1; - /** The end color point. */ + /** + * The end color point. + */ Color color2; - /** The location of the start point. */ + /** + * The location of the start point. + */ Point2D point1; - /** The location of the end point. */ + /** + * The location of the end point. + */ Point2D point2; - /** The indicator of cycle filling. If TRUE filling - * repeated outside points stripe, if FALSE solid color filling outside. */ + /** + * The indicator of cycle filling. If TRUE filling repeated outside points + * stripe, if FALSE solid color filling outside. + */ boolean cyclic; /** * Instantiates a new GradientPaint with cyclic or acyclic mode. * - * @param point1 the first specified point. - * @param color1 the Color of the first specified point. - * @param point2 the second specified point. - * @param color2 the Color of the second specified point. - * @param cyclic the cyclic mode - true if the gradient pattern should cycle - * repeatedly between the two colors; false otherwise. - */ - public GradientPaint(Point2D point1, Color color1, Point2D point2, - Color color2, boolean cyclic) { + * @param point1 + * the first specified point. + * @param color1 + * the Color of the first specified point. + * @param point2 + * the second specified point. + * @param color2 + * the Color of the second specified point. + * @param cyclic + * the cyclic mode - true if the gradient pattern should cycle + * repeatedly between the two colors; false otherwise. + */ + public GradientPaint(Point2D point1, Color color1, Point2D point2, Color color2, boolean cyclic) { if (point1 == null || point2 == null) { // awt.6D=Point is null throw new NullPointerException(Messages.getString("awt.6D")); //$NON-NLS-1$ @@ -93,17 +108,24 @@ public class GradientPaint implements Paint { } /** - * Instantiates a new GradientPaint with cyclic or acyclic mode; - * points are specified by coordinates. + * Instantiates a new GradientPaint with cyclic or acyclic mode; points are + * specified by coordinates. * - * @param x1 the X coordinate of the first point. - * @param y1 the Y coordinate of the first point. - * @param color1 the color of the first point. - * @param x2 the X coordinate of the second point. - * @param y2 the Y coordinate of the second point. - * @param color2 the color of the second point. - * @param cyclic the cyclic mode - true if the gradient pattern should cycle - * repeatedly between the two colors; false otherwise. + * @param x1 + * the X coordinate of the first point. + * @param y1 + * the Y coordinate of the first point. + * @param color1 + * the color of the first point. + * @param x2 + * the X coordinate of the second point. + * @param y2 + * the Y coordinate of the second point. + * @param color2 + * the color of the second point. + * @param cyclic + * the cyclic mode - true if the gradient pattern should cycle + * repeatedly between the two colors; false otherwise. */ public GradientPaint(float x1, float y1, Color color1, float x2, float y2, Color color2, boolean cyclic) { @@ -111,15 +133,21 @@ public class GradientPaint implements Paint { } /** - * Instantiates a new acyclic GradientPaint; - * points are specified by coordinates. + * Instantiates a new acyclic GradientPaint; points are specified by + * coordinates. * - * @param x1 the X coordinate of the first point. - * @param y1 the Y coordinate of the first point. - * @param color1 the color of the first point. - * @param x2 the X coordinate of the second point. - * @param y2 the Y coordinate of the second point. - * @param color2 the color of the second point. + * @param x1 + * the X coordinate of the first point. + * @param y1 + * the Y coordinate of the first point. + * @param color1 + * the color of the first point. + * @param x2 + * the X coordinate of the second point. + * @param y2 + * the Y coordinate of the second point. + * @param color2 + * the color of the second point. */ public GradientPaint(float x1, float y1, Color color1, float x2, float y2, Color color2) { this(x1, y1, color1, x2, y2, color2, false); @@ -128,29 +156,38 @@ public class GradientPaint implements Paint { /** * Instantiates a new acyclic GradientPaint. * - * @param point1 the first specified point. - * @param color1 the Color of the first specified point. - * @param point2 the second specified point. - * @param color2 the Color of the second specified point. + * @param point1 + * the first specified point. + * @param color1 + * the Color of the first specified point. + * @param point2 + * the second specified point. + * @param color2 + * the Color of the second specified point. */ public GradientPaint(Point2D point1, Color color1, Point2D point2, Color color2) { this(point1, color1, point2, color2, false); } /** - * Creates PaintContext for a color pattern generating. - * - * @param cm the ColorModel of the Paint data. - * @param deviceBounds the bounding Rectangle of graphics primitives - * being rendered in the device space. - * @param userBounds tthe bounding Rectangle of graphics primitives - * being rendered in the user space. - * @param t the AffineTransform from user space into device space. - * @param hints the RrenderingHints object. + * Creates PaintContext for a color pattern generating. * + * @param cm + * the ColorModel of the Paint data. + * @param deviceBounds + * the bounding Rectangle of graphics primitives being rendered + * in the device space. + * @param userBounds + * the bounding Rectangle of graphics primitives being rendered + * in the user space. + * @param t + * the AffineTransform from user space into device space. + * @param hints + * the RrenderingHints object. * @return the PaintContext for color pattern generating. - * - * @see java.awt.Paint#createContext(java.awt.image.ColorModel, java.awt.Rectangle, java.awt.geom.Rectangle2D, java.awt.geom.AffineTransform, java.awt.RenderingHints) + * @see java.awt.Paint#createContext(java.awt.image.ColorModel, + * java.awt.Rectangle, java.awt.geom.Rectangle2D, + * java.awt.geom.AffineTransform, java.awt.RenderingHints) */ public PaintContext createContext(ColorModel cm, Rectangle deviceBounds, Rectangle2D userBounds, AffineTransform t, RenderingHints hints) { @@ -178,7 +215,7 @@ public class GradientPaint implements Paint { /** * Gets the first point. * - * @return the Point object - the first point. + * @return the Point object - the first point. */ public Point2D getPoint1() { return point1; @@ -197,7 +234,6 @@ public class GradientPaint implements Paint { * Gets the transparency mode for the GradientPaint. * * @return the transparency mode for the GradientPaint. - * * @see java.awt.Transparency#getTransparency() */ public int getTransparency() { @@ -207,11 +243,11 @@ public class GradientPaint implements Paint { } /** - * Returns the GradientPaint mode: true for cyclic mode, false for - * acyclic mode. + * Returns the GradientPaint mode: true for cyclic mode, false for acyclic + * mode. * - * @return true if the gradient cycles repeatedly between the two colors; - * false otherwise. + * @return true if the gradient cycles repeatedly between the two colors; + * false otherwise. */ public boolean isCyclic() { return cyclic; diff --git a/awt/java/awt/Graphics.java b/awt/java/awt/Graphics.java index c20f6bc9e0ee7..2d6e79fca4607 100644 --- a/awt/java/awt/Graphics.java +++ b/awt/java/awt/Graphics.java @@ -18,26 +18,27 @@ * @author Alexey A. Petrenko * @version $Revision$ */ + package java.awt; import java.awt.image.ImageObserver; import java.text.AttributedCharacterIterator; /** - * The abstract Graphics class allows applications to draw on a screen - * or other rendering target. There are several properties which - * define rendering options: origin point, clipping area, color, font. - *

- * The origin point specifies the beggining of the clipping area coordinate - * system. All coordinates used in rendering operations are computed with - * respect to this point. The clipping area defines the boundaries where - * rendering operations can be performed. Rendering operations can't modify - * pixels outside of the clipping area. - *

- * The draw and fill methods allow applications to drawing shapes, text, - * images with specified font and color options in the specified part - * of the screen. - * + * The abstract Graphics class allows applications to draw on a screen or other + * rendering target. There are several properties which define rendering + * options: origin point, clipping area, color, font.
+ *
+ * The origin point specifies the beginning of the clipping area coordinate + * system. All coordinates used in rendering operations are computed with + * respect to this point. The clipping area defines the boundaries where + * rendering operations can be performed. Rendering operations can't modify + * pixels outside of the clipping area.
+ *
+ * The draw and fill methods allow applications to drawing shapes, text, images + * with specified font and color options in the specified part of the screen. + * + * @since Android 1.0 */ public abstract class Graphics { @@ -45,7 +46,7 @@ public abstract class Graphics { /** * Instantiates a new Graphics. This constructor is default for Graphics and - * can not be called directly. + * can not be called directly. */ protected Graphics() { } @@ -53,19 +54,22 @@ public abstract class Graphics { // Public methods /** - * Creates a copy of the Graphics object with a new origin and a new - * specified clip area. The new clip area is the rectangle defined by - * the origin point with coordinates X,Y and the given width and height. - * The coordinates of all subsequent rendering operations will be computed - * with respect to the new origin and can be performed only within the - * range of the clipping area dimentions. - * - * @param x the X coordinate of the original point - * @param y the Y coordinate of the original point - * @param width the width of clipping area - * @param height the height of clipping area + * Creates a copy of the Graphics object with a new origin and a new + * specified clip area. The new clip area is the rectangle defined by the + * origin point with coordinates X,Y and the given width and height. The + * coordinates of all subsequent rendering operations will be computed with + * respect to the new origin and can be performed only within the range of + * the clipping area dimensions. * - * @return the Graphics object with new origin point and clipping area. + * @param x + * the X coordinate of the original point. + * @param y + * the Y coordinate of the original point. + * @param width + * the width of clipping area. + * @param height + * the height of clipping area. + * @return the Graphics object with new origin point and clipping area. */ public Graphics create(int x, int y, int width, int height) { Graphics res = create(); @@ -75,18 +79,24 @@ public abstract class Graphics { } /** - * Draws the higlighted outline of a rectangle. + * Draws the highlighted outline of a rectangle. * - * @param x the X coordinate of the rectangle's top left corner. - * @param y the Y coordinate of the rectangle's top left corner. - * @param width the width of rectangle. - * @param height the height of rectangle. - * @param raised a boolean value that determines whether the rectangle - * is drawn as raised or indented. + * @param x + * the X coordinate of the rectangle's top left corner. + * @param y + * the Y coordinate of the rectangle's top left corner. + * @param width + * the width of rectangle. + * @param height + * the height of rectangle. + * @param raised + * a boolean value that determines whether the rectangle is drawn + * as raised or indented. */ public void draw3DRect(int x, int y, int width, int height, boolean raised) { // Note: lighter/darker colors should be used to draw 3d rect. - // The resulting rect is (width+1)x(height+1). Stroke and paint attributes of + // The resulting rect is (width+1)x(height+1). Stroke and paint + // attributes of // the Graphics2D should be reset to the default values. // fillRect is used instead of drawLine to bypass stroke // reset/set and rasterization. @@ -103,36 +113,46 @@ public abstract class Graphics { setColor(colorUp); fillRect(x, y, width, 1); - fillRect(x, y+1, 1, height); + fillRect(x, y + 1, 1, height); setColor(colorDown); - fillRect(x+width, y, 1, height); - fillRect(x+1, y+height, width, 1); + fillRect(x + width, y, 1, height); + fillRect(x + 1, y + height, width, 1); } /** - * Draws the text represented by byte array. This method uses the current + * Draws the text represented by byte array. This method uses the current * font and color for rendering. * - * @param bytes the byte array which contains the text to be drawn. - * @param off the offset within the byte array of the text to be drawn. - * @param len the number of bytes of text to draw. - * @param x the X coordinate where the text is to be drawn. - * @param y the Y coordinate where the text is to be drawn. + * @param bytes + * the byte array which contains the text to be drawn. + * @param off + * the offset within the byte array of the text to be drawn. + * @param len + * the number of bytes of text to draw. + * @param x + * the X coordinate where the text is to be drawn. + * @param y + * the Y coordinate where the text is to be drawn. */ public void drawBytes(byte[] bytes, int off, int len, int x, int y) { drawString(new String(bytes, off, len), x, y); } /** - * Draws the text represented by character array. This method uses the + * Draws the text represented by character array. This method uses the * current font and color for rendering. * - * @param chars the character array. - * @param off the offset within the character array of the text to be drawn. - * @param len the number of characters which will be drawn. - * @param x the X coordinate where the text is to be drawn. - * @param y the Y coordinate where the text is to be drawn. + * @param chars + * the character array. + * @param off + * the offset within the character array of the text to be drawn. + * @param len + * the number of characters which will be drawn. + * @param x + * the X coordinate where the text is to be drawn. + * @param y + * the Y coordinate where the text is to be drawn. */ public void drawChars(char[] chars, int off, int len, int x, int y) { drawString(new String(chars, off, len), x, y); @@ -141,37 +161,51 @@ public abstract class Graphics { /** * Draws the outline of a polygon which is defined by Polygon object. * - * @param p the Polygon object. + * @param p + * the Polygon object. */ public void drawPolygon(Polygon p) { drawPolygon(p.xpoints, p.ypoints, p.npoints); } /** - * Draws the rectangle with the specified width and length and top left + * Draws the rectangle with the specified width and length and top left * corner coordinates. * - * @param x the X coordinate of the rectangle's top left corner. - * @param y the Y coordinate of the rectangle's top left corner. - * @param width the width of the rectangle. - * @param height the height of the rectangle. + * @param x + * the X coordinate of the rectangle's top left corner. + * @param y + * the Y coordinate of the rectangle's top left corner. + * @param width + * the width of the rectangle. + * @param height + * the height of the rectangle. */ public void drawRect(int x, int y, int width, int height) { - int []xpoints = {x, x, x+width, x+width}; - int []ypoints = {y, y+height, y+height, y}; + int[] xpoints = { + x, x, x + width, x + width + }; + int[] ypoints = { + y, y + height, y + height, y + }; drawPolygon(xpoints, ypoints, 4); } /** - * Fills the higlighted outline of a rectangle. + * Fills the highlighted outline of a rectangle. * - * @param x the X coordinate of the rectangle's top left corner. - * @param y the Y coordinate of the rectangle's top left corner. - * @param width the width of the rectangle. - * @param height the height of the rectangle. - * @param raised a boolean value that determines whether the rectangle - * is drawn as raised or indented. + * @param x + * the X coordinate of the rectangle's top left corner. + * @param y + * the Y coordinate of the rectangle's top left corner. + * @param width + * the width of the rectangle. + * @param height + * the height of the rectangle. + * @param raised + * a boolean value that determines whether the rectangle is drawn + * as raised or indented. */ public void fill3DRect(int x, int y, int width, int height, boolean raised) { // Note: lighter/darker colors should be used to draw 3d rect. @@ -179,7 +213,7 @@ public abstract class Graphics { // Stroke and paint attributes of the Graphics2D should be reset // to the default values. fillRect is used instead of drawLine to // bypass stroke reset/set and line rasterization. - + Color color = getColor(); Color colorUp, colorDown; if (raised) { @@ -194,21 +228,22 @@ public abstract class Graphics { width--; height--; - fillRect(x+1, y+1, width-1, height-1); + fillRect(x + 1, y + 1, width - 1, height - 1); setColor(colorUp); fillRect(x, y, width, 1); - fillRect(x, y+1, 1, height); + fillRect(x, y + 1, 1, height); setColor(colorDown); - fillRect(x+width, y, 1, height); - fillRect(x+1, y+height, width, 1); + fillRect(x + width, y, 1, height); + fillRect(x + 1, y + height, width, 1); } /** * Fills the polygon with the current color. * - * @param p the Polygon object. + * @param p + * the Polygon object. */ public void fillPolygon(Polygon p) { fillPolygon(p.xpoints, p.ypoints, p.npoints); @@ -222,12 +257,12 @@ public abstract class Graphics { } /** - * Gets the bounds of the current clipping area as a rectangle - * and copies it to an existing rectangle. - * - * @param r a Rectangle object where the current clipping area - * bounds are to be copied. + * Gets the bounds of the current clipping area as a rectangle and copies it + * to an existing rectangle. * + * @param r + * a Rectangle object where the current clipping area bounds are + * to be copied. * @return the bounds of the current clipping area. */ public Rectangle getClipBounds(Rectangle r) { @@ -248,8 +283,7 @@ public abstract class Graphics { /** * Gets the bounds of the current clipping area as a rectangle. * - * @return a Rectangle object - * + * @return a Rectangle object. * @deprecated Use {@link #getClipBounds()} */ @Deprecated @@ -258,9 +292,8 @@ public abstract class Graphics { } /** - * Gets the font metrics of the current font. - * The font metrics object contains information about the rendering - * of a particular font. + * Gets the font metrics of the current font. The font metrics object + * contains information about the rendering of a particular font. * * @return the font metrics of current font. */ @@ -269,19 +302,23 @@ public abstract class Graphics { } /** - * Determines whether or not the specified rectangle intersects the - * current clipping area. - * - * @param x the X coordinate of the rectangle. - * @param y the Y coordinate of the rectangle. - * @param width the width of the rectangle. - * @param height the height of the rectangle. + * Determines whether or not the specified rectangle intersects the current + * clipping area. * - * @return true, if the specified rectangle intersects the current clipping area, - * overwise false. + * @param x + * the X coordinate of the rectangle. + * @param y + * the Y coordinate of the rectangle. + * @param width + * the width of the rectangle. + * @param height + * the height of the rectangle. + * @return true, if the specified rectangle intersects the current clipping + * area, false otherwise. */ public boolean hitClip(int x, int y, int width, int height) { - // TODO: Create package private method Rectangle.intersects(int, int, int, int); + // TODO: Create package private method Rectangle.intersects(int, int, + // int, int); return getClipBounds().intersects(new Rectangle(x, y, width, height)); } @@ -299,45 +336,56 @@ public abstract class Graphics { // Abstract methods /** - * Clears the specified rectangle. This method fills specified rectangle - * with background color. + * Clears the specified rectangle. This method fills specified rectangle + * with background color. * - * @param x the X coordinate of the rectangle. - * @param y the Y coordinate of the rectangle. - * @param width the width of the rectangle. - * @param height the height of the rectangle. + * @param x + * the X coordinate of the rectangle. + * @param y + * the Y coordinate of the rectangle. + * @param width + * the width of the rectangle. + * @param height + * the height of the rectangle. */ public abstract void clearRect(int x, int y, int width, int height); /** - * Intersects the current clipping area with a new rectangle. - * If the current clipping area is not defined, the rectangle - * becomes a new clipping area. Rendering operations are only allowed - * within the new the clipping area. - * - * @param x the X coordinate of the rectangle for intersection. - * @param y the Y coordinate of the rectangle for intersection. - * @param width the width of the rectangle for intersection. - * @param height the height of the rectangle for intersection. + * Intersects the current clipping area with a new rectangle. If the current + * clipping area is not defined, the rectangle becomes a new clipping area. + * Rendering operations are only allowed within the new the clipping area. + * + * @param x + * the X coordinate of the rectangle for intersection. + * @param y + * the Y coordinate of the rectangle for intersection. + * @param width + * the width of the rectangle for intersection. + * @param height + * the height of the rectangle for intersection. */ public abstract void clipRect(int x, int y, int width, int height); /** - * Copies the rectangle area to another area specified by - * a distance (dx, dy) from the original rectangle's location. - * Positive dx and dy values give a new location defined by - * translation to the right and down from the original location, - * negative dx and dy values - to the left and up. - *

- * - * @param sx the X coordinate of the rectangle which will be copied. - * @param sy the Y coordinate of the rectangle which will be copied. - * @param width the width of the rectangle which will be copied. - * @param height the height of the rectangle which will be copied. - * @param dx the horizontal distance from the source rectangle's - * location to the copy's location. - * @param dy the vertical distance from the source rectangle's - * location to the copy's location. + * Copies the rectangle area to another area specified by a distance (dx, + * dy) from the original rectangle's location. Positive dx and dy values + * give a new location defined by translation to the right and down from the + * original location, negative dx and dy values - to the left and up. + * + * @param sx + * the X coordinate of the rectangle which will be copied. + * @param sy + * the Y coordinate of the rectangle which will be copied. + * @param width + * the width of the rectangle which will be copied. + * @param height + * the height of the rectangle which will be copied. + * @param dx + * the horizontal distance from the source rectangle's location + * to the copy's location. + * @param dy + * the vertical distance from the source rectangle's location to + * the copy's location. */ public abstract void copyArea(int sx, int sy, int width, int height, int dx, int dy); @@ -349,215 +397,314 @@ public abstract class Graphics { public abstract Graphics create(); /** - * Disposes of the Graphics. This Graphics object can not be used after - * calling this method. + * Disposes of the Graphics. This Graphics object can not be used after + * calling this method. */ public abstract void dispose(); /** - * Draws the arc covering the specified rectangle and using the current color. - * The rectangle is defined by the origin point (X, Y) and dimentions - * (width and height). The arc center is the the center of specified rectangle. - * The angle origin is 3 o'clock position, the positive angle is counted as a - * counter-clockwise rotation, the negotive angle is counted as clockwise rotation. - * - * @param x the X origin coordinate of the rectangle which scales the arc. - * @param y the Y origin coordinate of the rectangle which scales the arc. - * @param width the width of the rectangle which scales the arc. - * @param height the height of the rectangle which scales the arc. - * @param sa start angle - the origin angle of arc. - * @param ea arc angle - the angular arc value relative to the start angle. + * Draws the arc covering the specified rectangle and using the current + * color. The rectangle is defined by the origin point (X, Y) and dimensions + * (width and height). The arc center is the the center of specified + * rectangle. The angle origin is 3 o'clock position, the positive angle is + * counted as a counter-clockwise rotation, the negative angle is counted as + * clockwise rotation. + * + * @param x + * the X origin coordinate of the rectangle which scales the arc. + * @param y + * the Y origin coordinate of the rectangle which scales the arc. + * @param width + * the width of the rectangle which scales the arc. + * @param height + * the height of the rectangle which scales the arc. + * @param sa + * start angle - the origin angle of arc. + * @param ea + * arc angle - the angular arc value relative to the start angle. */ public abstract void drawArc(int x, int y, int width, int height, int sa, int ea); /** - * Draws the specified image with the defined background color. - * The top left corner of image will be drawn at point (x, y) - * in current coordinate system. The image loading process notifies the - * specified Image Observer. This method returns true if the image - * has loaded, overwise it returns false. - * - * @param img the image which will be drawn. - * @param x the X coordinate of the image top left corner. - * @param y the Y coordinate of the image top left corner. - * @param bgcolor the background color. - * @param observer the ImageObserver object which should be notified about image loading process. - * - * @return true, if loading image is successful or image is null, overwise false. + * Draws the specified image with the defined background color. The top left + * corner of image will be drawn at point (x, y) in current coordinate + * system. The image loading process notifies the specified Image Observer. + * This method returns true if the image has loaded, otherwise it returns + * false. + * + * @param img + * the image which will be drawn. + * @param x + * the X coordinate of the image top left corner. + * @param y + * the Y coordinate of the image top left corner. + * @param bgcolor + * the background color. + * @param observer + * the ImageObserver object which should be notified about image + * loading process. + * @return true, if loading image is successful or image is null, false + * otherwise. */ public abstract boolean drawImage(Image img, int x, int y, Color bgcolor, ImageObserver observer); /** - * Draws the specified image. - * The top left corner of image will be drawn at point (x, y) - * in current coordinate system. The image loading process notifies the - * specified Image Observer. This method returns true if the image - * has loaded, overwise it returns false. + * Draws the specified image. The top left corner of image will be drawn at + * point (x, y) in current coordinate system. The image loading process + * notifies the specified Image Observer. This method returns true if the + * image has loaded, otherwise it returns false. * - * @param img the image which will be drawn. - * @param x the X coordinate of the image top left corner. - * @param y the Y coordinate of the image top left corner. - * @param observer the ImageObserver object which should be notified about image loading process. - * - * @return true, if loading image is successful or image is null, overwise false. + * @param img + * the image which will be drawn. + * @param x + * the X coordinate of the image top left corner. + * @param y + * the Y coordinate of the image top left corner. + * @param observer + * the ImageObserver object which should be notified about image + * loading process. + * @return true, if loading image is successful or image is null, otherwise + * false. */ public abstract boolean drawImage(Image img, int x, int y, ImageObserver observer); /** - * Scales the specified image to fit in the specified rectangle and - * draws it with the defined background color. The top left corner - * of the image will be drawn at the point (x, y) in current coordinate - * system. The non-opaque pixels will be drawn in the background color. - * The image loading process notifies the specified Image Observer. - * This method returns true if the image has loaded, overwise it returns false. - * - * @param img the image which will be drawn. - * @param x the X coordinate of the image's top left corner. - * @param y the Y coordinate of the image's top left corner. - * @param width the width of rectangle which scales the image. - * @param height the height of rectangle which scales the image. - * @param bgcolor the background color. - * @param observer the ImageObserver object which should be notified about image loading process. - * - * @return true, if loading image is successful or image is null, overwise false. - */ - public abstract boolean drawImage(Image img, int x, int y, int width, int height, Color bgcolor, ImageObserver observer); - - /** - * Scales the specified image to fit in the specified rectangle and - * draws it. The top left corner of the image will be drawn at the - * point (x, y) in current coordinate system. The image loading process - * notifies the specified Image Observer. - * This method returns true if the image has loaded, overwise it returns false. - * - * @param img the image which will be drawn. - * @param x the X coordinate of the image top left corner. - * @param y the Y coordinate of the image top left corner. - * @param width the width of rectangle which scales the image. - * @param height the height of rectangle which scales the image. - * @param observer the ImageObserver object which should be notified about image loading process. - * - * @return true, if loading image is successful or image is null, overwise false. - */ - public abstract boolean drawImage(Image img, int x, int y, int width, int height, ImageObserver observer); - - /** - * Scales the specified area of the specified image to fit in the rectangle area - * defined by its corners coordinates and draws the sub-image with the specified - * background color. The sub-image to be drawn is defined by its top left - * corner coordinates (sx1, sy1) and bottom right corner coordinates (sx2, sy2) - * computed with respect to the origin (top left corner) of the source image. - * The non opaque pixels will be drawn in the background color. The - * image loading process notifies specified Image Observer. - * This method returns true if the image - * has loaded, overwise it returns false. - * - * @param img the image which will be drawn. - * @param dx1 the X top left corner coordinate of the destination rectangle area. - * @param dy1 the Y top left corner coordinate of the destination rectangle area. - * @param dx2 the X bottom right corner coordinate of the destination rectangle area. - * @param dy2 the Y bottom right corner coordinate of the destination rectangle area. - * @param sx1 the X top left corner coordinate of the area to be drawn within the source image. - * @param sy1 the Y top left corner coordinate of the area to be drawn within the source image. - * @param sx2 the X bottom right corner coordinate of the area to be drawn within the source image. - * @param sy2 the Y bottom right corner coordinate of the area to be drawn within the source image. - * @param bgcolor the background color. - * @param observer the ImageObserver object which should be notified about image loading process. - * - * @return true, if loading image is successful or image is null, overwise false. - */ - public abstract boolean drawImage(Image img, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2, Color bgcolor, ImageObserver observer); - - /** - * Scales the specified area of the specified image to fit in the rectangle area - * defined by its corners coordinates and draws the sub-image. The sub-image - * to be drawn is defined by its top left - * corner coordinates (sx1, sy1) and bottom right corner coordinates (sx2, sy2) - * computed with respect to the origin (top left corner) of the source image. - * The image loading process notifies specified Image Observer. - * This method returns true if the image - * has loaded, overwise it returns false. - * - * @param img the image which will be drawn. - * @param dx1 the X top left corner coordinate of the destination rectangle area. - * @param dy1 the Y top left corner coordinate of the destination rectangle area. - * @param dx2 the X bottom right corner coordinate of the destination rectangle area. - * @param dy2 the Y bottom right corner coordinate of the destination rectangle area. - * @param sx1 the X top left corner coordinate of the area to be drawn within the source image. - * @param sy1 the Y top left corner coordinate of the area to be drawn within the source image. - * @param sx2 the X bottom right corner coordinate of the area to be drawn within the source image. - * @param sy2 the Y bottom right corner coordinate of the area to be drawn within the source image. - * @param observer the ImageObserver object which should be notified about image loading process. - * - * @return true, if loading image is successful or image is null, overwise false. - */ - public abstract boolean drawImage(Image img, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2, ImageObserver observer); - - /** - * Draws a line from the point (x1, y1) to the point (x2, y2). - * This method draws the line with current color - * which can be changed by setColor(Color c) method. - * - * @param x1 the X coordinate of the first point. - * @param y1 the Y coordinate of the first point. - * @param x2 the X coordinate of the second point. - * @param y2 the Y coordinate of the second point. + * Scales the specified image to fit in the specified rectangle and draws it + * with the defined background color. The top left corner of the image will + * be drawn at the point (x, y) in current coordinate system. The non-opaque + * pixels will be drawn in the background color. The image loading process + * notifies the specified Image Observer. This method returns true if the + * image has loaded, otherwise it returns false. + * + * @param img + * the image which will be drawn. + * @param x + * the X coordinate of the image's top left corner. + * @param y + * the Y coordinate of the image's top left corner. + * @param width + * the width of rectangle which scales the image. + * @param height + * the height of rectangle which scales the image. + * @param bgcolor + * the background color. + * @param observer + * the ImageObserver object which should be notified about image + * loading process. + * @return true, if loading image is successful or image is null, otherwise + * false. + */ + public abstract boolean drawImage(Image img, int x, int y, int width, int height, + Color bgcolor, ImageObserver observer); + + /** + * Scales the specified image to fit in the specified rectangle and draws + * it. The top left corner of the image will be drawn at the point (x, y) in + * current coordinate system. The image loading process notifies the + * specified Image Observer. This method returns true if the image has + * loaded, otherwise it returns false. + * + * @param img + * the image which will be drawn. + * @param x + * the X coordinate of the image top left corner. + * @param y + * the Y coordinate of the image top left corner. + * @param width + * the width of rectangle which scales the image. + * @param height + * the height of rectangle which scales the image. + * @param observer + * the ImageObserver object which should be notified about image + * loading process. + * @return true, if loading image is successful or image is null, otherwise + * false. + */ + public abstract boolean drawImage(Image img, int x, int y, int width, int height, + ImageObserver observer); + + /** + * Scales the specified area of the specified image to fit in the rectangle + * area defined by its corners coordinates and draws the sub-image with the + * specified background color. The sub-image to be drawn is defined by its + * top left corner coordinates (sx1, sy1) and bottom right corner + * coordinates (sx2, sy2) computed with respect to the origin (top left + * corner) of the source image. The non opaque pixels will be drawn in the + * background color. The image loading process notifies specified Image + * Observer. This method returns true if the image has loaded, otherwise it + * returns false. + * + * @param img + * the image which will be drawn. + * @param dx1 + * the X top left corner coordinate of the destination rectangle + * area. + * @param dy1 + * the Y top left corner coordinate of the destination rectangle + * area. + * @param dx2 + * the X bottom right corner coordinate of the destination + * rectangle area. + * @param dy2 + * the Y bottom right corner coordinate of the destination + * rectangle area. + * @param sx1 + * the X top left corner coordinate of the area to be drawn + * within the source image. + * @param sy1 + * the Y top left corner coordinate of the area to be drawn + * within the source image. + * @param sx2 + * the X bottom right corner coordinate of the area to be drawn + * within the source image. + * @param sy2 + * the Y bottom right corner coordinate of the area to be drawn + * within the source image. + * @param bgcolor + * the background color. + * @param observer + * the ImageObserver object which should be notified about image + * loading process. + * @return true, if loading image is successful or image is null, false + * otherwise. + */ + public abstract boolean drawImage(Image img, int dx1, int dy1, int dx2, int dy2, int sx1, + int sy1, int sx2, int sy2, Color bgcolor, ImageObserver observer); + + /** + * Scales the specified area of the specified image to fit in the rectangle + * area defined by its corners coordinates and draws the sub-image. The + * sub-image to be drawn is defined by its top left corner coordinates (sx1, + * sy1) and bottom right corner coordinates (sx2, sy2) computed with respect + * to the origin (top left corner) of the source image. The image loading + * process notifies specified Image Observer. This method returns true if + * the image has loaded, otherwise it returns false. + * + * @param img + * the image which will be drawn. + * @param dx1 + * the X top left corner coordinate of the destination rectangle + * area. + * @param dy1 + * the Y top left corner coordinate of the destination rectangle + * area. + * @param dx2 + * the X bottom right corner coordinate of the destination + * rectangle area. + * @param dy2 + * the Y bottom right corner coordinate of the destination + * rectangle area. + * @param sx1 + * the X top left corner coordinate of the area to be drawn + * within the source image. + * @param sy1 + * the Y top left corner coordinate of the area to be drawn + * within the source image. + * @param sx2 + * the X bottom right corner coordinate of the area to be drawn + * within the source image. + * @param sy2 + * the Y bottom right corner coordinate of the area to be drawn + * within the source image. + * @param observer + * the ImageObserver object which should be notified about image + * loading process. + * @return true, if loading image is successful or image is null, false + * otherwise. + */ + public abstract boolean drawImage(Image img, int dx1, int dy1, int dx2, int dy2, int sx1, + int sy1, int sx2, int sy2, ImageObserver observer); + + /** + * Draws a line from the point (x1, y1) to the point (x2, y2). This method + * draws the line with current color which can be changed by setColor(Color + * c) method. + * + * @param x1 + * the X coordinate of the first point. + * @param y1 + * the Y coordinate of the first point. + * @param x2 + * the X coordinate of the second point. + * @param y2 + * the Y coordinate of the second point. */ public abstract void drawLine(int x1, int y1, int x2, int y2); /** - * Draws the ouline of an oval to fit in the rectangle defined - * by the given width, height, and top left corner. + * Draws the outline of an oval to fit in the rectangle defined by the given + * width, height, and top left corner. * - * @param x the X top left corner oval coordinate - * @param y the Y top left corner oval coordinate - * @param width the oval width - * @param height the oval height + * @param x + * the X top left corner oval coordinate. + * @param y + * the Y top left corner oval coordinate. + * @param width + * the oval width. + * @param height + * the oval height. */ public abstract void drawOval(int x, int y, int width, int height); /** - * Draws the outline of a polygon. The polygon vertices are defined by points - * with xpoints[i], ypoints[i] as coordinates. The polygon edges are the - * lines from the points with (xpoints[i-1], ypoints[i-1]) coordinates to - * the points with (xpoints[i], ypoints[i]) coordinates, for 0 < i < npoints +1. + * Draws the outline of a polygon. The polygon vertices are defined by + * points with xpoints[i], ypoints[i] as coordinates. The polygon edges are + * the lines from the points with (xpoints[i-1], ypoints[i-1]) coordinates + * to the points with (xpoints[i], ypoints[i]) coordinates, for 0 < i < + * npoints +1. * - * @param xpoints the array of X coordinates of the polygon vertices. - * @param ypoints the array of Y coordinates of the polygon vertices. - * @param npoints the number of polygon vertices/points. + * @param xpoints + * the array of X coordinates of the polygon vertices. + * @param ypoints + * the array of Y coordinates of the polygon vertices. + * @param npoints + * the number of polygon vertices/points. */ public abstract void drawPolygon(int[] xpoints, int[] ypoints, int npoints); /** - * Draws a set of connected lines which are defined by the x and y coordinate arrays. - * The polyline is closed if coordinates of the first point are the same as - * coordinates of the last point. + * Draws a set of connected lines which are defined by the x and y + * coordinate arrays. The polyline is closed if coordinates of the first + * point are the same as coordinates of the last point. * - * @param xpoints the array of X point coordinates. - * @param ypoints the array of Y point coordinates. - * @param npoints the number of points. + * @param xpoints + * the array of X point coordinates. + * @param ypoints + * the array of Y point coordinates. + * @param npoints + * the number of points. */ public abstract void drawPolyline(int[] xpoints, int[] ypoints, int npoints); /** * Draws the outline of a rectangle with round corners. * - * @param x the X coordinate of the rectangle's top left corner. - * @param y the Y coordinate of the rectangle's top left corner. - * @param width the width of the rectangle. - * @param height the height of the rectangle. - * @param arcWidth the arc width for the corners. - * @param arcHeight the arc height for the corners. - */ - public abstract void drawRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight); - - /** - * Draws a text defined by an iterator. The iterator should specify the font - * for every character. - * - * @param iterator the iterator. - * @param x the X coordinate of the firt character. - * @param y the Y coordinate of the first character. + * @param x + * the X coordinate of the rectangle's top left corner. + * @param y + * the Y coordinate of the rectangle's top left corner. + * @param width + * the width of the rectangle. + * @param height + * the height of the rectangle. + * @param arcWidth + * the arc width for the corners. + * @param arcHeight + * the arc height for the corners. + */ + public abstract void drawRoundRect(int x, int y, int width, int height, int arcWidth, + int arcHeight); + + /** + * Draws a text defined by an iterator. The iterator should specify the font + * for every character. + * + * @param iterator + * the iterator. + * @param x + * the X coordinate of the first character. + * @param y + * the Y coordinate of the first character. */ public abstract void drawString(AttributedCharacterIterator iterator, int x, int y); @@ -565,86 +712,117 @@ public abstract class Graphics { * Draws a text defined by a string. This method draws the text with current * font and color. * - * @param str the string. - * @param x the X coordinate of the firt character. - * @param y the Y coordinate of the first character. + * @param str + * the string. + * @param x + * the X coordinate of the first character. + * @param y + * the Y coordinate of the first character. */ public abstract void drawString(String str, int x, int y); /** - * Fills the arc covering the rectangle and using the current color. - * The rectangle is defined by the origin point (X, Y) and dimentions (width and height). - * The arc center is the the center of specified rectangle. - * The angle origin is at the 3 o'clock position, and a positive angle gives + * Fills the arc covering the rectangle and using the current color. The + * rectangle is defined by the origin point (X, Y) and dimensions (width and + * height). The arc center is the the center of specified rectangle. The + * angle origin is at the 3 o'clock position, and a positive angle gives * counter-clockwise rotation, a negative angle gives clockwise rotation. - * - * @param x the X origin coordinate of the rectangle which scales the arc. - * @param y the Y origin coordinate of the rectangle which scales the arc. - * @param width the width of the rectangle which scales the arc. - * @param height the height of the rectangle which scales the arc. - * @param sa start angle - the origin angle of arc. - * @param ea arc angle - the angular arc value relative to the start angle. + * + * @param x + * the X origin coordinate of the rectangle which scales the arc. + * @param y + * the Y origin coordinate of the rectangle which scales the arc. + * @param width + * the width of the rectangle which scales the arc. + * @param height + * the height of the rectangle which scales the arc. + * @param sa + * start angle - the origin angle of arc. + * @param ea + * arc angle - the angular arc value relative to the start angle. */ public abstract void fillArc(int x, int y, int width, int height, int sa, int ea); /** - * Fills an oval with the current color where the oval is defined by the + * Fills an oval with the current color where the oval is defined by the * bounding rectangle with the given width, height, and top left corner. * - * @param x the X top left corner oval coordinate. - * @param y the Y top left corner oval coordinate. - * @param width the oval width. - * @param height the oval height. + * @param x + * the X top left corner oval coordinate. + * @param y + * the Y top left corner oval coordinate. + * @param width + * the oval width. + * @param height + * the oval height. */ public abstract void fillOval(int x, int y, int width, int height); /** - * Fills a polygon with the current color. The polygon vertices are defined by the points - * with xpoints[i], ypoints[i] as coordinates. The polygon edges are the - * lines from the points with (xpoints[i-1], ypoints[i-1]) coordinates to - * the points with (xpoints[i], ypoints[i]) coordinates, for 0 < i < npoints +1. + * Fills a polygon with the current color. The polygon vertices are defined + * by the points with xpoints[i], ypoints[i] as coordinates. The polygon + * edges are the lines from the points with (xpoints[i-1], ypoints[i-1]) + * coordinates to the points with (xpoints[i], ypoints[i]) coordinates, for + * 0 < i < npoints +1. * - * @param xpoints the array of X coordinates of the polygon vertices. - * @param ypoints the array of Y coordinates of the polygon vertices. - * @param npoints the number of polygon vertices/points. + * @param xpoints + * the array of X coordinates of the polygon vertices. + * @param ypoints + * the array of Y coordinates of the polygon vertices. + * @param npoints + * the number of polygon vertices/points. */ public abstract void fillPolygon(int[] xpoints, int[] ypoints, int npoints); /** - * Fills a rectangle with the current color. - * The rectangle is defined by its width and length and top left corner coordinates. + * Fills a rectangle with the current color. The rectangle is defined by its + * width and length and top left corner coordinates. * - * @param x the X coordinate of the rectangle's top left corner. - * @param y the Y coordinate of the rectangle's top left corner. - * @param width the width of rectangle. - * @param height the height of rectangle. + * @param x + * the X coordinate of the rectangle's top left corner. + * @param y + * the Y coordinate of the rectangle's top left corner. + * @param width + * the width of rectangle. + * @param height + * the height of rectangle. */ public abstract void fillRect(int x, int y, int width, int height); /** * Fills a round cornered rectangle with the current color. * - * @param x the X coordinate of the top left corner of the bounding rectangle. - * @param y the Y coordinate of the top left corner of the bounding rectangle. - * @param width the width of the bounding rectangle. - * @param height the height of the bounding rectangle. - * @param arcWidth the arc width at the corners. - * @param arcHeight the arc height at the corners. + * @param x + * the X coordinate of the top left corner of the bounding + * rectangle. + * @param y + * the Y coordinate of the top left corner of the bounding + * rectangle. + * @param width + * the width of the bounding rectangle. + * @param height + * the height of the bounding rectangle. + * @param arcWidth + * the arc width at the corners. + * @param arcHeight + * the arc height at the corners. */ - public abstract void fillRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight); + public abstract void fillRoundRect(int x, int y, int width, int height, int arcWidth, + int arcHeight); /** - * Gets the clipping area. - *

- * + * Gets the clipping area.
+ *
+ * * @return a Shape object of the clipping area or null if it is not set. */ public abstract Shape getClip(); /** * Gets the bounds of the current clipping area as a rectangle. - * - * @return a Rectangle object which represents the bounds of the current clipping area. + * + * @return a Rectangle object which represents the bounds of the current + * clipping area. */ public abstract Rectangle getClipBounds(); @@ -663,75 +841,84 @@ public abstract class Graphics { public abstract Font getFont(); /** - * Gets the font metrics of the specified font. - * The font metrics object contains information about the rendering of a particular font. - * - * @param font the specified font + * Gets the font metrics of the specified font. The font metrics object + * contains information about the rendering of a particular font. * + * @param font + * the specified font. * @return the font metrics for the specified font. */ public abstract FontMetrics getFontMetrics(Font font); /** - * Sets the new clipping area specified by rectangle. The new clipping area - * doesn't depend on the window's visibility. Rendering operations can't be performed - * outside new clipping area. + * Sets the new clipping area specified by rectangle. The new clipping area + * doesn't depend on the window's visibility. Rendering operations can't be + * performed outside new clipping area. * - * @param x the X coordinate of the new clipping rectangle. - * @param y the Y coordinate of the new clipping rectangle. - * @param width the width of the new clipping rectangle. - * @param height the height of the new clipping rectangle. + * @param x + * the X coordinate of the new clipping rectangle. + * @param y + * the Y coordinate of the new clipping rectangle. + * @param width + * the width of the new clipping rectangle. + * @param height + * the height of the new clipping rectangle. */ public abstract void setClip(int x, int y, int width, int height); /** - * Sets the new clipping area to be the area specified by Shape object. - * The new clipping area doesn't depend on the window's visibility. - * Rendering operations can't be performed outside new clipping area. + * Sets the new clipping area to be the area specified by Shape object. The + * new clipping area doesn't depend on the window's visibility. Rendering + * operations can't be performed outside new clipping area. * - * @param clip a Shape object which representes new clipping area. + * @param clip + * the Shape object which represents new clipping area. */ public abstract void setClip(Shape clip); /** - * Sets the current Graphics color. All rendering operations with this Graphics - * will use this color. + * Sets the current Graphics color. All rendering operations with this + * Graphics will use this color. * - * @param c the new color. + * @param c + * the new color. */ public abstract void setColor(Color c); /** - * Sets the current Graphics font. All rendering operations with this Graphics - * will use this font. + * Sets the current Graphics font. All rendering operations with this + * Graphics will use this font. * - * @param font the new font. + * @param font + * the new font. */ public abstract void setFont(Font font); /** - * Sets the paint mode for the Graphics which overwrites all rendering + * Sets the paint mode for the Graphics which overwrites all rendering * operations with the current color. - * */ public abstract void setPaintMode(); /** - * Sets the XOR mode for the Graphics which changes a pixel from - * the current color to the specified XOR color. - *

+ * Sets the XOR mode for the Graphics which changes a pixel from the current + * color to the specified XOR color.
+ *
* - * @param color the new XOR mode + * @param color + * the new XOR mode. */ public abstract void setXORMode(Color color); /** - * Translates the origin of Graphics current coordinate system - * to the point with X, Y coordinates in the current coordinate system. - * All rendering operation in this Graphics will be related to the new origin. + * Translates the origin of Graphics current coordinate system to the point + * with X, Y coordinates in the current coordinate system. All rendering + * operation in this Graphics will be related to the new origin. * - * @param x the X coordinate of the origin - * @param y the Y coordinate of the origin + * @param x + * the X coordinate of the origin. + * @param y + * the Y coordinate of the origin. */ public abstract void translate(int x, int y); } diff --git a/awt/java/awt/Graphics2D.java b/awt/java/awt/Graphics2D.java index 2ff5e0c9b90fe..04a7319de851d 100644 --- a/awt/java/awt/Graphics2D.java +++ b/awt/java/awt/Graphics2D.java @@ -30,19 +30,22 @@ import java.util.Map; /** * The Graphics2D class extends Graphics class and provides more capabilities - * for rendering text, images, shapes. This provides methods to peform - * transformation of coordinate system, color management, and text layout. - * The following attributes exist for rendering: + * for rendering text, images, shapes. This provides methods to perform + * transformation of coordinate system, color management, and text layout. The + * following attributes exist for rendering: *

    *
  • Color - current Graphics2D color;
  • *
  • Font - current Graphics2D font;
  • - *
  • Stroke - pen with a width of 1 pixel;
  • + *
  • Stroke - pen with a width of 1 pixel;
  • *
  • Transform - current Graphics2D Transformation;
  • - *
  • Composite - alpha compositing rules for combining source and destination colors.
  • - *
+ *
  • Composite - alpha compositing rules for combining source and destination + * colors.
  • + * + * + * @since Android 1.0 */ public abstract class Graphics2D extends Graphics { - + /** * Instantiates a new Graphics2D object. This constructor should never be * called directly. @@ -52,41 +55,46 @@ public abstract class Graphics2D extends Graphics { } /** - * Adds preferences for the rendering algorithms. The preferences - * are arbitrary and specified by Map objects. All specified by Map object - * preferencies can be modified. + * Adds preferences for the rendering algorithms. The preferences are + * arbitrary and specified by Map objects. All specified by Map object + * preferences can be modified. * - * @param hints the rendering hints. + * @param hints + * the rendering hints. */ public abstract void addRenderingHints(Map hints); /** - * Intersects the current clipping area with the specified Shape - * and the result becomes a new clipping area. - * If current clipping area is not defined, the Shape - * becomes the new clipping area. No rendering operations - * are allowed outside the clipping area. + * Intersects the current clipping area with the specified Shape and the + * result becomes a new clipping area. If current clipping area is not + * defined, the Shape becomes the new clipping area. No rendering operations + * are allowed outside the clipping area. * - * @param s the specified Shape object which will be intersected - * with current clipping area. + * @param s + * the specified Shape object which will be intersected with + * current clipping area. */ public abstract void clip(Shape s); /** * Draws the outline of the specified Shape. * - * @param s the Shape which ouline is drawn. + * @param s + * the Shape which outline is drawn. */ public abstract void draw(Shape s); /** - * Draws the specified GlyphVector object's text at the point x, y. + * Draws the specified GlyphVector object's text at the point x, y. * - * @param g the GlyphVector object to be drawn. - * @param x the X position where the GlyphVector's text should - * be rendered. - * @param y the Y position where the GlyphVector's text should - * be rendered. + * @param g + * the GlyphVector object to be drawn. + * @param x + * the X position where the GlyphVector's text should be + * rendered. + * @param y + * the Y position where the GlyphVector's text should be + * rendered. */ public abstract void drawGlyphVector(GlyphVector g, float x, float y); @@ -94,87 +102,107 @@ public abstract class Graphics2D extends Graphics { * Draws the BufferedImage -- modified according to the operation * BufferedImageOp -- at the point x, y. * - * @param img the BufferedImage to be rendered. - * @param op the filter to be applied to the image before rendering. - * @param x the X coordinate of the point where the image's upper left corner - * will be placed. - * @param y the Y coordinate of the point where the image's upper left corner - * will be placed. + * @param img + * the BufferedImage to be rendered. + * @param op + * the filter to be applied to the image before rendering. + * @param x + * the X coordinate of the point where the image's upper left + * corner will be placed. + * @param y + * the Y coordinate of the point where the image's upper left + * corner will be placed. */ public abstract void drawImage(BufferedImage img, BufferedImageOp op, int x, int y); /** - * Draws BufferedImage transformed from image space into user space + * Draws BufferedImage transformed from image space into user space * according to the AffineTransform xform and notifies the ImageObserver. - * - * @param img the BufferedImage to be rendered. - * @param xform the affine transformation from the image to the user space. - * @param obs the ImageObserver to be notified about the image conversion. * - * @return true, if the image is successfully loaded and rendered, - * or it's null, otherwise false. + * @param img + * the BufferedImage to be rendered. + * @param xform + * the affine transformation from the image to the user space. + * @param obs + * the ImageObserver to be notified about the image conversion. + * @return true, if the image is successfully loaded and rendered, or it's + * null, otherwise false. */ public abstract boolean drawImage(Image img, AffineTransform xform, ImageObserver obs); /** - * Draws a RenderableImage which is transformed from image space into user + * Draws a RenderableImage which is transformed from image space into user * according to the AffineTransform xform. - * - * @param img the RenderableImage to be rendered. - * @param xform the affine transformation from image to user space. + * + * @param img + * the RenderableImage to be rendered. + * @param xform + * the affine transformation from image to user space. */ public abstract void drawRenderableImage(RenderableImage img, AffineTransform xform); /** - * Draws a RenderedImage which is transformed from image space into user + * Draws a RenderedImage which is transformed from image space into user * according to the AffineTransform xform. - * - * @param img the RenderedImage to be rendered. - * @param xform the affine transformation from image to user space. + * + * @param img + * the RenderedImage to be rendered. + * @param xform + * the affine transformation from image to user space. */ public abstract void drawRenderedImage(RenderedImage img, AffineTransform xform); /** - * Draws the string specified by the AttributedCharacterIterator. - * The first character's position is specified by the X, Y parameters. + * Draws the string specified by the AttributedCharacterIterator. The first + * character's position is specified by the X, Y parameters. * - * @param iterator whose text is drawn. - * @param x the X position where the first character is drawn. - * @param y the Y position where the first character is drawn. + * @param iterator + * whose text is drawn. + * @param x + * the X position where the first character is drawn. + * @param y + * the Y position where the first character is drawn. */ public abstract void drawString(AttributedCharacterIterator iterator, float x, float y); /** - * Draws the string specified by the AttributedCharacterIterator. - * The first character's position is specified by the X, Y parameters. - * - * @param iterator whose text is drawn. - * @param x the X position where the first character is drawn. - * @param y the Y position where the first character is drawn. + * Draws the string specified by the AttributedCharacterIterator. The first + * character's position is specified by the X, Y parameters. * + * @param iterator + * whose text is drawn. + * @param x + * the X position where the first character is drawn. + * @param y + * the Y position where the first character is drawn. * @see java.awt.Graphics#drawString(AttributedCharacterIterator, int, int) */ @Override public abstract void drawString(AttributedCharacterIterator iterator, int x, int y); /** - * Draws the String whose the first character position is specified - * by the parameters X, Y. + * Draws the String whose the first character position is specified by the + * parameters X, Y. * - * @param s the String to be drawn. - * @param x the X position of the first character. - * @param y the Y position of the first character. + * @param s + * the String to be drawn. + * @param x + * the X position of the first character. + * @param y + * the Y position of the first character. */ public abstract void drawString(String s, float x, float y); /** - * Draws the String whose the first character coordinates are specified - * by the parameters X, Y. - * - * @param str the String to be drawn. - * @param x the X coordinate of the first character. - * @param y the Y coordinate of the first character. + * Draws the String whose the first character coordinates are specified by + * the parameters X, Y. * + * @param str + * the String to be drawn. + * @param x + * the X coordinate of the first character. + * @param y + * the Y coordinate of the first character. * @see java.awt.Graphics#drawString(String, int, int) */ @Override @@ -183,7 +211,8 @@ public abstract class Graphics2D extends Graphics { /** * Fills the interior of the specified Shape. * - * @param s the Shape to be filled. + * @param s + * the Shape to be filled. */ public abstract void fill(Shape s); @@ -204,7 +233,7 @@ public abstract class Graphics2D extends Graphics { /** * Gets the device configuration. * - * @return the device configuration + * @return the device configuration. */ public abstract GraphicsConfiguration getDeviceConfiguration(); @@ -223,17 +252,17 @@ public abstract class Graphics2D extends Graphics { public abstract Paint getPaint(); /** - * Gets the value of single preference for specified key. - * - * @param key the specified key of the rendering hint. + * Gets the value of single preference for specified key. * + * @param key + * the specified key of the rendering hint. * @return the value of rendering hint for specified key. */ public abstract Object getRenderingHint(RenderingHints.Key key); /** - * Gets the set of the rendering preferences as a collection of - * key/value pairs. + * Gets the set of the rendering preferences as a collection of key/value + * pairs. * * @return the RenderingHints which contains the rendering preferences. */ @@ -254,172 +283,196 @@ public abstract class Graphics2D extends Graphics { public abstract AffineTransform getTransform(); /** - * Determines wether or not the specified Shape intersects the specified - * Rectangle. If the onStroke parameter is true, this method - * checks whether or not the specified Shape outline intersects the specified - * Rectangle, otherwise this method checks whether or not the specified - * Shape's interior intersects the specified Rectangle. + * Determines whether or not the specified Shape intersects the specified + * Rectangle. If the onStroke parameter is true, this method checks whether + * or not the specified Shape outline intersects the specified Rectangle, + * otherwise this method checks whether or not the specified Shape's + * interior intersects the specified Rectangle. * - * @param rect the specified Rectangle. - * @param s the Shape to check for intersection. - * @param onStroke the parameter determines whether or not this method checks - * for intersection of the Shape outline or of the Shape interior with - * the Rectangle. - * - * @return true, if there is a hit, otherwise false. + * @param rect + * the specified Rectangle. + * @param s + * the Shape to check for intersection. + * @param onStroke + * the parameter determines whether or not this method checks for + * intersection of the Shape outline or of the Shape interior + * with the Rectangle. + * @return true, if there is a hit, false otherwise. */ public abstract boolean hit(Rectangle rect, Shape s, boolean onStroke); /** * Performs a rotation transform relative to current Graphics2D Transform. - * The coordinate system is rotated by the specified angle in radians relative to - * current origin. + * The coordinate system is rotated by the specified angle in radians + * relative to current origin. * - * @param theta the angle of rotation in radians. + * @param theta + * the angle of rotation in radians. */ public abstract void rotate(double theta); /** - * Performs a translated rotation transform relative to current Graphics2D - * Transform. The coordinate system is rotated by the specified angle in radians - * relative to current origin and then moved to point (x, y). - * - * Is this right? + * Performs a translated rotation transform relative to current Graphics2D + * Transform. The coordinate system is rotated by the specified angle in + * radians relative to current origin and then moved to point (x, y). Is + * this right? * - * @param theta the angle of rotation in radians. - * @param x the X coordinate. - * @param y the Y coordinate. + * @param theta + * the angle of rotation in radians. + * @param x + * the X coordinate. + * @param y + * the Y coordinate. */ public abstract void rotate(double theta, double x, double y); /** - * Performs a linear scale transform relative to current Graphics2D Transform. - * The coordinate system is rescaled vertically and horizontally + * Performs a linear scale transform relative to current Graphics2D + * Transform. The coordinate system is rescaled vertically and horizontally * by the specified parameters. * - * @param sx the scaling factor by which the X coordinate is multiplied. - * @param sy the scaling factor by which the Y coordinate is multiplied. + * @param sx + * the scaling factor by which the X coordinate is multiplied. + * @param sy + * the scaling factor by which the Y coordinate is multiplied. */ public abstract void scale(double sx, double sy); /** - * Sets a new background color for clearing rectangular areas. - * The clearRect method uses the current background color. + * Sets a new background color for clearing rectangular areas. The clearRect + * method uses the current background color. * - * @param color the new background color. + * @param color + * the new background color. */ public abstract void setBackground(Color color); /** - * Sets the current composite for Graphics2D. + * Sets the current composite for Graphics2D. * - * @param comp the Composite object. + * @param comp + * the Composite object. */ public abstract void setComposite(Composite comp); /** * Sets the paint for Graphics2D. * - * @param paint the Paint object. + * @param paint + * the Paint object. */ public abstract void setPaint(Paint paint); /** * Sets a key-value pair in the current RenderingHints map. * - * @param key the key of the rendering hint to set. - * @param value the value to set for the rendering hint. + * @param key + * the key of the rendering hint to set. + * @param value + * the value to set for the rendering hint. */ public abstract void setRenderingHint(RenderingHints.Key key, Object value); /** - * Replaces the current rendering hints with the specified rendering preferences. + * Replaces the current rendering hints with the specified rendering + * preferences. * - * @param hints the new Map of rendering hints. + * @param hints + * the new Map of rendering hints. */ public abstract void setRenderingHints(Map hints); /** * Sets the stroke for the Graphics2D. * - * @param s the Stroke object. + * @param s + * the Stroke object. */ public abstract void setStroke(Stroke s); /** - * Overwrite the current Transform of the Graphics2D. The specified Transform - * should be received from the getTransform() method and should be used - * only for restoring the original Graphics2D transform after calling - * draw or fill methods. + * Overwrite the current Transform of the Graphics2D. The specified + * Transform should be received from the getTransform() method and should be + * used only for restoring the original Graphics2D transform after calling + * draw or fill methods. * - * @param Tx the specified Transform. + * @param Tx + * the specified Transform. */ public abstract void setTransform(AffineTransform Tx); /** - * Performs a shear transform relative to current Graphics2D Transform. - * The coordinate system is shifted by the specified multipliers relative to + * Performs a shear transform relative to current Graphics2D Transform. The + * coordinate system is shifted by the specified multipliers relative to * current position. * - * @param shx the multiplier by which the X coordinates shift position - * along X axis as a function of Y coordinates. - * @param shy the multiplier by which the Y coordinates shift position - * along Y axis as a function of X coordinates. + * @param shx + * the multiplier by which the X coordinates shift position along + * X axis as a function of Y coordinates. + * @param shy + * the multiplier by which the Y coordinates shift position along + * Y axis as a function of X coordinates. */ public abstract void shear(double shx, double shy); /** - * Concatenates the AffineTransform object with current Transform - * of this Graphics2D. The transforms are applied in reverse order - * with the last specified transform applied first and the next - * transformation applied to the result of previous transformation. - * More precisely, if Cx is the current Graphics2D transform, the - * transform method's result with Tx as the parameter - * is the transformation Rx, where Rx(p) = Cx(Tx(p)), for p - a point - * in current coordinate system. Rx becomes the current Transform + * Concatenates the AffineTransform object with current Transform of this + * Graphics2D. The transforms are applied in reverse order with the last + * specified transform applied first and the next transformation applied to + * the result of previous transformation. More precisely, if Cx is the + * current Graphics2D transform, the transform method's result with Tx as + * the parameter is the transformation Rx, where Rx(p) = Cx(Tx(p)), for p - + * a point in current coordinate system. Rx becomes the current Transform * for this Graphics2D. * - * @param Tx the AffineTransform object to be concatenated with - * current Transform. + * @param Tx + * the AffineTransform object to be concatenated with current + * Transform. */ public abstract void transform(AffineTransform Tx); /** * Performs a translate transform relative to current Graphics2D Transform. - * The coordinate system is moved by the specified distance relative - * to current position. + * The coordinate system is moved by the specified distance relative to + * current position. * - * @param tx the translation distance along the X axis. - * @param ty the translation distance along the Y axis. + * @param tx + * the translation distance along the X axis. + * @param ty + * the translation distance along the Y axis. */ public abstract void translate(double tx, double ty); /** - * Moves the origin Graphics2D Transform to the point with x, y - * coordinates in current coordinate system. The new origin of coordinate - * system is moved to the (x, y) point accordingly. All rendering and - * transform operations are performed relative to this new origin. - * - * @param x the X coordinate. - * @param y the Y coordinate. + * Moves the origin Graphics2D Transform to the point with x, y coordinates + * in current coordinate system. The new origin of coordinate system is + * moved to the (x, y) point accordingly. All rendering and transform + * operations are performed relative to this new origin. * + * @param x + * the X coordinate. + * @param y + * the Y coordinate. * @see java.awt.Graphics#translate(int, int) */ @Override public abstract void translate(int x, int y); /** - * Fills a 3D rectangle with the current color. - * The rectangle is specified by its width, height, and top left corner - * coordinates. - * - * @param x the X coordinate of the rectangle's top left corner. - * @param y the Y coordinate of the rectangle's top left corner. - * @param width the width of rectangle. - * @param height the height of rectangle. - * @param raised a boolean value that determines whether the rectangle - * is drawn as raised or indented. - * + * Fills a 3D rectangle with the current color. The rectangle is specified + * by its width, height, and top left corner coordinates. + * + * @param x + * the X coordinate of the rectangle's top left corner. + * @param y + * the Y coordinate of the rectangle's top left corner. + * @param width + * the width of rectangle. + * @param height + * the height of rectangle. + * @param raised + * a boolean value that determines whether the rectangle is drawn + * as raised or indented. * @see java.awt.Graphics#fill3DRect(int, int, int, int, boolean) */ @Override @@ -433,15 +486,19 @@ public abstract class Graphics2D extends Graphics { } /** - * Draws the higlighted outline of a rectangle. + * Draws the highlighted outline of a rectangle. * - * @param x the X coordinate of the rectangle's top left corner. - * @param y the Y coordinate of the rectangle's top left corner. - * @param width the width of rectangle. - * @param height the height of rectangle. - * @param raised a boolean value that determines whether the rectangle - * is drawn as raised or indented. - * + * @param x + * the X coordinate of the rectangle's top left corner. + * @param y + * the Y coordinate of the rectangle's top left corner. + * @param width + * the width of rectangle. + * @param height + * the height of rectangle. + * @param raised + * a boolean value that determines whether the rectangle is drawn + * as raised or indented. * @see java.awt.Graphics#draw3DRect(int, int, int, int, boolean) */ @Override diff --git a/awt/java/awt/GraphicsConfiguration.java b/awt/java/awt/GraphicsConfiguration.java index 8bec253b8c77b..d59e896abb715 100644 --- a/awt/java/awt/GraphicsConfiguration.java +++ b/awt/java/awt/GraphicsConfiguration.java @@ -18,6 +18,7 @@ * @author Alexey A. Petrenko * @version $Revision$ */ + package java.awt; import java.awt.geom.AffineTransform; @@ -30,70 +31,76 @@ import org.apache.harmony.awt.internal.nls.Messages; /** * The GraphicsConfiguration class contains the characteristics of graphics * devices such as a printer or monitor, and represents device's capabilities - * and modes. Many GraphicsConfiguration objects can be associated with - * single graphics device. + * and modes. Many GraphicsConfiguration objects can be associated with single + * graphics device. + * + * @since Android 1.0 */ public abstract class GraphicsConfiguration { - - /** - * Constructor could not be used directly and should be obtained in - * extended classes. - */ + /** + * Constructor could not be used directly and should be obtained in extended + * classes. + */ protected GraphicsConfiguration() { } - - /** - * Creates BufferedImage image object with a data layout and color model - * compatible with this GraphicsConfiguration with specified width - * and height parameters. - * - * @param width the width of BufferedImage. - * @param height the height of BufferedImage. - * - * @return the BufferedImage object with specified width and height - * parameters. - */ + /** + * Creates BufferedImage image object with a data layout and color model + * compatible with this GraphicsConfiguration with specified width and + * height parameters. + * + * @param width + * the width of BufferedImage. + * @param height + * the height of BufferedImage. + * @return the BufferedImage object with specified width and height + * parameters. + */ public abstract BufferedImage createCompatibleImage(int width, int height); /** * Creates a BufferedImage that has the specified width, height, - * transparency and has a data layout and color model compatible with this - * GraphicsConfiguration. - * - * @param width the width of image. - * @param height the height of image. - * @param transparency the transparency mode. + * transparency and has a data layout and color model compatible with this + * GraphicsConfiguration. * + * @param width + * the width of image. + * @param height + * the height of image. + * @param transparency + * the transparency mode. * @return the BufferedImage object. */ public abstract BufferedImage createCompatibleImage(int width, int height, int transparency); /** - * Creates a VolatileImage that has the specified width and height - * and has a data layout and color model compatible with this - * GraphicsConfiguration. - * - * @param width the width of image. - * @param height the height of image. + * Creates a VolatileImage that has the specified width and height and has a + * data layout and color model compatible with this GraphicsConfiguration. * + * @param width + * the width of image. + * @param height + * the height of image. * @return the VolatileImage object. */ public abstract VolatileImage createCompatibleVolatileImage(int width, int height); /** * Creates a VolatileImage that supports the specified width, height, - * transparency and has a data layout and color model compatible with this - * GraphicsConfiguration. - * - * @param width the width of image. - * @param height the height of image. - * @param transparency the transparency mode. + * transparency and has a data layout and color model compatible with this + * GraphicsConfiguration. * + * @param width + * the width of image. + * @param height + * the height of image. + * @param transparency + * the transparency mode. * @return the VolatileImage object. */ - public abstract VolatileImage createCompatibleVolatileImage(int width, int height, int transparency); + public abstract VolatileImage createCompatibleVolatileImage(int width, int height, + int transparency); /** * Gets the bounds of area covered by the GraphicsConfiguration in the @@ -111,20 +118,19 @@ public abstract class GraphicsConfiguration { public abstract ColorModel getColorModel(); /** - * Gets the ColorModel of the GraphicsConfiguration which - * supports specified Transparency. + * Gets the ColorModel of the GraphicsConfiguration which supports specified + * Transparency. * - * @param transparency the Transparency mode: OPAQUE, BITMASK, or - * TRANSLUCENT. - * - * @return the ColorModel of the GraphicsConfiguration which - * supports specified Transparency. + * @param transparency + * the Transparency mode: OPAQUE, BITMASK, or TRANSLUCENT. + * @return the ColorModel of the GraphicsConfiguration which supports + * specified Transparency. */ public abstract ColorModel getColorModel(int transparency); /** - * Gets the default AffineTransform of the GraphicsConfiguration. - * This method translates user coordinates to device coordinates. + * Gets the default AffineTransform of the GraphicsConfiguration. This + * method translates user coordinates to device coordinates. * * @return the default AffineTransform of the GraphicsConfiguration. */ @@ -144,23 +150,24 @@ public abstract class GraphicsConfiguration { */ public abstract AffineTransform getNormalizingTransform(); - /** - * Creates VolatileImage with specified width, height, ImageCapabilities; - * a data layout and color model compatible with this GraphicsConfiguration. - * - * @param width the width of image. - * @param height the height of image. - * @param caps the ImageCapabilities object. - * - * @return the VolatileImage which data layout and color model compatible - * with this GraphicsConfiguration. - * - * @throws AWTException if ImageCapabilities is not supported by the - * GraphicsConfiguration. + * Creates VolatileImage with specified width, height, ImageCapabilities; a + * data layout and color model compatible with this GraphicsConfiguration. + * + * @param width + * the width of image. + * @param height + * the height of image. + * @param caps + * the ImageCapabilities object. + * @return the VolatileImage which data layout and color model compatible + * with this GraphicsConfiguration. + * @throws AWTException + * if ImageCapabilities is not supported by the + * GraphicsConfiguration. */ - public VolatileImage createCompatibleVolatileImage(int width, int height, - ImageCapabilities caps) throws AWTException { + public VolatileImage createCompatibleVolatileImage(int width, int height, ImageCapabilities caps) + throws AWTException { VolatileImage res = createCompatibleVolatileImage(width, height); if (!res.getCapabilities().equals(caps)) { // awt.14A=Can not create VolatileImage with specified capabilities @@ -170,21 +177,23 @@ public abstract class GraphicsConfiguration { } /** - * Creates a VolatileImage with specified width, height, transparency - * and ImageCapabilities; a data layout and color model compatible with - * this GraphicsConfiguration. - * - * @param width the width of image. - * @param height the height of image. - * @param caps the ImageCapabilities object. - * @param transparency the Transparency mode: OPAQUE, BITMASK, or - * TRANSLUCENT. - * - * @return the VolatileImage which data layout and color model compatible - * with this GraphicsConfiguration. - * - * @throws AWTException if ImageCapabilities is not supported by the + * Creates a VolatileImage with specified width, height, transparency and + * ImageCapabilities; a data layout and color model compatible with this * GraphicsConfiguration. + * + * @param width + * the width of image. + * @param height + * the height of image. + * @param caps + * the ImageCapabilities object. + * @param transparency + * the Transparency mode: OPAQUE, BITMASK, or TRANSLUCENT. + * @return the VolatileImage which data layout and color model compatible + * with this GraphicsConfiguration. + * @throws AWTException + * if ImageCapabilities is not supported by the + * GraphicsConfiguration. */ public VolatileImage createCompatibleVolatileImage(int width, int height, ImageCapabilities caps, int transparency) throws AWTException { @@ -199,7 +208,7 @@ public abstract class GraphicsConfiguration { /** * Gets the buffering capabilities of the GraphicsConfiguration. * - * @return the BufferCapabilities object. + * @return the BufferCapabilities object. */ public BufferCapabilities getBufferCapabilities() { return new BufferCapabilities(new ImageCapabilities(false), new ImageCapabilities(false), diff --git a/awt/java/awt/GraphicsDevice.java b/awt/java/awt/GraphicsDevice.java index 8cf700a95b841..9eda4e0eda796 100644 --- a/awt/java/awt/GraphicsDevice.java +++ b/awt/java/awt/GraphicsDevice.java @@ -18,50 +18,61 @@ * @author Alexey A. Petrenko * @version $Revision$ */ + package java.awt; import org.apache.harmony.awt.internal.nls.Messages; /** - * The GraphicsDevice class describes the graphics devices (such as screens - * or printers) which are available in a particular graphics environment. - * Many GraphicsDevice instances can be associated with a single - * GraphicsEnvironment. Each GraphicsDevice has one or more GraphicsConfiguration - * objects which specify the different configurations and modes of GraphicsDevice. + * The GraphicsDevice class describes the graphics devices (such as screens or + * printers) which are available in a particular graphics environment. Many + * GraphicsDevice instances can be associated with a single GraphicsEnvironment. + * Each GraphicsDevice has one or more GraphicsConfiguration objects which + * specify the different configurations and modes of GraphicsDevice. + * + * @since Android 1.0 */ public abstract class GraphicsDevice { - - /** The display mode. */ + + /** + * The display mode. + */ private DisplayMode displayMode; - //???AWT -// private Window fullScreenWindow = null; + // ???AWT + // private Window fullScreenWindow = null; - /** The Constant TYPE_IMAGE_BUFFER indicates a image buffer device. */ + /** + * The Constant TYPE_IMAGE_BUFFER indicates a image buffer device. + */ public static final int TYPE_IMAGE_BUFFER = 2; - /** The Constant TYPE_PRINTER indicates a printer device. */ + /** + * The Constant TYPE_PRINTER indicates a printer device. + */ public static final int TYPE_PRINTER = 1; - /** The Constant TYPE_RASTER_SCREEN indicates a raster screen device. */ + /** + * The Constant TYPE_RASTER_SCREEN indicates a raster screen device. + */ public static final int TYPE_RASTER_SCREEN = 0; - /** - * Constructor is not to be used directly as this class is abstract. - */ + /** + * Constructor is not to be used directly as this class is abstract. + */ protected GraphicsDevice() { - displayMode = new DisplayMode(0, 0, DisplayMode.BIT_DEPTH_MULTI, DisplayMode.REFRESH_RATE_UNKNOWN); + displayMode = new DisplayMode(0, 0, DisplayMode.BIT_DEPTH_MULTI, + DisplayMode.REFRESH_RATE_UNKNOWN); } - - /** - * Returns an array of GraphicsConfiguration objects associated - * with the GraphicsDevice. - * - * @return an array of GraphicsConfiguration objects associated - * with the GraphicsDevice. - */ + /** + * Returns an array of GraphicsConfiguration objects associated with the + * GraphicsDevice. + * + * @return an array of GraphicsConfiguration objects associated with the + * GraphicsDevice. + */ public abstract GraphicsConfiguration[] getConfigurations(); /** @@ -72,41 +83,39 @@ public abstract class GraphicsDevice { public abstract GraphicsConfiguration getDefaultConfiguration(); /** - * Gets the String identifier which associated with the GraphicsDevice in + * Gets the String identifier which associated with the GraphicsDevice in * the GraphicsEnvironment. * - * @return the String identifier of the GraphicsDevice in - * the GraphicsEnvironment. + * @return the String identifier of the GraphicsDevice in the + * GraphicsEnvironment. */ public abstract String getIDstring(); /** - * Gets the type of this GraphicsDevice: - * TYPE_IMAGE_BUFFER, TYPE_PRINTER or TYPE_RASTER_SCREEN. + * Gets the type of this GraphicsDevice: TYPE_IMAGE_BUFFER, TYPE_PRINTER or + * TYPE_RASTER_SCREEN. * - * @return the type of this GraphicsDevice: TYPE_IMAGE_BUFFER, - * TYPE_PRINTER or TYPE_RASTER_SCREEN. + * @return the type of this GraphicsDevice: TYPE_IMAGE_BUFFER, TYPE_PRINTER + * or TYPE_RASTER_SCREEN. */ public abstract int getType(); - - - /** - * Returns the number of bytes available in accelerated - * memory on this device. - * - * @return the number of bytes available accelerated memory. - */ + /** + * Returns the number of bytes available in accelerated memory on this + * device. + * + * @return the number of bytes available accelerated memory. + */ public int getAvailableAcceleratedMemory() { return 0; } - /* ???AWT - public GraphicsConfiguration getBestConfiguration(GraphicsConfigTemplate gct) { - return gct.getBestConfiguration(getConfigurations()); - } - */ - + /* + * ???AWT public GraphicsConfiguration + * getBestConfiguration(GraphicsConfigTemplate gct) { return + * gct.getBestConfiguration(getConfigurations()); } + */ + /** * Gets the current display mode of the GraphicsDevice. * @@ -122,43 +131,43 @@ public abstract class GraphicsDevice { * @return an array of display modes available in this GraphicsDevice. */ public DisplayMode[] getDisplayModes() { - DisplayMode []dms = {displayMode}; - return dms; + DisplayMode[] dms = { + displayMode + }; + return dms; } - /* ???AWT - public Window getFullScreenWindow() { - return fullScreenWindow; - } - */ - + /* + * ???AWT public Window getFullScreenWindow() { return fullScreenWindow; } + */ + /** - * Returns true if this GraphicsDevice supports low-level - * display changes. + * Returns true if this GraphicsDevice supports low-level display changes. * - * @return true, if this GraphicsDevice supports low-level - * display changes; false otherwise. + * @return true, if this GraphicsDevice supports low-level display changes; + * false otherwise. */ public boolean isDisplayChangeSupported() { return false; } /** - * Returns true if this GraphicsDevice supports full screen - * mode. + * Returns true if this GraphicsDevice supports full screen mode. * - * @return true, if this GraphicsDevice supports full screen - * mode; otherwise false. + * @return true, if this GraphicsDevice supports full screen mode, false + * otherwise. */ public boolean isFullScreenSupported() { return false; } - //an array of display modes available in this GraphicsDevice. - + + // an array of display modes available in this GraphicsDevice. + /** * Sets the display mode of this GraphicsDevice. * - * @param dm the new display mode of this GraphicsDevice. + * @param dm + * the new display mode of this GraphicsDevice. */ public void setDisplayMode(DisplayMode dm) { if (!isDisplayChangeSupported()) { @@ -166,7 +175,7 @@ public abstract class GraphicsDevice { throw new UnsupportedOperationException(Messages.getString("awt.122")); //$NON-NLS-1$ } - DisplayMode []dms = getDisplayModes(); + DisplayMode[] dms = getDisplayModes(); for (DisplayMode element : dms) { if (element.equals(dm)) { displayMode = dm; @@ -177,23 +186,11 @@ public abstract class GraphicsDevice { throw new IllegalArgumentException(Messages.getString("awt.123", dm)); //$NON-NLS-1$ } - /* ???AWT - public void setFullScreenWindow(Window w) { - if (w == null) { - fullScreenWindow = null; - return; - } - - fullScreenWindow = w; - - if (isFullScreenSupported()) { - w.enableInputMethods(false); - } else { - w.setSize(displayMode.getWidth(), displayMode.getHeight()); - w.setLocation(0, 0); - } - w.setVisible(true); - w.setAlwaysOnTop(true); - } - */ + /* + * ???AWT public void setFullScreenWindow(Window w) { if (w == null) { + * fullScreenWindow = null; return; } fullScreenWindow = w; if + * (isFullScreenSupported()) { w.enableInputMethods(false); } else { + * w.setSize(displayMode.getWidth(), displayMode.getHeight()); + * w.setLocation(0, 0); } w.setVisible(true); w.setAlwaysOnTop(true); } + */ } diff --git a/awt/java/awt/GraphicsEnvironment.java b/awt/java/awt/GraphicsEnvironment.java index 3b14f55b40b16..d527417f732e9 100644 --- a/awt/java/awt/GraphicsEnvironment.java +++ b/awt/java/awt/GraphicsEnvironment.java @@ -28,17 +28,20 @@ import org.apache.harmony.awt.ContextStorage; import org.apache.harmony.awt.gl.CommonGraphics2DFactory; /** - * The GraphicsEnvironment class defines a collection of GraphicsDevice - * objects and Font objects which are available for Java application on - * current platform. + * The GraphicsEnvironment class defines a collection of GraphicsDevice objects + * and Font objects which are available for Java application on current + * platform. + * + * @since Android 1.0 */ public abstract class GraphicsEnvironment { - + /** - * Constructor could not be used directly and should be obtained in - * extended classes. + * Constructor could not be used directly and should be obtained in extended + * classes. */ - protected GraphicsEnvironment() {} + protected GraphicsEnvironment() { + } /** * Gets the local GraphicsEnvironment. @@ -46,17 +49,16 @@ public abstract class GraphicsEnvironment { * @return the local GraphicsEnvironment. */ public static GraphicsEnvironment getLocalGraphicsEnvironment() { - synchronized(ContextStorage.getContextLock()) { + synchronized (ContextStorage.getContextLock()) { if (ContextStorage.getGraphicsEnvironment() == null) { - if (isHeadless()) { - ContextStorage.setGraphicsEnvironment(new HeadlessGraphicsEnvironment()); + if (isHeadless()) { + ContextStorage.setGraphicsEnvironment(new HeadlessGraphicsEnvironment()); } else { - CommonGraphics2DFactory g2df = - (CommonGraphics2DFactory) Toolkit.getDefaultToolkit().getGraphicsFactory(); - - ContextStorage.setGraphicsEnvironment( - g2df.createGraphicsEnvironment(ContextStorage.getWindowFactory()) - ); + CommonGraphics2DFactory g2df = (CommonGraphics2DFactory)Toolkit + .getDefaultToolkit().getGraphicsFactory(); + + ContextStorage.setGraphicsEnvironment(g2df + .createGraphicsEnvironment(ContextStorage.getWindowFactory())); } } @@ -65,24 +67,24 @@ public abstract class GraphicsEnvironment { } /** - * Returns whether or not a display, keyboard, and mouse are supported - * in this graphics environment. + * Returns whether or not a display, keyboard, and mouse are supported in + * this graphics environment. * - * @return true, if HeadlessException will be thrown from areas of - * the graphics environment that are dependent on a display, keyboard, - * or mouse; false otherwise. + * @return true, if HeadlessException will be thrown from areas of the + * graphics environment that are dependent on a display, keyboard, + * or mouse, false otherwise. */ public boolean isHeadlessInstance() { return false; } /** - * Checks whether or not a display, keyboard, and mouse are supported - * in this environment. + * Checks whether or not a display, keyboard, and mouse are supported in + * this environment. * - * @return true, if a HeadlessException is thrown from areas of - * the Toolkit and GraphicsEnvironment that are dependent on - * a display, keyboard, or mouse; false otherwise. + * @return true, if a HeadlessException is thrown from areas of the Toolkit + * and GraphicsEnvironment that are dependent on a display, + * keyboard, or mouse, false otherwise. */ public static boolean isHeadless() { return "true".equals(System.getProperty("java.awt.headless")); @@ -92,8 +94,8 @@ public abstract class GraphicsEnvironment { * Gets the maximum bounds of system centered windows. * * @return the maximum bounds of system centered windows. - * - * @throws HeadlessException if isHeadless() method returns true. + * @throws HeadlessException + * if isHeadless() method returns true. */ public Rectangle getMaximumWindowBounds() throws HeadlessException { return getDefaultScreenDevice().getDefaultConfiguration().getBounds(); @@ -103,8 +105,8 @@ public abstract class GraphicsEnvironment { * Gets the Point which should defines the center of system window. * * @return the Point where the system window should be centered. - * - * @throws HeadlessException if isHeadless() method returns true. + * @throws HeadlessException + * if isHeadless() method returns true. */ public Point getCenterPoint() throws HeadlessException { Rectangle mwb = getMaximumWindowBounds(); @@ -112,9 +114,8 @@ public abstract class GraphicsEnvironment { } /** - * Indicates that the primary font should be used. - * Primary font is specified by initial system locale or default encoding). - * + * Indicates that the primary font should be used. Primary font is specified + * by initial system locale or default encoding). */ public void preferLocaleFonts() { // Note: API specification says following: @@ -123,7 +124,8 @@ public abstract class GraphicsEnvironment { // it may have no effect at all." So, doing nothing is an // acceptable behavior for this method. - // For now FontManager uses 1.4 font.properties scheme for font mapping, so + // For now FontManager uses 1.4 font.properties scheme for font mapping, + // so // this method doesn't make any sense. The implementation of this method // which will influence font mapping is postponed until // 1.5 mapping scheme not implemented. @@ -141,7 +143,8 @@ public abstract class GraphicsEnvironment { // it may have no effect at all." So, doing nothing is an // acceptable behavior for this method. - // For now FontManager uses 1.4 font.properties scheme for font mapping, so + // For now FontManager uses 1.4 font.properties scheme for font mapping, + // so // this method doesn't make any sense. The implementation of this method // which will influence font mapping is postponed until // 1.5 mapping scheme not implemented. @@ -153,19 +156,19 @@ public abstract class GraphicsEnvironment { * Creates the Graphics2D object for rendering to the specified * BufferedImage. * - * @param bufferedImage the BufferedImage object. - * - * @return the Graphics2D object which allows to render to the specified - * BufferedImage. + * @param bufferedImage + * the BufferedImage object. + * @return the Graphics2D object which allows to render to the specified + * BufferedImage. */ public abstract Graphics2D createGraphics(BufferedImage bufferedImage); /** - * Gets the array of all available fonts instances in this + * Gets the array of all available fonts instances in this * GraphicsEnviroments. * - * @return the array of all available fonts instances in this - * GraphicsEnviroments. + * @return the array of all available fonts instances in this + * GraphicsEnviroments. */ public abstract Font[] getAllFonts(); @@ -180,11 +183,11 @@ public abstract class GraphicsEnvironment { * Gets the array of all available font family names for the specified * locale. * - * @param locale the Locale object which represents geographical - * region. The default locale is used if locale is null. - * - * @return the array of available font family names for the specified - * locale. + * @param locale + * the Locale object which represents geographical region. The + * default locale is used if locale is null. + * @return the array of available font family names for the specified + * locale. */ public abstract String[] getAvailableFontFamilyNames(Locale locale); @@ -192,18 +195,18 @@ public abstract class GraphicsEnvironment { * Gets the default screen device as GraphicDevice object. * * @return the GraphicDevice object which represents default screen device. - * - * @throws HeadlessException if isHeadless() returns true. + * @throws HeadlessException + * if isHeadless() returns true. */ public abstract GraphicsDevice getDefaultScreenDevice() throws HeadlessException; /** * Gets an array of all available screen devices. * - * @return the array of GraphicsDevice obgects which represents - * all available screen devices. - * - * @throws HeadlessException if isHeadless() returns true. + * @return the array of GraphicsDevice objects which represents all + * available screen devices. + * @throws HeadlessException + * if isHeadless() returns true. */ public abstract GraphicsDevice[] getScreenDevices() throws HeadlessException; } diff --git a/awt/java/awt/HeadlessException.java b/awt/java/awt/HeadlessException.java index 28e463b3e01ec..ec111f1e4ee8a 100644 --- a/awt/java/awt/HeadlessException.java +++ b/awt/java/awt/HeadlessException.java @@ -18,16 +18,21 @@ * @author Alexey A. Petrenko * @version $Revision$ */ + package java.awt; /** - * The HeadlessException class provides notifications and error messages - * when code that is dependent on a keyboard, display, or mouse is called - * in an environment that does not support a keyboard, display, or mouse. + * The HeadlessException class provides notifications and error messages when + * code that is dependent on a keyboard, display, or mouse is called in an + * environment that does not support a keyboard, display, or mouse. + * + * @since Android 1.0 */ public class HeadlessException extends UnsupportedOperationException { - - /** The Constant serialVersionUID. */ + + /** + * The Constant serialVersionUID. + */ private static final long serialVersionUID = 167183644944358563L; /** @@ -40,7 +45,8 @@ public class HeadlessException extends UnsupportedOperationException { /** * Instantiates a new headless exception with the specified message. * - * @param msg the String which represents error message. + * @param msg + * the String which represents error message. */ public HeadlessException(String msg) { super(msg); diff --git a/awt/java/awt/HeadlessGraphicsEnvironment.java b/awt/java/awt/HeadlessGraphicsEnvironment.java index 97f88d168de45..306393f33e9b9 100644 --- a/awt/java/awt/HeadlessGraphicsEnvironment.java +++ b/awt/java/awt/HeadlessGraphicsEnvironment.java @@ -14,6 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package java.awt; import java.awt.GraphicsDevice; @@ -23,30 +24,32 @@ import org.apache.harmony.awt.gl.CommonGraphicsEnvironment; /** * The HeadlessGraphicsEnvironment class is the CommonGraphicsEnvironment - * implementation to use in the case where the environment lacks display, + * implementation to use in the case where the environment lacks display, * keyboard, and mouse support. + * + * @since Android 1.0 */ public class HeadlessGraphicsEnvironment extends CommonGraphicsEnvironment { - + /** - * Returns whether or not a display, keyboard, and mouse are supported - * in this graphics environment. + * Returns whether or not a display, keyboard, and mouse are supported in + * this graphics environment. * - * @return true, if HeadlessException will be thrown from areas of - * the graphics environment that are dependent on a display, keyboard, - * or mouse; false otherwise. + * @return true, if HeadlessException will be thrown from areas of the + * graphics environment that are dependent on a display, keyboard, + * or mouse, false otherwise. */ @Override public boolean isHeadlessInstance() { return true; } - + /** * Gets the default screen device as GraphicDevice object. * * @return the GraphicDevice object which represents default screen device. - * - * @throws HeadlessException if isHeadless() returns true. + * @throws HeadlessException + * if isHeadless() returns true. */ @Override public GraphicsDevice getDefaultScreenDevice() throws HeadlessException { @@ -56,10 +59,10 @@ public class HeadlessGraphicsEnvironment extends CommonGraphicsEnvironment { /** * Gets an array of all available screen devices. * - * @return the array of GraphicsDevice objects which represents - * all available screen devices. - * - * @throws HeadlessException if isHeadless() returns true. + * @return the array of GraphicsDevice objects which represents all + * available screen devices. + * @throws HeadlessException + * if isHeadless() returns true. */ @Override public GraphicsDevice[] getScreenDevices() throws HeadlessException { diff --git a/awt/java/awt/HeadlessToolkit.java b/awt/java/awt/HeadlessToolkit.java index a7dd557a44565..c64a85a617ecd 100644 --- a/awt/java/awt/HeadlessToolkit.java +++ b/awt/java/awt/HeadlessToolkit.java @@ -26,136 +26,75 @@ package java.awt; //import java.awt.dnd.InvalidDnDOperationException; //import java.awt.dnd.peer.DragSourceContextPeer; import java.awt.im.InputMethodHighlight; -import java.awt.image.ColorModel; -//import java.awt.peer.*; +import java.awt.image.ColorModel; //import java.awt.peer.*; //import java.beans.PropertyChangeSupport; import java.util.HashMap; import java.util.Map; import java.util.Properties; -import org.apache.harmony.awt.ComponentInternals; -//import org.apache.harmony.awt.datatransfer.DTK; +import org.apache.harmony.awt.ComponentInternals; //import org.apache.harmony.awt.datatransfer.DTK; import org.apache.harmony.awt.wtk.GraphicsFactory; import org.apache.harmony.awt.wtk.NativeEventQueue; import org.apache.harmony.awt.wtk.WindowFactory; /** - * The HeadlessToolkit class is a subclass of ToolkitImpl to - * be used for graphical environments that lack keyboard and - * mouse capabilities. + * The HeadlessToolkit class is a subclass of ToolkitImpl to be used for + * graphical environments that lack keyboard and mouse capabilities. + * + * @since Android 1.0 */ public final class HeadlessToolkit extends ToolkitImpl { - - //???AWT - /* - @Override - protected ButtonPeer createButton(Button a0) throws HeadlessException { - throw new HeadlessException(); - } - - @Override - protected CheckboxPeer createCheckbox(Checkbox a0) throws HeadlessException { - throw new HeadlessException(); - } - - @Override - protected CheckboxMenuItemPeer createCheckboxMenuItem(CheckboxMenuItem a0) throws HeadlessException { - throw new HeadlessException(); - } - - @Override - protected ChoicePeer createChoice(Choice a0) throws HeadlessException { - throw new HeadlessException(); - } - - public Cursor createCustomCursor(Image img, Point hotSpot, String name) - throws HeadlessException { - throw new HeadlessException(); - } - - @Override - protected DialogPeer createDialog(Dialog a0) throws HeadlessException { - throw new HeadlessException(); - } - - @Override - public T createDragGestureRecognizer( - Class recognizerAbstractClass, DragSource ds, Component c, int srcActions, - DragGestureListener dgl) { - return null; - } - - @Override - public DragSourceContextPeer createDragSourceContextPeer(DragGestureEvent dge) - throws InvalidDnDOperationException { - throw new InvalidDnDOperationException(); - } - - @Override - protected FileDialogPeer createFileDialog(FileDialog a0) throws HeadlessException { - throw new HeadlessException(); - } - - @Override - protected FramePeer createFrame(Frame a0) throws HeadlessException { - throw new HeadlessException(); - } - - @Override - protected LabelPeer createLabel(Label a0) throws HeadlessException { - throw new HeadlessException(); - } - - @Override - protected ListPeer createList(List a0) throws HeadlessException { - throw new HeadlessException(); - } - - @Override - protected MenuPeer createMenu(Menu a0) throws HeadlessException { - throw new HeadlessException(); - } - - @Override - protected MenuBarPeer createMenuBar(MenuBar a0) throws HeadlessException { - throw new HeadlessException(); - } - @Override - protected MenuItemPeer createMenuItem(MenuItem a0) throws HeadlessException { - throw new HeadlessException(); - } - - @Override - protected PopupMenuPeer createPopupMenu(PopupMenu a0) throws HeadlessException { - throw new HeadlessException(); - } - - @Override - protected ScrollbarPeer createScrollbar(Scrollbar a0) throws HeadlessException { - throw new HeadlessException(); - } - - @Override - protected ScrollPanePeer createScrollPane(ScrollPane a0) throws HeadlessException { - throw new HeadlessException(); - } - - @Override - protected TextAreaPeer createTextArea(TextArea a0) throws HeadlessException { - throw new HeadlessException(); - } - - @Override - protected TextFieldPeer createTextField(TextField a0) throws HeadlessException { - throw new HeadlessException(); - } - - @Override - protected WindowPeer createWindow(Window a0) throws HeadlessException { - throw new HeadlessException(); - } - */ + // ???AWT + /* + * @Override protected ButtonPeer createButton(Button a0) throws + * HeadlessException { throw new HeadlessException(); } + * @Override protected CheckboxPeer createCheckbox(Checkbox a0) throws + * HeadlessException { throw new HeadlessException(); } + * @Override protected CheckboxMenuItemPeer + * createCheckboxMenuItem(CheckboxMenuItem a0) throws HeadlessException { + * throw new HeadlessException(); } + * @Override protected ChoicePeer createChoice(Choice a0) throws + * HeadlessException { throw new HeadlessException(); } public Cursor + * createCustomCursor(Image img, Point hotSpot, String name) throws + * HeadlessException { throw new HeadlessException(); } + * @Override protected DialogPeer createDialog(Dialog a0) throws + * HeadlessException { throw new HeadlessException(); } + * @Override public T + * createDragGestureRecognizer( Class recognizerAbstractClass, DragSource + * ds, Component c, int srcActions, DragGestureListener dgl) { return null; + * } + * @Override public DragSourceContextPeer + * createDragSourceContextPeer(DragGestureEvent dge) throws + * InvalidDnDOperationException { throw new InvalidDnDOperationException(); + * } + * @Override protected FileDialogPeer createFileDialog(FileDialog a0) throws + * HeadlessException { throw new HeadlessException(); } + * @Override protected FramePeer createFrame(Frame a0) throws + * HeadlessException { throw new HeadlessException(); } + * @Override protected LabelPeer createLabel(Label a0) throws + * HeadlessException { throw new HeadlessException(); } + * @Override protected ListPeer createList(List a0) throws HeadlessException + * { throw new HeadlessException(); } + * @Override protected MenuPeer createMenu(Menu a0) throws HeadlessException + * { throw new HeadlessException(); } + * @Override protected MenuBarPeer createMenuBar(MenuBar a0) throws + * HeadlessException { throw new HeadlessException(); } + * @Override protected MenuItemPeer createMenuItem(MenuItem a0) throws + * HeadlessException { throw new HeadlessException(); } + * @Override protected PopupMenuPeer createPopupMenu(PopupMenu a0) throws + * HeadlessException { throw new HeadlessException(); } + * @Override protected ScrollbarPeer createScrollbar(Scrollbar a0) throws + * HeadlessException { throw new HeadlessException(); } + * @Override protected ScrollPanePeer createScrollPane(ScrollPane a0) throws + * HeadlessException { throw new HeadlessException(); } + * @Override protected TextAreaPeer createTextArea(TextArea a0) throws + * HeadlessException { throw new HeadlessException(); } + * @Override protected TextFieldPeer createTextField(TextField a0) throws + * HeadlessException { throw new HeadlessException(); } + * @Override protected WindowPeer createWindow(Window a0) throws + * HeadlessException { throw new HeadlessException(); } + */ @Override public Dimension getBestCursorSize(int prefWidth, int prefHeight) throws HeadlessException { @@ -186,25 +125,18 @@ public final class HeadlessToolkit extends ToolkitImpl { public int getMenuShortcutKeyMask() throws HeadlessException { throw new HeadlessException(); } - - //???AWT + + // ???AWT /* - @Override - NativeEventQueue getNativeEventQueue() throws HeadlessException { - throw new HeadlessException(); - } - - @Override - public PrintJob getPrintJob(Frame frame, String jobtitle, JobAttributes jobAttributes, - PageAttributes pageAttributes) throws IllegalArgumentException { - throw new IllegalArgumentException(); - } - - @Override - public PrintJob getPrintJob(Frame frame, String jobtitle, Properties props) throws NullPointerException { - throw new NullPointerException(); - } - */ + * @Override NativeEventQueue getNativeEventQueue() throws HeadlessException + * { throw new HeadlessException(); } + * @Override public PrintJob getPrintJob(Frame frame, String jobtitle, + * JobAttributes jobAttributes, PageAttributes pageAttributes) throws + * IllegalArgumentException { throw new IllegalArgumentException(); } + * @Override public PrintJob getPrintJob(Frame frame, String jobtitle, + * Properties props) throws NullPointerException { throw new + * NullPointerException(); } + */ @Override public Insets getScreenInsets(GraphicsConfiguration gc) throws HeadlessException { @@ -214,44 +146,37 @@ public final class HeadlessToolkit extends ToolkitImpl { @Override public int getScreenResolution() throws HeadlessException { throw new HeadlessException(); - } + } @Override public Dimension getScreenSize() throws HeadlessException { throw new HeadlessException(); } - - //???AWT + + // ???AWT /* - @Override - public Clipboard getSystemClipboard() throws HeadlessException { - throw new HeadlessException(); - } - - @Override - public Clipboard getSystemSelection() throws HeadlessException { - throw new HeadlessException(); - } - - @Override - WindowFactory getWindowFactory() throws HeadlessException { - throw new HeadlessException(); - } - */ + * @Override public Clipboard getSystemClipboard() throws HeadlessException + * { throw new HeadlessException(); } + * @Override public Clipboard getSystemSelection() throws HeadlessException + * { throw new HeadlessException(); } + * @Override WindowFactory getWindowFactory() throws HeadlessException { + * throw new HeadlessException(); } + */ @Override protected void init() { lockAWT(); try { ComponentInternals.setComponentInternals(new ComponentInternalsImpl()); - //???AWT: new EventQueue(this); // create the system EventQueue - //???AWT: dispatcher = new Dispatcher(this); + // ???AWT: new EventQueue(this); // create the system EventQueue + // ???AWT: dispatcher = new Dispatcher(this); desktopProperties = new HashMap(); - //???AWT: desktopPropsSupport = new PropertyChangeSupport(this); -// ???AWT: awtEventsManager = new AWTEventsManager(); -// ???AWT: dispatchThread = new HeadlessEventDispatchThread(this, dispatcher); -// ???AWT: dtk = DTK.getDTK(); - dispatchThread.start(); + // ???AWT: desktopPropsSupport = new PropertyChangeSupport(this); + // ???AWT: awtEventsManager = new AWTEventsManager(); + // ???AWT: dispatchThread = new HeadlessEventDispatchThread(this, + // dispatcher); + // ???AWT: dtk = DTK.getDTK(); + dispatchThread.start(); } finally { unlockAWT(); } @@ -284,8 +209,8 @@ public final class HeadlessToolkit extends ToolkitImpl { } @Override - Map mapInputMethodHighlightImpl( - InputMethodHighlight highlight) throws HeadlessException { + Map mapInputMethodHighlightImpl(InputMethodHighlight highlight) + throws HeadlessException { throw new HeadlessException(); } diff --git a/awt/java/awt/IllegalComponentStateException.java b/awt/java/awt/IllegalComponentStateException.java index 21dc35f220ed3..bed172998997f 100644 --- a/awt/java/awt/IllegalComponentStateException.java +++ b/awt/java/awt/IllegalComponentStateException.java @@ -18,34 +18,38 @@ * @author Michael Danilov * @version $Revision$ */ + package java.awt; /** - * The IllegalComponentStateException class is used to provide - * notification that AWT component is not in an appropriate state - * for the requested operation. + * The IllegalComponentStateException class is used to provide notification that + * AWT component is not in an appropriate state for the requested operation. + * + * @since Android 1.0 */ public class IllegalComponentStateException extends IllegalStateException { - /** The Constant serialVersionUID. */ + /** + * The Constant serialVersionUID. + */ private static final long serialVersionUID = -1889339587208144238L; /** - * Instantiates a new IllegalComponentStateException with - * the specified message. + * Instantiates a new IllegalComponentStateException with the specified + * message. * - * @param s the String message which describes the exception. + * @param s + * the String message which describes the exception. */ public IllegalComponentStateException(String s) { super(s); } /** - * Instantiates a new IllegalComponentStateException without - * detailed message. + * Instantiates a new IllegalComponentStateException without detailed + * message. */ public IllegalComponentStateException() { } } - diff --git a/awt/java/awt/Image.java b/awt/java/awt/Image.java index c217e380c74ad..7ae3ed8836e5e 100644 --- a/awt/java/awt/Image.java +++ b/awt/java/awt/Image.java @@ -18,6 +18,7 @@ * @author Igor V. Stolyarov * @version $Revision$ */ + package java.awt; import java.awt.image.AreaAveragingScaleFilter; @@ -30,64 +31,67 @@ import java.awt.image.ReplicateScaleFilter; import org.apache.harmony.awt.internal.nls.Messages; /** - * The Image abstract class represents the graphic images. + * The Image abstract class represents the graphic images. + * + * @since Android 1.0 */ public abstract class Image { - /** - * The UndefinedProperty object should be returned if - * property is not defined for a particular image. + /** + * The UndefinedProperty object should be returned if property is not + * defined for a particular image. */ - public static final Object UndefinedProperty = new Object(); //$NON-LOCK-1$ + public static final Object UndefinedProperty = new Object(); // $NON-LOCK-1$ - /** - * The Constant SCALE_DEFAULT indicates the default image - * scaling algorithm. + /** + * The Constant SCALE_DEFAULT indicates the default image scaling algorithm. */ public static final int SCALE_DEFAULT = 1; - /** - * The Constant SCALE_FAST indicates an image scaling algorithm which - * places a higher priority on scaling speed than on the image's smoothness. + /** + * The Constant SCALE_FAST indicates an image scaling algorithm which places + * a higher priority on scaling speed than on the image's smoothness. */ public static final int SCALE_FAST = 2; - /** - * The Constant SCALE_SMOOTH indicates an image scaling algorithm which - * places a higher priority on image smoothness than on scaling speed. + /** + * The Constant SCALE_SMOOTH indicates an image scaling algorithm which + * places a higher priority on image smoothness than on scaling speed. */ public static final int SCALE_SMOOTH = 4; - /** - * The Constant SCALE_REPLICATE indicates the image scaling - * algorithm in the ReplicateScaleFilter class. + /** + * The Constant SCALE_REPLICATE indicates the image scaling algorithm in the + * ReplicateScaleFilter class. */ public static final int SCALE_REPLICATE = 8; - /** - * The Constant SCALE_AREA_AVERAGING indicates - * the area averaging image scaling algorithm. + /** + * The Constant SCALE_AREA_AVERAGING indicates the area averaging image + * scaling algorithm. */ public static final int SCALE_AREA_AVERAGING = 16; - /** - * The acceleration priority indicates image acceleration. + /** + * The acceleration priority indicates image acceleration. */ protected float accelerationPriority = 0.5f; - /** The Constant capabilities. */ + /** + * The Constant capabilities. + */ private static final ImageCapabilities capabilities = new ImageCapabilities(false); /** - * Gets the image property with the specified name. - * The UndefinedProperty object should be return if the property is - * not specified for this image. The return value should be null if the - * property is currently unknown yet and the specified ImageObserver is - * to be notified later. - * - * @param name the name of image's property. - * @param observer the ImageObserver. + * Gets the image property with the specified name. The UndefinedProperty + * object should be return if the property is not specified for this image. + * The return value should be null if the property is currently unknown yet + * and the specified ImageObserver is to be notified later. * + * @param name + * the name of image's property. + * @param observer + * the ImageObserver. * @return the Object which represents value of the specified property. */ public abstract Object getProperty(String name, ImageObserver observer); @@ -100,39 +104,40 @@ public abstract class Image { public abstract ImageProducer getSource(); /** - * Gets the width of this image. The specified ImageObserver object - * is notified when the width of this image is available. - * - * @param observer the ImageObserver object which is - * is notified when the width of this image is available. + * Gets the width of this image. The specified ImageObserver object is + * notified when the width of this image is available. * - * @return the width of image, or -1 if the width of this image - * is not available. + * @param observer + * the ImageObserver object which is is notified when the width + * of this image is available. + * @return the width of image, or -1 if the width of this image is not + * available. */ public abstract int getWidth(ImageObserver observer); /** - * Gets the height of this image. The specified ImageObserver object - * is notified when the height of this image is available. + * Gets the height of this image. The specified ImageObserver object is + * notified when the height of this image is available. * - * @param observer the ImageObserver object which is - * is notified when the height of this image is available. - * - * @return the height of image, or -1 if the height of this image - * is not available. + * @param observer + * the ImageObserver object which is is notified when the height + * of this image is available. + * @return the height of image, or -1 if the height of this image is not + * available. */ public abstract int getHeight(ImageObserver observer); /** - * Gets the scaled instance of this Image. This method returns - * an Image object constructed from the source of this image - * with the specified width, height, and applied scaling - * alghorithm. - * - * @param width the width of scaled Image. - * @param height the height of scaled Image. - * @param hints the constant which indicates scaling algorithm. + * Gets the scaled instance of this Image. This method returns an Image + * object constructed from the source of this image with the specified + * width, height, and applied scaling algorithm. * + * @param width + * the width of scaled Image. + * @param height + * the height of scaled Image. + * @param hints + * the constant which indicates scaling algorithm. * @return the scaled Image. */ public Image getScaledInstance(int width, int height, int hints) { @@ -147,17 +152,16 @@ public abstract class Image { } /** - * Gets a Graphics object for rendering this image. - * This method can be used for off-screen images. + * Gets a Graphics object for rendering this image. This method can be used + * for off-screen images. * * @return a Graphics object for rendering to this image. */ public abstract Graphics getGraphics(); /** - * Flushes resources which are used by this Image object. - * This method resets the image to the reconstructered state - * from the image's source. + * Flushes resources which are used by this Image object. This method resets + * the image to the reconstructed state from the image's source. */ public abstract void flush(); @@ -171,10 +175,10 @@ public abstract class Image { } /** - * Sets the acceleration priority for this image. - * - * @param priority the new acceleration priority (value in the - * range 0-1). + * Sets the acceleration priority for this image. + * + * @param priority + * the new acceleration priority (value in the range 0-1). */ public void setAccelerationPriority(float priority) { if (priority < 0 || priority > 1) { @@ -185,19 +189,17 @@ public abstract class Image { } /** - * Gets an ImageCapabilities object of this Image object - * for the specified GraphicsConfiguration. - * - * @param gc the specified GraphicsConfiguration object - * (null value means default GraphicsConfiguration). + * Gets an ImageCapabilities object of this Image object for the specified + * GraphicsConfiguration. * - * @return an ImageCapabilities object of this Image object - * for the specified GraphicsConfiguration. + * @param gc + * the specified GraphicsConfiguration object (null value means + * default GraphicsConfiguration). + * @return an ImageCapabilities object of this Image object for the + * specified GraphicsConfiguration. */ public ImageCapabilities getCapabilities(GraphicsConfiguration gc) { // Note: common image is not accelerated. return capabilities; } } - - diff --git a/awt/java/awt/ImageCapabilities.java b/awt/java/awt/ImageCapabilities.java index 6e9ecfc3799b4..c6d59462aea3a 100644 --- a/awt/java/awt/ImageCapabilities.java +++ b/awt/java/awt/ImageCapabilities.java @@ -18,22 +18,27 @@ * @author Alexey A. Petrenko * @version $Revision$ */ + package java.awt; /** * The ImageCapabilities class gives information about an image's capabilities. + * + * @since Android 1.0 */ public class ImageCapabilities implements Cloneable { - - /** The accelerated. */ + + /** + * The accelerated. + */ private final boolean accelerated; /** - * Instantiates a new ImageCapabilities with the specified - * acceleration flag which indicates whether acceleration - * is desired or not. + * Instantiates a new ImageCapabilities with the specified acceleration flag + * which indicates whether acceleration is desired or not. * - * @param accelerated the accelerated flag. + * @param accelerated + * the accelerated flag. */ public ImageCapabilities(boolean accelerated) { this.accelerated = accelerated; @@ -50,23 +55,22 @@ public class ImageCapabilities implements Cloneable { } /** - * Returne true if the Image of this ImageCapabilities is or can be + * Returns true if the Image of this ImageCapabilities is or can be * accelerated. - * + * * @return true, if the Image of this ImageCapabilities is or can be - * accelerated, false otherwise. + * accelerated, false otherwise. */ public boolean isAccelerated() { return accelerated; } /** - * Returns true if this ImageCapabilities applies to - * the VolatileImage which can lose its surfaces. + * Returns true if this ImageCapabilities applies to the VolatileImage which + * can lose its surfaces. * - * @return true if this ImageCapabilities applies to - * the VolatileImage which can lose its surfaces, - * false otherwise. + * @return true if this ImageCapabilities applies to the VolatileImage which + * can lose its surfaces, false otherwise. */ public boolean isTrueVolatile() { return true; diff --git a/awt/java/awt/Insets.java b/awt/java/awt/Insets.java index 61f3fd8bf28f1..04f198c619647 100644 --- a/awt/java/awt/Insets.java +++ b/awt/java/awt/Insets.java @@ -18,44 +18,49 @@ * @author Dmitry A. Durnev * @version $Revision$ */ + package java.awt; import java.io.Serializable; import org.apache.harmony.misc.HashCode; - /** - * The Insets class represents the borders of a container. - * This class describes the space that a container should leave at each edge: - * the top, the bottom, the right side, and the left side. - * The space can be filled with a border, a blank space, or a title. + * The Insets class represents the borders of a container. This class describes + * the space that a container should leave at each edge: the top, the bottom, + * the right side, and the left side. The space can be filled with a border, a + * blank space, or a title. + * + * @since Android 1.0 */ public class Insets implements Cloneable, Serializable { - /** The Constant serialVersionUID. */ + /** + * The Constant serialVersionUID. + */ private static final long serialVersionUID = -2272572637695466749L; /** - * The top inset indicates the size of the space added to the - * top of the rectangle. + * The top inset indicates the size of the space added to the top of the + * rectangle. */ public int top; - /** - * The left inset indicates the size of the space added to the - * left side of the rectangle. + /** + * The left inset indicates the size of the space added to the left side of + * the rectangle. */ public int left; - /** - * The bottom inset indicates the size of the space subtracted from - * the bottom of the rectangle. + /** + * The bottom inset indicates the size of the space subtracted from the + * bottom of the rectangle. */ public int bottom; - /** The right inset indicates the size of the space subtracted from - * the right side of the rectangle. + /** + * The right inset indicates the size of the space subtracted from the right + * side of the rectangle. */ public int right; @@ -63,10 +68,14 @@ public class Insets implements Cloneable, Serializable { * Instantiates a new Inset object with the specified top, left, bottom, * right parameters. * - * @param top the top inset. - * @param left the left inset. - * @param bottom the bottom inset. - * @param right the right inset. + * @param top + * the top inset. + * @param left + * the left inset. + * @param bottom + * the bottom inset. + * @param right + * the right inset. */ public Insets(int top, int left, int bottom, int right) { setValues(top, left, bottom, right); @@ -100,10 +109,10 @@ public class Insets implements Cloneable, Serializable { /** * Checks if this Insets object is equal to the specified object. * - * @param o the Object to be compared. - * - * @return true, if the object is an Insets object whose data values - * are equal to those of this object, false otherwise. + * @param o + * the Object to be compared. + * @return true, if the object is an Insets object whose data values are + * equal to those of this object, false otherwise. */ @Override public boolean equals(Object o) { @@ -111,9 +120,8 @@ public class Insets implements Cloneable, Serializable { return true; } if (o instanceof Insets) { - Insets i = (Insets) o; - return ((i.left == left) && (i.bottom == bottom) && - (i.right == right) && (i.top == top)); + Insets i = (Insets)o; + return ((i.left == left) && (i.bottom == bottom) && (i.right == right) && (i.top == top)); } return false; } @@ -125,23 +133,26 @@ public class Insets implements Cloneable, Serializable { */ @Override public String toString() { - /* The format is based on 1.5 release behavior - * which can be revealed by the following code: - * System.out.println(new Insets(1, 2, 3, 4)); + /* + * The format is based on 1.5 release behavior which can be revealed by + * the following code: System.out.println(new Insets(1, 2, 3, 4)); */ - return (getClass().getName() + - "[left=" + left + ",top=" + top + //$NON-NLS-1$ //$NON-NLS-2$ - ",right=" + right + ",bottom=" + bottom + "]"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + return (getClass().getName() + "[left=" + left + ",top=" + top + //$NON-NLS-1$ //$NON-NLS-2$ + ",right=" + right + ",bottom=" + bottom + "]"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ } /** * Sets top, left, bottom, and right insets to the specified values. * - * @param top the top inset. - * @param left the left inset. - * @param bottom the bottom inset. - * @param right the right inset. + * @param top + * the top inset. + * @param left + * the left inset. + * @param bottom + * the bottom inset. + * @param right + * the right inset. */ public void set(int top, int left, int bottom, int right) { setValues(top, left, bottom, right); @@ -150,10 +161,14 @@ public class Insets implements Cloneable, Serializable { /** * Sets the values. * - * @param top the top - * @param left the left - * @param bottom the bottom - * @param right the right + * @param top + * the top. + * @param left + * the left. + * @param bottom + * the bottom. + * @param right + * the right. */ private void setValues(int top, int left, int bottom, int right) { this.top = top; @@ -162,4 +177,3 @@ public class Insets implements Cloneable, Serializable { this.right = right; } } - diff --git a/awt/java/awt/ItemSelectable.java b/awt/java/awt/ItemSelectable.java index a46364b031c07..212cf709e5232 100644 --- a/awt/java/awt/ItemSelectable.java +++ b/awt/java/awt/ItemSelectable.java @@ -18,35 +18,41 @@ * @author Michael Danilov * @version $Revision$ */ + package java.awt; import java.awt.event.ItemListener; /** * The ItemSelectable interface represents a set of items which can be selected. + * + * @since Android 1.0 */ public interface ItemSelectable { /** - * Adds an ItemListener for receiving item events when the state of an item - * is changed by the user. + * Adds an ItemListener for receiving item events when the state of an item + * is changed by the user. * - * @param l the ItemListener. + * @param l + * the ItemListener. */ public void addItemListener(ItemListener l); /** - * Gets an array of the selected objects or null if there is no selected object. - * - * @return an array of the selected objects or null if there is no selected + * Gets an array of the selected objects or null if there is no selected * object. + * + * @return an array of the selected objects or null if there is no selected + * object. */ public Object[] getSelectedObjects(); /** * Removes the specified ItemListener. * - * @param l the ItemListener which will be removed. + * @param l + * the ItemListener which will be removed. */ public void removeItemListener(ItemListener l); diff --git a/awt/java/awt/MenuComponent.java b/awt/java/awt/MenuComponent.java index 9eb4f3d8d21e1..9c1b120e66779 100644 --- a/awt/java/awt/MenuComponent.java +++ b/awt/java/awt/MenuComponent.java @@ -21,8 +21,7 @@ import java.awt.event.FocusListener; import java.awt.event.MouseEvent; import java.awt.peer.MenuComponentPeer; import java.io.Serializable; -import java.util.Locale; -//import javax.accessibility.Accessible; +import java.util.Locale; //import javax.accessibility.Accessible; //import javax.accessibility.AccessibleComponent; //import javax.accessibility.AccessibleContext; //import javax.accessibility.AccessibleRole; @@ -31,371 +30,172 @@ import java.util.Locale; import org.apache.harmony.awt.gl.MultiRectArea; import org.apache.harmony.awt.state.MenuItemState; import org.apache.harmony.awt.state.MenuState; +import org.apache.harmony.luni.util.NotImplementedException; /** - * The MenuComponent abstract class is the superclass for menu - * components. Menu components receive and process AWT events. + * The MenuComponent abstract class is the superclass for menu components. Menu + * components receive and process AWT events. + * + * @since Android 1.0 */ public abstract class MenuComponent implements Serializable { - - /** The Constant serialVersionUID. */ + + /** + * The Constant serialVersionUID. + */ private static final long serialVersionUID = -4536902356223894379L; - /** The name. */ + /** + * The name. + */ private String name; - /** The font. */ + /** + * The font. + */ private Font font; - /** The parent. */ + /** + * The parent. + */ MenuContainer parent; - /** The deprecated event handler. */ + /** + * The deprecated event handler. + */ boolean deprecatedEventHandler = true; - /** The selected item index. */ + /** + * The selected item index. + */ private int selectedItemIndex; - //???AWT: private AccessibleContext accessibleContext; + // ???AWT: private AccessibleContext accessibleContext; - /** The toolkit. */ + /** + * The toolkit. + */ final Toolkit toolkit = Toolkit.getDefaultToolkit(); - //???AWT + // ???AWT /* - protected abstract class AccessibleAWTMenuComponent extends AccessibleContext implements - Serializable, AccessibleComponent, AccessibleSelection { - private static final long serialVersionUID = -4269533416223798698L; - - public void addFocusListener(FocusListener listener) { - } - - public boolean contains(Point pt) { - return false; - } - - public Accessible getAccessibleAt(Point pt) { - return null; - } - - public Color getBackground() { - return null; - } - - public Rectangle getBounds() { - return null; - } - - public Cursor getCursor() { - return null; - } - - public Font getFont() { - return MenuComponent.this.getFont(); - } - - public FontMetrics getFontMetrics(Font font) { - return null; - } - - public Color getForeground() { - return null; - } - - public Point getLocation() { - return null; - } - - public Point getLocationOnScreen() { - return null; - } - - public Dimension getSize() { - return null; - } - - public boolean isEnabled() { - return true; // always enabled - } - - public boolean isFocusTraversable() { - return true; // always focus traversable - } - - public boolean isShowing() { - return true;// always showing - } - - public boolean isVisible() { - return true; // always visible - } - - public void removeFocusListener(FocusListener listener) { - } - - public void requestFocus() { - } - - public void setBackground(Color color) { - } - - public void setBounds(Rectangle rect) { - } - - public void setCursor(Cursor cursor) { - } - - public void setEnabled(boolean enabled) { - } - - public void setFont(Font font) { - MenuComponent.this.setFont(font); - } - - public void setForeground(Color color) { - } - - public void setLocation(Point pt) { - } - - public void setSize(Dimension pt) { - } - - public void setVisible(boolean visible) { - } - - public void addAccessibleSelection(int index) { - } - - public void clearAccessibleSelection() { - } - - public Accessible getAccessibleSelection(int index) { - return null; - } - - public int getAccessibleSelectionCount() { - return 0; - } - - public boolean isAccessibleChildSelected(int index) { - return false; - } - - public void removeAccessibleSelection(int index) { - } - - public void selectAllAccessibleSelection() { - } - - @Override - public Accessible getAccessibleChild(int index) { - return null; - } - - @Override - public int getAccessibleChildrenCount() { - return 0; - } - - @Override - public AccessibleComponent getAccessibleComponent() { - return this; - } - - @Override - public String getAccessibleDescription() { - return super.getAccessibleDescription(); - } - - @Override - public int getAccessibleIndexInParent() { - toolkit.lockAWT(); - try { - Accessible aParent = getAccessibleParent(); - int aIndex = -1; - if (aParent instanceof MenuComponent) { - MenuComponent parent = (MenuComponent) aParent; - int count = parent.getItemCount(); - for (int i = 0; i < count; i++) { - MenuComponent comp = parent.getItem(i); - if (comp instanceof Accessible) { - aIndex++; - if (comp == MenuComponent.this) { - return aIndex; - } - } - } - } - return -1; - } finally { - toolkit.unlockAWT(); - } - } - - @Override - public String getAccessibleName() { - return super.getAccessibleName(); - } - - @Override - public Accessible getAccessibleParent() { - toolkit.lockAWT(); - try { - Accessible aParent = super.getAccessibleParent(); - if (aParent != null) { - return aParent; - } - MenuContainer parent = getParent(); - if (parent instanceof Accessible) { - aParent = (Accessible) parent; - } - return aParent; - } finally { - toolkit.unlockAWT(); - } - } - - @Override - public AccessibleRole getAccessibleRole() { - return AccessibleRole.AWT_COMPONENT; - } - - @Override - public AccessibleSelection getAccessibleSelection() { - return this; - } - - @Override - public AccessibleStateSet getAccessibleStateSet() { - return new AccessibleStateSet(); - } - - @Override - public Locale getLocale() { - return Locale.getDefault(); - } - } - */ - - /** - * The accessor to MenuComponent internal state, - * utilized by the visual theme. - * - * @throws HeadlessException the headless exception - */ - //???AWT + * protected abstract class AccessibleAWTMenuComponent extends + * AccessibleContext implements Serializable, AccessibleComponent, + * AccessibleSelection { private static final long serialVersionUID = + * -4269533416223798698L; public void addFocusListener(FocusListener + * listener) { } public boolean contains(Point pt) { return false; } public + * Accessible getAccessibleAt(Point pt) { return null; } public Color + * getBackground() { return null; } public Rectangle getBounds() { return + * null; } public Cursor getCursor() { return null; } public Font getFont() + * { return MenuComponent.this.getFont(); } public FontMetrics + * getFontMetrics(Font font) { return null; } public Color getForeground() { + * return null; } public Point getLocation() { return null; } public Point + * getLocationOnScreen() { return null; } public Dimension getSize() { + * return null; } public boolean isEnabled() { return true; // always + * enabled } public boolean isFocusTraversable() { return true; // always + * focus traversable } public boolean isShowing() { return true;// always + * showing } public boolean isVisible() { return true; // always visible } + * public void removeFocusListener(FocusListener listener) { } public void + * requestFocus() { } public void setBackground(Color color) { } public void + * setBounds(Rectangle rect) { } public void setCursor(Cursor cursor) { } + * public void setEnabled(boolean enabled) { } public void setFont(Font + * font) { MenuComponent.this.setFont(font); } public void + * setForeground(Color color) { } public void setLocation(Point pt) { } + * public void setSize(Dimension pt) { } public void setVisible(boolean + * visible) { } public void addAccessibleSelection(int index) { } public + * void clearAccessibleSelection() { } public Accessible + * getAccessibleSelection(int index) { return null; } public int + * getAccessibleSelectionCount() { return 0; } public boolean + * isAccessibleChildSelected(int index) { return false; } public void + * removeAccessibleSelection(int index) { } public void + * selectAllAccessibleSelection() { } + * @Override public Accessible getAccessibleChild(int index) { return null; + * } + * @Override public int getAccessibleChildrenCount() { return 0; } + * @Override public AccessibleComponent getAccessibleComponent() { return + * this; } + * @Override public String getAccessibleDescription() { return + * super.getAccessibleDescription(); } + * @Override public int getAccessibleIndexInParent() { toolkit.lockAWT(); + * try { Accessible aParent = getAccessibleParent(); int aIndex = -1; if + * (aParent instanceof MenuComponent) { MenuComponent parent = + * (MenuComponent) aParent; int count = parent.getItemCount(); for (int i = + * 0; i < count; i++) { MenuComponent comp = parent.getItem(i); if (comp + * instanceof Accessible) { aIndex++; if (comp == MenuComponent.this) { + * return aIndex; } } } } return -1; } finally { toolkit.unlockAWT(); } } + * @Override public String getAccessibleName() { return + * super.getAccessibleName(); } + * @Override public Accessible getAccessibleParent() { toolkit.lockAWT(); + * try { Accessible aParent = super.getAccessibleParent(); if (aParent != + * null) { return aParent; } MenuContainer parent = getParent(); if (parent + * instanceof Accessible) { aParent = (Accessible) parent; } return aParent; + * } finally { toolkit.unlockAWT(); } } + * @Override public AccessibleRole getAccessibleRole() { return + * AccessibleRole.AWT_COMPONENT; } + * @Override public AccessibleSelection getAccessibleSelection() { return + * this; } + * @Override public AccessibleStateSet getAccessibleStateSet() { return new + * AccessibleStateSet(); } + * @Override public Locale getLocale() { return Locale.getDefault(); } } + */ + + /** + * The accessor to MenuComponent internal state, utilized by the visual + * theme. + * + * @throws HeadlessException + * the headless exception. + */ + // ???AWT /* - class State implements MenuState { - Dimension size; - - Dimension getSize() { - if (size == null) { - calculate(); - } - return size; - } - - public int getWidth() { - return getSize().width; - } - - public int getHeight() { - return getSize().height; - } - - public Font getFont() { - return MenuComponent.this.getFont(); - } - - public int getItemCount() { - return MenuComponent.this.getItemCount(); - } - - public int getSelectedItemIndex() { - return MenuComponent.this.getSelectedItemIndex(); - } - - public boolean isFontSet() { - return MenuComponent.this.isFontSet(); - } - - @SuppressWarnings("deprecation") - public FontMetrics getFontMetrics(Font f) { - return MenuComponent.this.toolkit.getFontMetrics(f); - } - - public Point getLocation() { - return MenuComponent.this.getLocation(); - } - - public MenuItemState getItem(int index) { - MenuItem item = MenuComponent.this.getItem(index); - return item.itemState; - } - - public void setSize(int w, int h) { - this.size = new Dimension(w, h); - } - - void calculate() { - size = new Dimension(); - size.setSize(toolkit.theme.calculateMenuSize(this)); - } - - void reset() { - for (int i = 0; i < getItemCount(); i++) { - ((MenuItem.State) getItem(i)).reset(); - } - } - - } - */ - - /** - * Pop-up box for menu. It transfers the paint events, - * keyboard and mouse events to the menu component itself - */ - //???AWT + * class State implements MenuState { Dimension size; Dimension getSize() { + * if (size == null) { calculate(); } return size; } public int getWidth() { + * return getSize().width; } public int getHeight() { return + * getSize().height; } public Font getFont() { return + * MenuComponent.this.getFont(); } public int getItemCount() { return + * MenuComponent.this.getItemCount(); } public int getSelectedItemIndex() { + * return MenuComponent.this.getSelectedItemIndex(); } public boolean + * isFontSet() { return MenuComponent.this.isFontSet(); } + * @SuppressWarnings("deprecation") public FontMetrics getFontMetrics(Font + * f) { return MenuComponent.this.toolkit.getFontMetrics(f); } public Point + * getLocation() { return MenuComponent.this.getLocation(); } public + * MenuItemState getItem(int index) { MenuItem item = + * MenuComponent.this.getItem(index); return item.itemState; } public void + * setSize(int w, int h) { this.size = new Dimension(w, h); } void + * calculate() { size = new Dimension(); + * size.setSize(toolkit.theme.calculateMenuSize(this)); } void reset() { for + * (int i = 0; i < getItemCount(); i++) { ((MenuItem.State) + * getItem(i)).reset(); } } } + */ + + /** + * Pop-up box for menu. It transfers the paint events, keyboard and mouse + * events to the menu component itself. + */ + // ???AWT /* - class MenuPopupBox extends PopupBox { - private final Point lastMousePos = new Point(); - - @Override - boolean isMenu() { - return true; - } - - @Override - void paint(Graphics gr) { - MenuComponent.this.paint(gr); - } - - @Override - void onKeyEvent(int eventId, int vKey, long when, int modifiers) { - MenuComponent.this.onKeyEvent(eventId, vKey, when, modifiers); - } + * class MenuPopupBox extends PopupBox { private final Point lastMousePos = + * new Point(); + * @Override boolean isMenu() { return true; } + * @Override void paint(Graphics gr) { MenuComponent.this.paint(gr); } + * @Override void onKeyEvent(int eventId, int vKey, long when, int + * modifiers) { MenuComponent.this.onKeyEvent(eventId, vKey, when, + * modifiers); } + * @Override void onMouseEvent(int eventId, Point where, int mouseButton, + * long when, int modifiers, int wheelRotation) { // prevent conflict of + * mouse and keyboard // when sub-menu drops down due to keyboard navigation + * if (lastMousePos.equals(where) && (eventId == MouseEvent.MOUSE_MOVED || + * eventId == MouseEvent.MOUSE_ENTERED)) { return; } + * lastMousePos.setLocation(where); MenuComponent.this.onMouseEvent(eventId, + * where, mouseButton, when, modifiers); } } + */ - @Override - void onMouseEvent(int eventId, Point where, int mouseButton, long when, int modifiers, - int wheelRotation) { - // prevent conflict of mouse and keyboard - // when sub-menu drops down due to keyboard navigation - if (lastMousePos.equals(where) - && (eventId == MouseEvent.MOUSE_MOVED || eventId == MouseEvent.MOUSE_ENTERED)) { - return; - } - lastMousePos.setLocation(where); - MenuComponent.this.onMouseEvent(eventId, where, mouseButton, when, modifiers); - } - } - */ - /** * Instantiates a new MenuComponent object. * - * @throws HeadlessException if the graphical interface - * environment can't support MenuComponents + * @throws HeadlessException + * if the graphical interface environment can't support + * MenuComponents. */ public MenuComponent() throws HeadlessException { toolkit.lockAWT(); @@ -438,9 +238,9 @@ public abstract class MenuComponent implements Serializable { } /** - * Gets the Parent menu Container . + * Gets the parent menu container. * - * @return the parent + * @return the parent. */ public MenuContainer getParent() { toolkit.lockAWT(); @@ -454,7 +254,8 @@ public abstract class MenuComponent implements Serializable { /** * Sets the name of the MenuComponent to the specified string. * - * @param name the new name of the MenuComponent object. + * @param name + * the new name of the MenuComponent object. */ public void setName(String name) { toolkit.lockAWT(); @@ -468,7 +269,8 @@ public abstract class MenuComponent implements Serializable { /** * Dispatches AWT event. * - * @param event the AWTEvent. + * @param event + * the AWTEvent. */ public final void dispatchEvent(AWTEvent event) { toolkit.lockAWT(); @@ -485,7 +287,8 @@ public abstract class MenuComponent implements Serializable { /** * Post deprecated event. * - * @param event the event + * @param event + * the event. */ void postDeprecatedEvent(AWTEvent event) { Event evt = event.getEvent(); @@ -495,11 +298,12 @@ public abstract class MenuComponent implements Serializable { } /** - * Gets the peer of the MenuComponent; an application must not - * use this method directly. + * Gets the peer of the MenuComponent; an application must not use this + * method directly. * * @return the MenuComponentPeer object. - * + * @throws NotImplementedException + * if this method is not implemented by a subclass. * @deprecated an application must not use this method directly. */ @Deprecated @@ -527,11 +331,9 @@ public abstract class MenuComponent implements Serializable { /** * Posts the Event to the MenuComponent. * - * @param e the Event. - * - * @return true, if the event is posted successfully; - * false otherwise. - * + * @param e + * the Event. + * @return true, if the event is posted successfully, false otherwise. * @deprecated Replaced dispatchEvent method. */ @SuppressWarnings("deprecation") @@ -551,8 +353,7 @@ public abstract class MenuComponent implements Serializable { /** * Returns the string representation of the MenuComponent state. * - * @return returns the string representation of the MenuComponent - * state. + * @return returns the string representation of the MenuComponent state. */ protected String paramString() { toolkit.lockAWT(); @@ -563,20 +364,13 @@ public abstract class MenuComponent implements Serializable { } } - //???AWT + // ???AWT /* - public AccessibleContext getAccessibleContext() { - toolkit.lockAWT(); - try { - if (accessibleContext == null) { - accessibleContext = createAccessibleContext(); - } - return accessibleContext; - } finally { - toolkit.unlockAWT(); - } - } - */ + * public AccessibleContext getAccessibleContext() { toolkit.lockAWT(); try + * { if (accessibleContext == null) { accessibleContext = + * createAccessibleContext(); } return accessibleContext; } finally { + * toolkit.unlockAWT(); } } + */ /** * Gets the font of the MenuComponent object. @@ -605,13 +399,13 @@ public abstract class MenuComponent implements Serializable { */ boolean isFontSet() { return font != null - || ((parent instanceof MenuComponent) && ((MenuComponent) parent).isFontSet()); + || ((parent instanceof MenuComponent) && ((MenuComponent)parent).isFontSet()); } /** * Checks for default font. * - * @return true, if successful + * @return true, if successful. */ boolean hasDefaultFont() { return false; @@ -620,7 +414,8 @@ public abstract class MenuComponent implements Serializable { /** * Processes an AWTEevent on this menu component. * - * @param event the AWTEvent. + * @param event + * the AWTEvent. */ protected void processEvent(AWTEvent event) { toolkit.lockAWT(); @@ -645,7 +440,8 @@ public abstract class MenuComponent implements Serializable { /** * Sets the Font for this MenuComponent object. * - * @param font the new Font to be used for this MenuComponent. + * @param font + * the new Font to be used for this MenuComponent. */ public void setFont(Font font) { toolkit.lockAWT(); @@ -659,7 +455,8 @@ public abstract class MenuComponent implements Serializable { /** * Sets the parent. * - * @param parent the new parent + * @param parent + * the new parent. */ void setParent(MenuContainer parent) { this.parent = parent; @@ -668,7 +465,7 @@ public abstract class MenuComponent implements Serializable { /** * Gets the location. * - * @return the location + * @return the location. */ Point getLocation() { // to be overridden @@ -678,7 +475,7 @@ public abstract class MenuComponent implements Serializable { /** * Gets the width. * - * @return the width + * @return the width. */ int getWidth() { // to be overridden @@ -688,7 +485,7 @@ public abstract class MenuComponent implements Serializable { /** * Gets the height. * - * @return the height + * @return the height. */ int getHeight() { // to be overridden @@ -698,31 +495,19 @@ public abstract class MenuComponent implements Serializable { /** * Recursively find the menu item for a menu shortcut. * - * @param gr the gr - * - * @return the menu item; - * or null if the item is not available for this shortcut + * @param gr + * the gr. + * @return the menu item; or null if the item is not available for this + * shortcut. */ - //???AWT + // ???AWT /* - MenuItem getShortcutMenuItemImpl(MenuShortcut ms) { - if (ms == null) { - return null; - } - for (int i = 0; i < getItemCount(); i++) { - MenuItem mi = getItem(i); - if (mi instanceof Menu) { - mi = ((Menu) mi).getShortcutMenuItemImpl(ms); - if (mi != null) { - return mi; - } - } else if (ms.equals(mi.getShortcut())) { - return mi; - } - } - return null; - } - */ + * MenuItem getShortcutMenuItemImpl(MenuShortcut ms) { if (ms == null) { + * return null; } for (int i = 0; i < getItemCount(); i++) { MenuItem mi = + * getItem(i); if (mi instanceof Menu) { mi = ((Menu) + * mi).getShortcutMenuItemImpl(ms); if (mi != null) { return mi; } } else if + * (ms.equals(mi.getShortcut())) { return mi; } } return null; } + */ void paint(Graphics gr) { gr.setColor(Color.LIGHT_GRAY); @@ -733,11 +518,16 @@ public abstract class MenuComponent implements Serializable { /** * Mouse events handler. * - * @param eventId - one of the MouseEvent.MOUSE_* constants - * @param where - mouse location - * @param mouseButton - mouse button that was pressed or released - * @param when - event time - * @param modifiers - input event modifiers + * @param eventId + * one of the MouseEvent.MOUSE_* constants. + * @param where + * mouse location. + * @param mouseButton + * mouse button that was pressed or released. + * @param when + * event time. + * @param modifiers + * input event modifiers. */ void onMouseEvent(int eventId, Point where, int mouseButton, long when, int modifiers) { // to be overridden @@ -746,159 +536,109 @@ public abstract class MenuComponent implements Serializable { /** * Keyboard event handler. * - * @param eventId - one of the KeyEvent.KEY_* constants - * @param vKey - the key code - * @param when - event time - * @param modifiers - input event modifiers + * @param eventId + * one of the KeyEvent.KEY_* constants. + * @param vKey + * the key code. + * @param when + * event time. + * @param modifiers + * input event modifiers. */ void onKeyEvent(int eventId, int vKey, long when, int modifiers) { // to be overridden } /** - * Post the ActionEvent or ItemEvent, - * depending on type of the menu item. + * Post the ActionEvent or ItemEvent, depending on type of the menu item. * - * @param index the index - * - * @return the item rect + * @param index + * the index. + * @return the item rect. */ - //???AWT + // ???AWT /* - void fireItemAction(int item, long when, int modifiers) { - MenuItem mi = getItem(item); - mi.itemSelected(when, modifiers); - } - - MenuItem getItem(int index) { - // to be overridden - return null; - } - - int getItemCount() { - return 0; - } - */ + * void fireItemAction(int item, long when, int modifiers) { MenuItem mi = + * getItem(item); mi.itemSelected(when, modifiers); } MenuItem getItem(int + * index) { // to be overridden return null; } int getItemCount() { return + * 0; } + */ /** - * @return The sub-menu of currently selecetd item, - * or null if such a sub-menu is not available + * @return The sub-menu of currently selecetd item, or null if such a + * sub-menu is not available. */ - //???AWT + // ???AWT /* - Menu getSelectedSubmenu() { - if (selectedItemIndex < 0) { - return null; - } - MenuItem item = getItem(selectedItemIndex); - return (item instanceof Menu) ? (Menu) item : null; - } - */ + * Menu getSelectedSubmenu() { if (selectedItemIndex < 0) { return null; } + * MenuItem item = getItem(selectedItemIndex); return (item instanceof Menu) + * ? (Menu) item : null; } + */ /** - * Convenience method for selectItem(index, true) + * Convenience method for selectItem(index, true). */ - //???AWT + // ???AWT /* - void selectItem(int index) { - selectItem(index, true); - } - */ + * void selectItem(int index) { selectItem(index, true); } + */ /** - * Change the selection in the menu - * @param index - new selecetd item's index - * @param showSubMenu - if new selected item has a sub-menu, - * should that sub-menu be displayed + * Change the selection in the menu. + * + * @param index + * new selecetd item's index. + * @param showSubMenu + * if new selected item has a sub-menu, should that sub-menu be + * displayed. */ - //???AWT + // ???AWT /* - void selectItem(int index, boolean showSubMenu) { - if (selectedItemIndex == index) { - return; - } - if (selectedItemIndex >= 0 && getItem(selectedItemIndex) instanceof Menu) { - ((Menu) getItem(selectedItemIndex)).hide(); - } - MultiRectArea clip = getUpdateClip(index, selectedItemIndex); - selectedItemIndex = index; - Graphics gr = getGraphics(clip); - if (gr != null) { - paint(gr); - } - if (showSubMenu) { - showSubMenu(selectedItemIndex); - } - } - */ + * void selectItem(int index, boolean showSubMenu) { if (selectedItemIndex + * == index) { return; } if (selectedItemIndex >= 0 && + * getItem(selectedItemIndex) instanceof Menu) { ((Menu) + * getItem(selectedItemIndex)).hide(); } MultiRectArea clip = + * getUpdateClip(index, selectedItemIndex); selectedItemIndex = index; + * Graphics gr = getGraphics(clip); if (gr != null) { paint(gr); } if + * (showSubMenu) { showSubMenu(selectedItemIndex); } } + */ /** * Change the selected item to the next one in the requested direction * moving cyclically, skipping separators - * @param forward - the direction to move the selection - * @param showSubMenu - if new selected item has a sub-menu, - * should that sub-menu be displayed + * + * @param forward + * the direction to move the selection. + * @param showSubMenu + * if new selected item has a sub-menu, should that sub-menu be + * displayed. */ - //???AWT + // ???AWT /* - void selectNextItem(boolean forward, boolean showSubMenu) { - int selected = getSelectedItemIndex(); - int count = getItemCount(); - if (count == 0) { - return; - } - if (selected < 0) { - selected = (forward ? count - 1 : 0); - } - int i = selected; - do { - i = (forward ? (i + 1) : (i + count - 1)) % count; - i %= count; - MenuItem item = getItem(i); - if (!"-".equals(item.getLabel())) { //$NON-NLS-1$ - selectItem(i, showSubMenu); - return; - } - } while (i != selected); - } - - - void showSubMenu(int index) { - if ((index < 0) || !isActive()) { - return; - } - MenuItem item = getItem(index); - if (item instanceof Menu) { - Menu menu = ((Menu) getItem(index)); - if (menu.getItemCount() == 0) { - return; - } - Point location = getSubmenuLocation(index); - menu.show(location.x, location.y, false); - } - } - */ + * void selectNextItem(boolean forward, boolean showSubMenu) { int selected + * = getSelectedItemIndex(); int count = getItemCount(); if (count == 0) { + * return; } if (selected < 0) { selected = (forward ? count - 1 : 0); } int + * i = selected; do { i = (forward ? (i + 1) : (i + count - 1)) % count; i + * %= count; MenuItem item = getItem(i); if (!"-".equals(item.getLabel())) { + * //$NON-NLS-1$ selectItem(i, showSubMenu); return; } } while (i != + * selected); } void showSubMenu(int index) { if ((index < 0) || + * !isActive()) { return; } MenuItem item = getItem(index); if (item + * instanceof Menu) { Menu menu = ((Menu) getItem(index)); if + * (menu.getItemCount() == 0) { return; } Point location = + * getSubmenuLocation(index); menu.show(location.x, location.y, false); } } + */ /** - * @return - the menu bar which is the root of crrent menu's hierarchy; - * or null if the hierarchy root is not a menu bar + * @return the menu bar which is the root of current menu's hierarchy; or + * null if the hierarchy root is not a menu bar. */ - //???AWT + // ???AWT /* - MenuBar getMenuBar() { - if (parent instanceof MenuBar) { - return (MenuBar) parent; - } - if (parent instanceof MenuComponent) { - return ((MenuComponent) parent).getMenuBar(); - } - return null; - } - - PopupBox getPopupBox() { - return null; - } - */ + * MenuBar getMenuBar() { if (parent instanceof MenuBar) { return (MenuBar) + * parent; } if (parent instanceof MenuComponent) { return ((MenuComponent) + * parent).getMenuBar(); } return null; } PopupBox getPopupBox() { return + * null; } + */ Rectangle getItemRect(int index) { // to be overridden @@ -906,13 +646,14 @@ public abstract class MenuComponent implements Serializable { } /** - * Determine the clip region when menu selection is changed - * from index1 to index2. - * - * @param index1 - old selected intem - * @param index2 - new selected item + * Determine the clip region when menu selection is changed from index1 to + * index2. * - * @return - the region to repaint + * @param index1 + * old selected item. + * @param index2 + * new selected item. + * @return the region to repaint. */ final MultiRectArea getUpdateClip(int index1, int index2) { MultiRectArea clip = new MultiRectArea(); @@ -928,9 +669,9 @@ public abstract class MenuComponent implements Serializable { /** * Gets the submenu location. * - * @param index the index - * - * @return the submenu location + * @param index + * the index. + * @return the submenu location. */ Point getSubmenuLocation(int index) { // to be overridden @@ -940,7 +681,7 @@ public abstract class MenuComponent implements Serializable { /** * Gets the selected item index. * - * @return the selected item index + * @return the selected item index. */ int getSelectedItemIndex() { return selectedItemIndex; @@ -952,14 +693,15 @@ public abstract class MenuComponent implements Serializable { void hide() { selectedItemIndex = -1; if (parent instanceof MenuComponent) { - ((MenuComponent) parent).itemHidden(this); + ((MenuComponent)parent).itemHidden(this); } } /** * Item hidden. * - * @param mc the mc + * @param mc + * the mc. */ void itemHidden(MenuComponent mc) { // to be overridden @@ -968,7 +710,7 @@ public abstract class MenuComponent implements Serializable { /** * Checks if is visible. * - * @return true, if is visible + * @return true, if is visible. */ boolean isVisible() { return true; @@ -977,7 +719,7 @@ public abstract class MenuComponent implements Serializable { /** * Checks if is active. * - * @return true, if is active + * @return true, if is active. */ boolean isActive() { return true; @@ -987,14 +729,16 @@ public abstract class MenuComponent implements Serializable { * Hide all menu hierarchy. */ void endMenu() { - //???AWT: toolkit.dispatcher.popupDispatcher.deactivateAll(); + // ???AWT: toolkit.dispatcher.popupDispatcher.deactivateAll(); } /** * Handle the mouse click or Enter key event on a menu's item. * - * @param when - the event time - * @param modifiers - input event modifiers + * @param when + * the event time. + * @param modifiers + * input event modifiers. */ void itemSelected(long when, int modifiers) { endMenu(); @@ -1003,14 +747,14 @@ public abstract class MenuComponent implements Serializable { /** * Auto name. * - * @return the string + * @return the string. */ String autoName() { String name = getClass().getName(); if (name.indexOf("$") != -1) { //$NON-NLS-1$ return null; } - //???AWT: int number = toolkit.autoNumber.nextMenuComponent++; + // ???AWT: int number = toolkit.autoNumber.nextMenuComponent++; int number = 0; name = name.substring(name.lastIndexOf(".") + 1) + Integer.toString(number); //$NON-NLS-1$ return name; @@ -1019,10 +763,10 @@ public abstract class MenuComponent implements Serializable { /** * Creates the Graphics object for the pop-up box of this menu component. * - * @param clip - the clip to set on this Graphics - * - * @return - the created Graphics object, - * or null if such object is not available. + * @param clip + * the clip to set on this Graphics. + * @return the created Graphics object, or null if such object is not + * available. */ Graphics getGraphics(MultiRectArea clip) { // to be overridden @@ -1030,12 +774,10 @@ public abstract class MenuComponent implements Serializable { } /** - * @return accessible context specific for particular menu component + * @return accessible context specific for particular menu component. */ - //???AWT + // ???AWT /* - AccessibleContext createAccessibleContext() { - return null; - } - */ + * AccessibleContext createAccessibleContext() { return null; } + */ } diff --git a/awt/java/awt/MenuContainer.java b/awt/java/awt/MenuContainer.java index 7a48f13c89297..e509a1b1b7ec6 100644 --- a/awt/java/awt/MenuContainer.java +++ b/awt/java/awt/MenuContainer.java @@ -18,17 +18,21 @@ * @author Pavel Dolgov * @version $Revision$ */ + package java.awt; /** * The MenuContainer interface represents all menu containers. + * + * @since Android 1.0 */ public interface MenuContainer { /** * Removes the specified MenuComponent from the MenuContainer. * - * @param c the MenuComponent. + * @param c + * the MenuComponent. */ public void remove(MenuComponent c); @@ -42,15 +46,12 @@ public interface MenuContainer { /** * Posts an Event. * - * @param e the Event. - * - * @return true if the event is posted successfully; - * false otherwise. - * + * @param e + * the Event. + * @return true if the event is posted successfully, false otherwise. * @deprecated Replaced by dispatchEvent method. */ @Deprecated public boolean postEvent(Event e); } - diff --git a/awt/java/awt/Paint.java b/awt/java/awt/Paint.java index f8732c8efed37..dfea3a74bfed1 100644 --- a/awt/java/awt/Paint.java +++ b/awt/java/awt/Paint.java @@ -18,6 +18,7 @@ * @author Alexey A. Petrenko * @version $Revision$ */ + package java.awt; import java.awt.geom.AffineTransform; @@ -25,28 +26,32 @@ import java.awt.geom.Rectangle2D; import java.awt.image.ColorModel; /** - * The Paint interface provides possibility of generating - * color patterns in device space for fill, draw, or stroke operations - * in a Graphics2D. + * The Paint interface provides possibility of generating color patterns in + * device space for fill, draw, or stroke operations in a Graphics2D. + * + * @since Android 1.0 */ public interface Paint extends Transparency { - + /** - * Creates the PaintContext which is used to generate color - * patterns for rendering operations of Graphics2D. - * - * @param cm the ColorModel object, or null. - * @param deviceBounds the Rectangle represents the bounding box of - * device space for the graphics rendering operations. - * @param userBounds the Rectangle represents bounding box of - * user space for the graphics rendering operations. - * @param xform the AffineTransform for translation from user space - * to device space. - * @param hints the RenderingHints preferences. + * Creates the PaintContext which is used to generate color patterns for + * rendering operations of Graphics2D. * + * @param cm + * the ColorModel object, or null. + * @param deviceBounds + * the Rectangle represents the bounding box of device space for + * the graphics rendering operations. + * @param userBounds + * the Rectangle represents bounding box of user space for the + * graphics rendering operations. + * @param xform + * the AffineTransform for translation from user space to device + * space. + * @param hints + * the RenderingHints preferences. * @return the PaintContext for generating color patterns. */ - PaintContext createContext(ColorModel cm, Rectangle deviceBounds, - Rectangle2D userBounds, AffineTransform xform, - RenderingHints hints); + PaintContext createContext(ColorModel cm, Rectangle deviceBounds, Rectangle2D userBounds, + AffineTransform xform, RenderingHints hints); } diff --git a/awt/java/awt/PaintContext.java b/awt/java/awt/PaintContext.java index 647de8bbbc889..966b6ca99e825 100644 --- a/awt/java/awt/PaintContext.java +++ b/awt/java/awt/PaintContext.java @@ -18,20 +18,22 @@ * @author Alexey A. Petrenko * @version $Revision$ */ + package java.awt; import java.awt.image.ColorModel; import java.awt.image.Raster; /** - * The PaintContext interface determines the specific environment for - * generating color patterns in device space for fill, draw, or stroke - * rendering operations using Graphics2D. This interface provides colors - * through the Raster object associated with the specific ColorModel - * for Graphics2D rendering operations. + * The PaintContext interface determines the specific environment for generating + * color patterns in device space for fill, draw, or stroke rendering operations + * using Graphics2D. This interface provides colors through the Raster object + * associated with the specific ColorModel for Graphics2D rendering operations. + * + * @since Android 1.0 */ public interface PaintContext { - + /** * Releases the resources allocated for the operation. */ @@ -45,20 +47,23 @@ public interface PaintContext { ColorModel getColorModel(); /** - * Gets the Raster which defines the colors of the specified rectangular + * Gets the Raster which defines the colors of the specified rectangular * area for Graphics2D rendering operations. * - * @param x the X coordinate of the device space area for which - * colors are generated. - * @param y the Y coordinate of the device space area for which - * colors are generated. - * @param w the width of the device space area for which - * colors are generated. - * @param h the height of the device space area for which - * colors are generated. - * - * @return the Raster object which contains the colors of the specified - * rectangular area for Graphics2D rendering operations. + * @param x + * the X coordinate of the device space area for which colors are + * generated. + * @param y + * the Y coordinate of the device space area for which colors are + * generated. + * @param w + * the width of the device space area for which colors are + * generated. + * @param h + * the height of the device space area for which colors are + * generated. + * @return the Raster object which contains the colors of the specified + * rectangular area for Graphics2D rendering operations. */ Raster getRaster(int x, int y, int w, int h); } diff --git a/awt/java/awt/Point.java b/awt/java/awt/Point.java index 99418ed8a74c4..8ec424121513a 100644 --- a/awt/java/awt/Point.java +++ b/awt/java/awt/Point.java @@ -18,28 +18,37 @@ * @author Denis M. Kishenko * @version $Revision$ */ + package java.awt; import java.awt.geom.Point2D; import java.io.Serializable; /** - * The Point class represents a point location with coordinates X, Y in - * current coordinate system. + * The Point class represents a point location with coordinates X, Y in current + * coordinate system. + * + * @since Android 1.0 */ public class Point extends Point2D implements Serializable { - /** The Constant serialVersionUID. */ + /** + * The Constant serialVersionUID. + */ private static final long serialVersionUID = -5276940640259749850L; - /** The X coordinate of Point. */ + /** + * The X coordinate of Point. + */ public int x; - - /** The Y coordinate of Point. */ + + /** + * The Y coordinate of Point. + */ public int y; /** - * Instantiates a new point with (0, O) coordinates, the origin of + * Instantiates a new point with (0, O) coordinates, the origin of * coordinate system. */ public Point() { @@ -49,18 +58,20 @@ public class Point extends Point2D implements Serializable { /** * Instantiates a new point with (x, y) coordinates. * - * @param x the X coordinate of Point. - * @param y the Y coordinate of Point. + * @param x + * the X coordinate of Point. + * @param y + * the Y coordinate of Point. */ public Point(int x, int y) { setLocation(x, y); } /** - * Instantiates a new point, giving it the same locaion as - * the parameter p. + * Instantiates a new point, giving it the same location as the parameter p. * - * @param p the Point object giving the coordinates of the new point. + * @param p + * the Point object giving the coordinates of the new point. */ public Point(Point p) { setLocation(p.x, p.y); @@ -69,12 +80,10 @@ public class Point extends Point2D implements Serializable { /** * Compares current Point with the specified object. * - * @param obj the Object to be compared. - * - * @return true, if the Object being compared is a Point - * whose coordinates are equal to the coordinates of this - * Point, otherwise false. - * + * @param obj + * the Object to be compared. + * @return true, if the Object being compared is a Point whose coordinates + * are equal to the coordinates of this Point, false otherwise. * @see java.awt.geom.Point2D#equals(Object) */ @Override @@ -103,7 +112,6 @@ public class Point extends Point2D implements Serializable { * Gets X coordinate of Point as a double. * * @return X coordinate of the point as a double. - * * @see java.awt.geom.Point2D#getX() */ @Override @@ -115,7 +123,6 @@ public class Point extends Point2D implements Serializable { * Gets Y coordinate of Point as a double. * * @return Y coordinate of the point as a double. - * * @see java.awt.geom.Point2D#getY() */ @Override @@ -135,7 +142,8 @@ public class Point extends Point2D implements Serializable { /** * Sets the location of the Point to the same coordinates as p. * - * @param p the Point that gives the new location. + * @param p + * the Point that gives the new location. */ public void setLocation(Point p) { setLocation(p.x, p.y); @@ -144,8 +152,10 @@ public class Point extends Point2D implements Serializable { /** * Sets the location of the Point to the coordinates X, Y. * - * @param x the X coordinate of the Point's new location. - * @param y the Y coordinate of the Point's new location. + * @param x + * the X coordinate of the Point's new location. + * @param y + * the Y coordinate of the Point's new location. */ public void setLocation(int x, int y) { this.x = x; @@ -155,36 +165,43 @@ public class Point extends Point2D implements Serializable { /** * Sets the location of Point to the specified double coordinates. * - * @param x the X the Point's new location. - * @param y the Y the Point's new location. - * + * @param x + * the X the Point's new location. + * @param y + * the Y the Point's new location. * @see java.awt.geom.Point2D#setLocation(double, double) */ @Override public void setLocation(double x, double y) { - x = x < Integer.MIN_VALUE ? Integer.MIN_VALUE : x > Integer.MAX_VALUE ? Integer.MAX_VALUE : x; - y = y < Integer.MIN_VALUE ? Integer.MIN_VALUE : y > Integer.MAX_VALUE ? Integer.MAX_VALUE : y; + x = x < Integer.MIN_VALUE ? Integer.MIN_VALUE : x > Integer.MAX_VALUE ? Integer.MAX_VALUE + : x; + y = y < Integer.MIN_VALUE ? Integer.MIN_VALUE : y > Integer.MAX_VALUE ? Integer.MAX_VALUE + : y; setLocation((int)Math.round(x), (int)Math.round(y)); } /** * Moves the Point to the specified (x, y) location. * - * @param x the X coordinate of the new location. - * @param y the Y coordinate of the new location. + * @param x + * the X coordinate of the new location. + * @param y + * the Y coordinate of the new location. */ public void move(int x, int y) { setLocation(x, y); } /** - * Translates current Point moving it from the position (x, y) - * to the new position given by (x+dx, x+dy) coordinates. - * - * @param dx the horizontal delta - the Point is moved to this distance along - * X axis. - * @param dy the vertical delta - the Point is moved to this distance along - * Y axis. + * Translates current Point moving it from the position (x, y) to the new + * position given by (x+dx, x+dy) coordinates. + * + * @param dx + * the horizontal delta - the Point is moved to this distance + * along X axis. + * @param dy + * the vertical delta - the Point is moved to this distance along + * Y axis. */ public void translate(int dx, int dy) { x += dx; @@ -192,4 +209,3 @@ public class Point extends Point2D implements Serializable { } } - diff --git a/awt/java/awt/Polygon.java b/awt/java/awt/Polygon.java index 6f3fc9778c918..de31eb989229f 100644 --- a/awt/java/awt/Polygon.java +++ b/awt/java/awt/Polygon.java @@ -18,6 +18,7 @@ * @author Denis M. Kishenko * @version $Revision$ */ + package java.awt; import java.awt.Point; @@ -34,57 +35,78 @@ import org.apache.harmony.awt.gl.*; import org.apache.harmony.awt.internal.nls.Messages; /** - * The Polygon class defines an closed area specified by n vertices and - * n edges. The coordinates of the vertices are specified by x, y arrays. - * The edges are the line segments from the point (x[i], y[i]) to the point - * (x[i+1], y[i+1]), for -1 < i < (n-1) plus the line segment from - * the point (x[n-1], y[n-1]) to the point (x[0], y[0]) point. - * The Polygon is empty if the number of vertices is zero. + * The Polygon class defines an closed area specified by n vertices and n edges. + * The coordinates of the vertices are specified by x, y arrays. The edges are + * the line segments from the point (x[i], y[i]) to the point (x[i+1], y[i+1]), + * for -1 < i < (n-1) plus the line segment from the point (x[n-1], y[n-1]) to + * the point (x[0], y[0]) point. The Polygon is empty if the number of vertices + * is zero. + * + * @since Android 1.0 */ public class Polygon implements Shape, Serializable { - /** The Constant serialVersionUID. */ + /** + * The Constant serialVersionUID. + */ private static final long serialVersionUID = -6460061437900069969L; - /** The points buffer capacity. */ + /** + * The points buffer capacity. + */ private static final int BUFFER_CAPACITY = 4; - - /** The number of Polygon vertices.*/ + + /** + * The number of Polygon vertices. + */ public int npoints; - - /** The array of X coordinates of the vertices. */ + + /** + * The array of X coordinates of the vertices. + */ public int[] xpoints; - - /** The array of Y coordinates of the vertices. */ + + /** + * The array of Y coordinates of the vertices. + */ public int[] ypoints; - - /** - * The smallest Rectangle that completely contains this Polygon. + + /** + * The smallest Rectangle that completely contains this Polygon. */ protected Rectangle bounds; /* - * Polygon path iterator + * Polygon path iterator */ /** * The internal Class Iterator. */ class Iterator implements PathIterator { - /** The source Polygon object. */ + /** + * The source Polygon object. + */ public Polygon p; - - /** The path iterator transformation. */ + + /** + * The path iterator transformation. + */ public AffineTransform t; - - /** The current segmenet index. */ + + /** + * The current segment index. + */ public int index; /** - * Constructs a new Polygon.Iterator for the given polygon and transformation + * Constructs a new Polygon.Iterator for the given polygon and + * transformation * - * @param at - the AffineTransform object to apply rectangle path - * @param p the p + * @param at + * the AffineTransform object to apply rectangle path. + * @param p + * the p. */ public Iterator(AffineTransform at, Polygon p) { this.p = p; @@ -148,18 +170,21 @@ public class Polygon implements Shape, Serializable { } /** - * Instantiates a new polygon with the specified number of vertices, - * and the given arrays of x, y vertex coordinates. The length of - * each coordinate array may not be less than the specified number of - * vertices but may be greater. Only the first n elements are used from - * each coordinate array. - * - * @param xpoints the array of X vertex coordinates. - * @param ypoints the array of Y vertex coordinates. - * @param npoints the number vertices of the polygon. - * @throws IndexOutOfBoundsException if the length of xpoints or ypoints - * is less than n. - * @throws NegativeArraySizeException if n is negative. + * Instantiates a new polygon with the specified number of vertices, and the + * given arrays of x, y vertex coordinates. The length of each coordinate + * array may not be less than the specified number of vertices but may be + * greater. Only the first n elements are used from each coordinate array. + * + * @param xpoints + * the array of X vertex coordinates. + * @param ypoints + * the array of Y vertex coordinates. + * @param npoints + * the number vertices of the polygon. + * @throws IndexOutOfBoundsException + * if the length of xpoints or ypoints is less than n. + * @throws NegativeArraySizeException + * if n is negative. */ public Polygon(int[] xpoints, int[] ypoints, int npoints) { if (npoints > xpoints.length || npoints > ypoints.length) { @@ -178,9 +203,9 @@ public class Polygon implements Shape, Serializable { } /** - * Resets the current Polygon to an empty Polygon. More precisely, - * the number of Polygon vertices is set to zero, but x, y coordinates - * arrays are not affected. + * Resets the current Polygon to an empty Polygon. More precisely, the + * number of Polygon vertices is set to zero, but x, y coordinates arrays + * are not affected. */ public void reset() { npoints = 0; @@ -188,21 +213,22 @@ public class Polygon implements Shape, Serializable { } /** - * Invalidates the data that depends on the vertex coordinates. - * This method should be called after direct manipulations - * of the x, y vertex coordinates arrays to avoid unpredictable - * results of methods which rely on the bounding box. + * Invalidates the data that depends on the vertex coordinates. This method + * should be called after direct manipulations of the x, y vertex + * coordinates arrays to avoid unpredictable results of methods which rely + * on the bounding box. */ public void invalidate() { bounds = null; } /** - * Adds the point to the Polygon and updates the bounding box - * accordingly. + * Adds the point to the Polygon and updates the bounding box accordingly. * - * @param px the X coordinate of the added vertex. - * @param py the Y coordinate of the added vertex. + * @param px + * the X coordinate of the added vertex. + * @param py + * the Y coordinate of the added vertex. */ public void addPoint(int px, int py) { if (npoints == xpoints.length) { @@ -222,20 +248,16 @@ public class Polygon implements Shape, Serializable { npoints++; if (bounds != null) { - bounds.setFrameFromDiagonal( - Math.min(bounds.getMinX(), px), - Math.min(bounds.getMinY(), py), - Math.max(bounds.getMaxX(), px), - Math.max(bounds.getMaxY(), py)); + bounds.setFrameFromDiagonal(Math.min(bounds.getMinX(), px), Math.min(bounds.getMinY(), + py), Math.max(bounds.getMaxX(), px), Math.max(bounds.getMaxY(), py)); } } /** - * Gets the bounding rectangle of the Polygon. The bounding rectangle - * is the smallest rectangle which contains the Polygon. + * Gets the bounding rectangle of the Polygon. The bounding rectangle is the + * smallest rectangle which contains the Polygon. * * @return the bounding rectangle of the Polygon. - * * @see java.awt.Shape#getBounds() */ public Rectangle getBounds() { @@ -270,11 +292,10 @@ public class Polygon implements Shape, Serializable { } /** - * Gets the bounding rectangle of the Polygon. The bounding rectangle - * is the smallest rectangle which contains the Polygon. + * Gets the bounding rectangle of the Polygon. The bounding rectangle is the + * smallest rectangle which contains the Polygon. * * @return the bounding rectangle of the Polygon. - * * @deprecated Use getBounds() method. */ @Deprecated @@ -283,12 +304,10 @@ public class Polygon implements Shape, Serializable { } /** - * Gets the Rectangle2D which represents Polygon bounds. - * The bounding rectangle is the smallest rectangle which contains - * the Polygon. + * Gets the Rectangle2D which represents Polygon bounds. The bounding + * rectangle is the smallest rectangle which contains the Polygon. * * @return the bounding rectangle of the Polygon. - * * @see java.awt.Shape#getBounds2D() */ public Rectangle2D getBounds2D() { @@ -296,11 +315,13 @@ public class Polygon implements Shape, Serializable { } /** - * Translates all vertices of Polygon the specified distances - * along X, Y axis. + * Translates all vertices of Polygon the specified distances along X, Y + * axis. * - * @param mx the distance to translate horizontally. - * @param my the distance to translate vertically. + * @param mx + * the distance to translate horizontally. + * @param my + * the distance to translate vertically. */ public void translate(int mx, int my) { for (int i = 0; i < npoints; i++) { @@ -313,46 +334,47 @@ public class Polygon implements Shape, Serializable { } /** - * Checks whether or not the point given by the coordinates x, y lies inside + * Checks whether or not the point given by the coordinates x, y lies inside * the Polygon. * - * @param x the X coordinate of the point to check. - * @param y the Y coordinate of the point to check. - * - * @return true, if the specified point lies inside the Polygon, - * otherwise false. - * + * @param x + * the X coordinate of the point to check. + * @param y + * the Y coordinate of the point to check. + * @return true, if the specified point lies inside the Polygon, false + * otherwise. * @deprecated Use contains(int, int) method. */ @Deprecated public boolean inside(int x, int y) { - return contains((double) x, (double) y); + return contains((double)x, (double)y); } /** - * Checks whether or not the point given by the coordinates x, y lies inside + * Checks whether or not the point given by the coordinates x, y lies inside * the Polygon. * - * @param x the X coordinate of the point to check. - * @param y the Y coordinate of the point to check. - * - * @return true, if the specified point lies inside the Polygon, - * otherwise false. + * @param x + * the X coordinate of the point to check. + * @param y + * the Y coordinate of the point to check. + * @return true, if the specified point lies inside the Polygon, false + * otherwise. */ public boolean contains(int x, int y) { - return contains((double) x, (double) y); + return contains((double)x, (double)y); } /** - * Checks whether or not the point with specified double coordinates - * lies inside the Polygon. - * - * @param x the X coordinate of the point to check. - * @param y the Y coordinate of the point to check. - * - * @return true, if the point given by the double coordinates - * lies inside the Polygon, otherwise false. - * + * Checks whether or not the point with specified double coordinates lies + * inside the Polygon. + * + * @param x + * the X coordinate of the point to check. + * @param y + * the Y coordinate of the point to check. + * @return true, if the point given by the double coordinates lies inside + * the Polygon, false otherwise. * @see java.awt.Shape#contains(double, double) */ public boolean contains(double x, double y) { @@ -360,19 +382,21 @@ public class Polygon implements Shape, Serializable { } /** - * Checks whether or not the rectangle determined by the parameters - * [x, y, width, height] lies inside the Polygon. - * - * @param x the X coordinate of the rectangles's left upper - * corner as a double. - * @param y the Y coordinate of the rectangles's left upper - * corner as a double. - * @param width the width of rectangle as a double. - * @param width the height of rectangle as a double. - * - * @return true, if the specified rectangle lies inside the Polygon, - * otherwise false. - * + * Checks whether or not the rectangle determined by the parameters [x, y, + * width, height] lies inside the Polygon. + * + * @param x + * the X coordinate of the rectangles's left upper corner as a + * double. + * @param y + * the Y coordinate of the rectangles's left upper corner as a + * double. + * @param width + * the width of rectangle as a double. + * @param height + * the height of rectangle as a double. + * @return true, if the specified rectangle lies inside the Polygon, false + * otherwise. * @see java.awt.Shape#contains(double, double, double, double) */ public boolean contains(double x, double y, double width, double height) { @@ -381,20 +405,21 @@ public class Polygon implements Shape, Serializable { } /** - * Checks whether or not the rectangle determined by the parameters - * [x, y, width, height] intersects the interior of - * the Polygon. - * - * @param x the X coordinate of the rectangles's left upper - * corner as a double. - * @param y the Y coordinate of the rectangles's left upper - * corner as a double. - * @param width the width of rectangle as a double. - * @param width the height of rectangle as a double. - * - * @return true, if the specified rectangle intersects the interior of - * the Polygon, otherwise false. - * + * Checks whether or not the rectangle determined by the parameters [x, y, + * width, height] intersects the interior of the Polygon. + * + * @param x + * the X coordinate of the rectangles's left upper corner as a + * double. + * @param y + * the Y coordinate of the rectangles's left upper corner as a + * double. + * @param width + * the width of rectangle as a double. + * @param height + * the height of rectangle as a double. + * @return true, if the specified rectangle intersects the interior of the + * Polygon, false otherwise. * @see java.awt.Shape#intersects(double, double, double, double) */ public boolean intersects(double x, double y, double width, double height) { @@ -405,11 +430,10 @@ public class Polygon implements Shape, Serializable { /** * Checks whether or not the specified rectangle lies inside the Polygon. * - * @param rect the Rectangle2D object. - * - * @return true, if the specified rectangle lies inside the Polygon, - * otherwise false. - * + * @param rect + * the Rectangle2D object. + * @return true, if the specified rectangle lies inside the Polygon, false + * otherwise. * @see java.awt.Shape#contains(java.awt.geom.Rectangle2D) */ public boolean contains(Rectangle2D rect) { @@ -419,10 +443,10 @@ public class Polygon implements Shape, Serializable { /** * Checks whether or not the specified Point lies inside the Polygon. * - * @param point the Point object. - * - * @return true, if the specified Point lies inside the Polygon, - * otherwise false. + * @param point + * the Point object. + * @return true, if the specified Point lies inside the Polygon, false + * otherwise. */ public boolean contains(Point point) { return contains(point.getX(), point.getY()); @@ -431,11 +455,10 @@ public class Polygon implements Shape, Serializable { /** * Checks whether or not the specified Point2D lies inside the Polygon. * - * @param point the Point2D object. - * - * @return true, if the specified Point2D lies inside the Polygon, - * otherwise false. - * + * @param point + * the Point2D object. + * @return true, if the specified Point2D lies inside the Polygon, false + * otherwise. * @see java.awt.Shape#contains(java.awt.geom.Point2D) */ public boolean contains(Point2D point) { @@ -443,14 +466,13 @@ public class Polygon implements Shape, Serializable { } /** - * Checks whether or not the interior of rectangle specified by - * the Rectangle2D object intersects the interior of the Polygon. - * - * @param rect the Rectangle2D object. - * - * @return true, if the Rectangle2D intersects the interior of - * the Polygon, otherwise false. + * Checks whether or not the interior of rectangle specified by the + * Rectangle2D object intersects the interior of the Polygon. * + * @param rect + * the Rectangle2D object. + * @return true, if the Rectangle2D intersects the interior of the Polygon, + * false otherwise. * @see java.awt.Shape#intersects(java.awt.geom.Rectangle2D) */ public boolean intersects(Rectangle2D rect) { @@ -458,13 +480,12 @@ public class Polygon implements Shape, Serializable { } /** - * Gets the PathIterator object which gives the coordinates of - * the polygon, transformed according to the specified AffineTransform. - * - * @param t the specified AffineTransform object, or null. + * Gets the PathIterator object which gives the coordinates of the polygon, + * transformed according to the specified AffineTransform. * + * @param t + * the specified AffineTransform object or null. * @return PathIterator object for the Polygon. - * * @see java.awt.Shape#getPathIterator(java.awt.geom.AffineTransform) */ public PathIterator getPathIterator(AffineTransform t) { @@ -472,23 +493,23 @@ public class Polygon implements Shape, Serializable { } /** - * Gets the PathIterator object which gives the coordinates of - * the polygon, transformed according to the specified AffineTransform. - * The flatness parameter is ignored. - * - * @param t the specified AffineTransform object, or null. - * @param flatness the maximum number of the control points for - * a given curve which varies from colinear before a subdivided curve - * is replaced by a straight line connecting the endpoints. - * This parameter is ignored for the Polygon class. - * + * Gets the PathIterator object which gives the coordinates of the polygon, + * transformed according to the specified AffineTransform. The flatness + * parameter is ignored. + * + * @param t + * the specified AffineTransform object or null. + * @param flatness + * the maximum number of the control points for a given curve + * which varies from colinear before a subdivided curve is + * replaced by a straight line connecting the endpoints. This + * parameter is ignored for the Polygon class. * @return PathIterator object for the Polygon. - * - * @see java.awt.Shape#getPathIterator(java.awt.geom.AffineTransform, double) + * @see java.awt.Shape#getPathIterator(java.awt.geom.AffineTransform, + * double) */ public PathIterator getPathIterator(AffineTransform t, double flatness) { return new Iterator(t, this); } } - diff --git a/awt/java/awt/Rectangle.java b/awt/java/awt/Rectangle.java index 86c4dfca0d1ee..d8ebb3ad19eb9 100644 --- a/awt/java/awt/Rectangle.java +++ b/awt/java/awt/Rectangle.java @@ -18,36 +18,48 @@ * @author Denis M. Kishenko * @version $Revision$ */ + package java.awt; import java.awt.geom.Rectangle2D; import java.io.Serializable; /** - * The Rectangle class defines the rectangular area in terms of its - * upper left corner coordinates [x,y], its width, and its height. - * A Rectangle specified by [x, y, width, height] parameters has an - * outline path with corners at [x, y], [x + width,y], [x + width,y + height], - * and [x, y + height]. - *

    - * The rectangle is empty if the width or height is negative or zero. - * In this case the isEmpty method returns true. + * The Rectangle class defines the rectangular area in terms of its upper left + * corner coordinates [x,y], its width, and its height. A Rectangle specified by + * [x, y, width, height] parameters has an outline path with corners at [x, y], + * [x + width,y], [x + width,y + height], and [x, y + height].
    + *
    + * The rectangle is empty if the width or height is negative or zero. In this + * case the isEmpty method returns true. + * + * @since Android 1.0 */ public class Rectangle extends Rectangle2D implements Shape, Serializable { - /** The Constant serialVersionUID. */ + /** + * The Constant serialVersionUID. + */ private static final long serialVersionUID = -4345857070255674764L; - /** The X coordinate of the rectangle's left upper corner. */ + /** + * The X coordinate of the rectangle's left upper corner. + */ public int x; - - /** The Y coordinate of the rectangle's left upper corner. */ + + /** + * The Y coordinate of the rectangle's left upper corner. + */ public int y; - - /** The width of rectangle. */ + + /** + * The width of rectangle. + */ public int width; - - /** The height of rectangle. */ + + /** + * The height of rectangle. + */ public int height; /** @@ -60,73 +72,82 @@ public class Rectangle extends Rectangle2D implements Shape, Serializable { /** * Instantiates a new rectangle whose upper left corner coordinates are - * given by the Point object (p.X and p.Y), and the width and - * the height are zero. + * given by the Point object (p.X and p.Y), and the width and the height are + * zero. * - * @param p the Point specifies the upper left corner coordinates of - * the rectangle. + * @param p + * the Point specifies the upper left corner coordinates of the + * rectangle. */ public Rectangle(Point p) { setBounds(p.x, p.y, 0, 0); } /** - * Instantiates a new rectangle whose upper left corner coordinates are - * given by the Point object (p.X and p.Y), and the width and the height - * are given by Dimension object (d.width and d.height). + * Instantiates a new rectangle whose upper left corner coordinates are + * given by the Point object (p.X and p.Y), and the width and the height are + * given by Dimension object (d.width and d.height). * - * @param p the Point specifies the upper left corner coordinates of - * the rectangle. - * @param d the Dimention specifies the width and the height of the rectangle. + * @param p + * the point specifies the upper left corner coordinates of the + * rectangle. + * @param d + * the dimension specifies the width and the height of the + * rectangle. */ public Rectangle(Point p, Dimension d) { setBounds(p.x, p.y, d.width, d.height); } /** - * Instantiates a new rectangle determined by the upper left corner + * Instantiates a new rectangle determined by the upper left corner * coordinates (x, y), width and height. * - * @param x the X upper left corner coordinate of the rectangle. - * @param y the Y upper left corner coordinate of the rectangle. - * @param width the width of rectangle. - * @param height the height of rectangle. + * @param x + * the X upper left corner coordinate of the rectangle. + * @param y + * the Y upper left corner coordinate of the rectangle. + * @param width + * the width of rectangle. + * @param height + * the height of rectangle. */ public Rectangle(int x, int y, int width, int height) { setBounds(x, y, width, height); } /** - * Instantiates a new rectangle with [0, 0] as its upper left - * corner coordinates and the specified width and height. + * Instantiates a new rectangle with [0, 0] as its upper left corner + * coordinates and the specified width and height. * - * @param width the width of rectangle. - * @param height the height of rectangle. + * @param width + * the width of rectangle. + * @param height + * the height of rectangle. */ public Rectangle(int width, int height) { setBounds(0, 0, width, height); } /** - * Instantiates a new rectangle with the same coordinates - * as the given source rectangle. + * Instantiates a new rectangle with the same coordinates as the given + * source rectangle. * - * @param r the Rectangle object which parameters will be used for - * instantiating a new Rectangle. + * @param r + * the Rectangle object which parameters will be used for + * instantiating a new Rectangle. */ public Rectangle(Rectangle r) { setBounds(r.x, r.y, r.width, r.height); } -/* - public Rectangle(Dimension d) { - setBounds(0, 0, d.width, d.height); - } -*/ + + /* + * public Rectangle(Dimension d) { setBounds(0, 0, d.width, d.height); } + */ /** * Gets the X coordinate of bound as a double. * * @return the X coordinate of bound as a double. - * * @see java.awt.geom.RectangularShape#getX() */ @Override @@ -138,7 +159,6 @@ public class Rectangle extends Rectangle2D implements Shape, Serializable { * Gets the Y coordinate of bound as a double. * * @return the Y coordinate of bound as a double. - * * @see java.awt.geom.RectangularShape#getY() */ @Override @@ -149,8 +169,7 @@ public class Rectangle extends Rectangle2D implements Shape, Serializable { /** * Gets the height of the rectangle as a double. * - * @return the height of the rectangle as a double. - * + * @return the height of the rectangle as a double. * @see java.awt.geom.RectangularShape#getHeight() */ @Override @@ -162,7 +181,6 @@ public class Rectangle extends Rectangle2D implements Shape, Serializable { * Gets the width of the rectangle as a double. * * @return the width of the rectangle as a double. - * * @see java.awt.geom.RectangularShape#getWidth() */ @Override @@ -171,11 +189,10 @@ public class Rectangle extends Rectangle2D implements Shape, Serializable { } /** - * Determines whether or not the rectangle is empty. The rectangle is empty if - * its width or height is negative or zero. + * Determines whether or not the rectangle is empty. The rectangle is empty + * if its width or height is negative or zero. * * @return true, if the rectangle is empty, otherwise false. - * * @see java.awt.geom.RectangularShape#isEmpty() */ @Override @@ -184,9 +201,9 @@ public class Rectangle extends Rectangle2D implements Shape, Serializable { } /** - * Gets the size of a Rectangle as Dimention object. + * Gets the size of a Rectangle as Dimension object. * - * @return a Dimention object which represents size of the rectangle. + * @return a Dimension object which represents size of the rectangle. */ public Dimension getSize() { return new Dimension(width, height); @@ -195,8 +212,10 @@ public class Rectangle extends Rectangle2D implements Shape, Serializable { /** * Sets the size of the Rectangle. * - * @param width the new width of the rectangle. - * @param height the new height of the rectangle. + * @param width + * the new width of the rectangle. + * @param height + * the new height of the rectangle. */ public void setSize(int width, int height) { this.width = width; @@ -206,7 +225,8 @@ public class Rectangle extends Rectangle2D implements Shape, Serializable { /** * Sets the size of a Rectangle specified as Dimension object. * - * @param d a Dimension object which represents new size of a rectangle. + * @param d + * a Dimension object which represents new size of a rectangle. */ public void setSize(Dimension d) { setSize(d.width, d.height); @@ -215,19 +235,21 @@ public class Rectangle extends Rectangle2D implements Shape, Serializable { /** * Gets the location of a rectangle's upper left corner as a Point object. * - * @return the Point object with coordinates equal to the upper left corner - * of the rectangle. + * @return the Point object with coordinates equal to the upper left corner + * of the rectangle. */ public Point getLocation() { return new Point(x, y); } /** - * Sets the location of the rectangle in terms of its upper left - * corner coordinates X and Y. + * Sets the location of the rectangle in terms of its upper left corner + * coordinates X and Y. * - * @param x the X coordinate of the rectangle's upper left corner. - * @param y the Y coordinate of the rectangle's upper left corner. + * @param x + * the X coordinate of the rectangle's upper left corner. + * @param y + * the Y coordinate of the rectangle's upper left corner. */ public void setLocation(int x, int y) { this.x = x; @@ -235,23 +257,25 @@ public class Rectangle extends Rectangle2D implements Shape, Serializable { } /** - * Sets the location of a rectangle using a Point object to give the + * Sets the location of a rectangle using a Point object to give the * coordinates of the upper left corner. * - * @param p the Point object which represents the new upper left corner - * coordinates of rectangle. + * @param p + * the Point object which represents the new upper left corner + * coordinates of rectangle. */ public void setLocation(Point p) { setLocation(p.x, p.y); } /** - * Moves a rectangle to the new location by moving its upper left corner - * to the point with coordinates X and Y. - * - * @param x the new X coordinate of the rectangle's upper left corner. - * @param y the new Y coordinate of the rectangle's upper left corner. + * Moves a rectangle to the new location by moving its upper left corner to + * the point with coordinates X and Y. * + * @param x + * the new X coordinate of the rectangle's upper left corner. + * @param y + * the new Y coordinate of the rectangle's upper left corner. * @deprecated Use setLocation(int, int) method. */ @Deprecated @@ -260,16 +284,19 @@ public class Rectangle extends Rectangle2D implements Shape, Serializable { } /** - * Sets the rectangle to be the nearest rectangle with integer coordinates + * Sets the rectangle to be the nearest rectangle with integer coordinates * bounding the rectangle defined by the double-valued parameters. * - * @param x the X coordinate of the upper left corner of the double-valued - * rectangle to be bounded. - * @param y the Y coordinate of the upper left corner of the double-valued - * rectangle to be bounded. - * @param width the width of the rectangle to be bounded. - * @param height the height of the rectangle to be bounded. - * + * @param x + * the X coordinate of the upper left corner of the double-valued + * rectangle to be bounded. + * @param y + * the Y coordinate of the upper left corner of the double-valued + * rectangle to be bounded. + * @param width + * the width of the rectangle to be bounded. + * @param height + * the height of the rectangle to be bounded. * @see java.awt.geom.Rectangle2D#setRect(double, double, double, double) */ @Override @@ -284,9 +311,10 @@ public class Rectangle extends Rectangle2D implements Shape, Serializable { /** * Sets a new size for the rectangle. * - * @param width the rectangle's new width. - * @param height the rectangle's new height. - * + * @param width + * the rectangle's new width. + * @param height + * the rectangle's new height. * @deprecated use the setSize(int, int) method. */ @Deprecated @@ -295,14 +323,17 @@ public class Rectangle extends Rectangle2D implements Shape, Serializable { } /** - * Resets the bounds of a rectangle to the specified x, y, width and height + * Resets the bounds of a rectangle to the specified x, y, width and height * parameters. * - * @param x the new X coordinate of the upper left corner. - * @param y the new Y coordinate of the upper left corner. - * @param width the new width of rectangle. - * @param height the new height of rectangle. - * + * @param x + * the new X coordinate of the upper left corner. + * @param y + * the new Y coordinate of the upper left corner. + * @param width + * the new width of rectangle. + * @param height + * the new height of rectangle. * @deprecated use setBounds(int, int, int, int) method */ @Deprecated @@ -312,10 +343,9 @@ public class Rectangle extends Rectangle2D implements Shape, Serializable { /** * Gets bounds of the rectangle as a new Rectangle object. - * - * @return the Rectangle object with the same bounds as - * the original rectangle. * + * @return the Rectangle object with the same bounds as the original + * rectangle. * @see java.awt.geom.RectangularShape#getBounds() */ @Override @@ -325,10 +355,9 @@ public class Rectangle extends Rectangle2D implements Shape, Serializable { /** * Gets the bounds of the original rectangle as a Rectangle2D object. - * - * @return the Rectangle2D object which represents the bounds of - * the original rectangle. * + * @return the Rectangle2D object which represents the bounds of the + * original rectangle. * @see java.awt.geom.Rectangle2D#getBounds2D() */ @Override @@ -337,13 +366,17 @@ public class Rectangle extends Rectangle2D implements Shape, Serializable { } /** - * Sets the bounds of a rectangle to the specified x, y, width, and height + * Sets the bounds of a rectangle to the specified x, y, width, and height * parameters. * - * @param x the X coordinate of the upper left corner. - * @param y the Y coordinate of the upper left corner. - * @param width the width of rectangle. - * @param height the height of rectangle. + * @param x + * the X coordinate of the upper left corner. + * @param y + * the Y coordinate of the upper left corner. + * @param width + * the width of rectangle. + * @param height + * the height of rectangle. */ public void setBounds(int x, int y, int width, int height) { this.x = x; @@ -353,25 +386,26 @@ public class Rectangle extends Rectangle2D implements Shape, Serializable { } /** - * Sets the bounds of the rectangle to match the bounds of the - * Rectangle object sent as a parameter. + * Sets the bounds of the rectangle to match the bounds of the Rectangle + * object sent as a parameter. * - * @param r the Rectangle object which specifies the new bounds. + * @param r + * the Rectangle object which specifies the new bounds. */ public void setBounds(Rectangle r) { setBounds(r.x, r.y, r.width, r.height); } /** - * Enlarges the rectangle by moving each corner outward from the - * center by a distance of dx horizonally and a distance of dy - * vertically. Specifically, changes a rectangle with - * [x, y, width, height] parameters to - * a rectangle with [x-dx, y-dy, width+2*dx, height+2*dy] - * parameters. - * - * @param dx the horizontal distance to move each corner coordinate. - * @param dy the vertical distance to move each corner coordinate. + * Enlarges the rectangle by moving each corner outward from the center by a + * distance of dx horizonally and a distance of dy vertically. Specifically, + * changes a rectangle with [x, y, width, height] parameters to a rectangle + * with [x-dx, y-dy, width+2*dx, height+2*dy] parameters. + * + * @param dx + * the horizontal distance to move each corner coordinate. + * @param dy + * the vertical distance to move each corner coordinate. */ public void grow(int dx, int dy) { x -= dx; @@ -381,11 +415,13 @@ public class Rectangle extends Rectangle2D implements Shape, Serializable { } /** - * Moves a rectangle a distance of mx along the x coordinate axis - * and a distance of my along y coordinate axis. + * Moves a rectangle a distance of mx along the x coordinate axis and a + * distance of my along y coordinate axis. * - * @param mx the horizontal translation increment. - * @param my the vertical translation increment. + * @param mx + * the horizontal translation increment. + * @param my + * the vertical translation increment. */ public void translate(int mx, int my) { x += mx; @@ -395,8 +431,12 @@ public class Rectangle extends Rectangle2D implements Shape, Serializable { /** * Enlarges the rectangle to cover the specified point. * - * @param px the X coordinate of the new point to be covered by the rectangle. - * @param py the Y coordinate of the new point to be covered by the rectangle. + * @param px + * the X coordinate of the new point to be covered by the + * rectangle. + * @param py + * the Y coordinate of the new point to be covered by the + * rectangle. */ public void add(int px, int py) { int x1 = Math.min(x, px); @@ -407,11 +447,12 @@ public class Rectangle extends Rectangle2D implements Shape, Serializable { } /** - * Enlarges the rectangle to cover the specified point with the - * new point given as a Point object. + * Enlarges the rectangle to cover the specified point with the new point + * given as a Point object. * - * @param p the Point object that specifies the new point to - * be covered by the rectangle. + * @param p + * the Point object that specifies the new point to be covered by + * the rectangle. */ public void add(Point p) { add(p.x, p.y); @@ -421,7 +462,8 @@ public class Rectangle extends Rectangle2D implements Shape, Serializable { * Adds a new rectangle to the original rectangle, the result is an union of * the specified specified rectangle and original rectangle. * - * @param r the Rectangle which is added to the original rectangle. + * @param r + * the Rectangle which is added to the original rectangle. */ public void add(Rectangle r) { int x1 = Math.min(x, r.x); @@ -432,14 +474,15 @@ public class Rectangle extends Rectangle2D implements Shape, Serializable { } /** - * Determines whether or not the point with specified coordinates [px, py] + * Determines whether or not the point with specified coordinates [px, py] * is within the bounds of the rectangle. * - * @param px the X coordinate of point. - * @param py the Y coordinate of point. - * - * @return true, if the point with specified coordinates [px, py] is - * within the bounds of the rectangle, otherwise false. + * @param px + * the X coordinate of point. + * @param py + * the Y coordinate of point. + * @return true, if the point with specified coordinates [px, py] is within + * the bounds of the rectangle, false otherwise. */ public boolean contains(int px, int py) { if (isEmpty()) { @@ -454,29 +497,32 @@ public class Rectangle extends Rectangle2D implements Shape, Serializable { } /** - * Determines whether or not the point given as a Point object - * is within the bounds of the rectangle. - * - * @param p the Point object + * Determines whether or not the point given as a Point object is within the + * bounds of the rectangle. * - * @return true, if the point p is within the bounds of the - * rectangle, otherwise false. + * @param p + * the Point object + * @return true, if the point p is within the bounds of the rectangle, + * otherwise false. */ public boolean contains(Point p) { return contains(p.x, p.y); } /** - * Determines whether or not the rectangle specified by [rx, ry, rw, rh] + * Determines whether or not the rectangle specified by [rx, ry, rw, rh] * parameters is located inside the original rectangle. * - * @param rx the X coordinate of the rectangle to compare. - * @param ry the Y coordinate of the rectangle to compare. - * @param rw the width of the rectangle to compare. - * @param rh the height of the rectangle to compare. - * + * @param rx + * the X coordinate of the rectangle to compare. + * @param ry + * the Y coordinate of the rectangle to compare. + * @param rw + * the width of the rectangle to compare. + * @param rh + * the height of the rectangle to compare. * @return true, if a rectangle with [rx, ry, rw, rh] parameters is entirely - * contained in the original rectangle, otherwise false. + * contained in the original rectangle, false otherwise. */ public boolean contains(int rx, int ry, int rw, int rh) { return contains(rx, ry) && contains(rx + rw - 1, ry + rh - 1); @@ -486,25 +532,25 @@ public class Rectangle extends Rectangle2D implements Shape, Serializable { * Compares whether or not the rectangle specified by the Rectangle object * is located inside the original rectangle. * - * @param r the Rectangle object. - * + * @param r + * the Rectangle object. * @return true, if the rectangle specified by Rectangle object is entirely - * contained in the original rectangle, otherwise false. + * contained in the original rectangle, false otherwise. */ public boolean contains(Rectangle r) { return contains(r.x, r.y, r.width, r.height); } /** - * Compares whether or not a point with specified coordinates [px, py] belongs - * to a rectangle. - * - * @param px the X coordinate of a point. - * @param py the Y coordinate of a point. - * - * @return true, if a point with specified coordinates [px, py] belongs - * to a rectangle, otherwise false. + * Compares whether or not a point with specified coordinates [px, py] + * belongs to a rectangle. * + * @param px + * the X coordinate of a point. + * @param py + * the Y coordinate of a point. + * @return true, if a point with specified coordinates [px, py] belongs to a + * rectangle, otherwise false. * @deprecated use contains(int, int) method. */ @Deprecated @@ -513,20 +559,19 @@ public class Rectangle extends Rectangle2D implements Shape, Serializable { } /** - * Returns the intersection of the original rectangle with the - * specified Rectangle2D. - * - * @param r the Rectangle2D object. - * - * @return the Rectangle2D object that is the result of intersecting - * the original rectangle with the specified Rectangle2D. + * Returns the intersection of the original rectangle with the specified + * Rectangle2D. * + * @param r + * the Rectangle2D object. + * @return the Rectangle2D object that is the result of intersecting the + * original rectangle with the specified Rectangle2D. * @see java.awt.geom.Rectangle2D#createIntersection(java.awt.geom.Rectangle2D) */ @Override public Rectangle2D createIntersection(Rectangle2D r) { if (r instanceof Rectangle) { - return intersection((Rectangle) r); + return intersection((Rectangle)r); } Rectangle2D dst = new Rectangle2D.Double(); Rectangle2D.intersect(this, r, dst); @@ -534,14 +579,13 @@ public class Rectangle extends Rectangle2D implements Shape, Serializable { } /** - * Returns the intersection of the original rectangle with the - * specified rectangle. An empty rectangle is returned if there is no - * intersection. - * - * @param r the Rectangle object. + * Returns the intersection of the original rectangle with the specified + * rectangle. An empty rectangle is returned if there is no intersection. * - * @return the Rectangle object is result of the original rectangle with the - * specified rectangle. + * @param r + * the Rectangle object. + * @return the Rectangle object is result of the original rectangle with the + * specified rectangle. */ public Rectangle intersection(Rectangle r) { int x1 = Math.max(x, r.x); @@ -552,39 +596,38 @@ public class Rectangle extends Rectangle2D implements Shape, Serializable { } /** - * Determines whether or not the original rectangle intersects - * the specified rectangle. + * Determines whether or not the original rectangle intersects the specified + * rectangle. * - * @param r the Rectangle object. - * - * @return true, if the two rectangles overlap; otherwise false. + * @param r + * the Rectangle object. + * @return true, if the two rectangles overlap, false otherwise. */ public boolean intersects(Rectangle r) { return !intersection(r).isEmpty(); } /** - * Determines where the specified Point is located with respect to - * the rectangle. This method computes whether the point is to the - * right or to the left of the rectangle and whether it is above - * or below the rectangle, and packs the result into an int by - * using a binary OR operation with the following masks: + * Determines where the specified Point is located with respect to the + * rectangle. This method computes whether the point is to the right or to + * the left of the rectangle and whether it is above or below the rectangle, + * and packs the result into an integer by using a binary OR operation with + * the following masks: *
      *
    • Rectangle2D.OUT_LEFT
    • *
    • Rectangle2D.OUT_TOP
    • *
    • Rectangle2D.OUT_RIGHT
    • *
    • Rectangle2D.OUT_BOTTOM
    • *
    - * - * If the rectangle is empty, all masks are set, and if the - * point is inside the rectangle, none are set. - * - * @param px the X coordinate of the specified point. - * @param py the Y coordinate of the specified point. - * - * @return the location of the Point relative to the rectangle - * as the result of logical OR operation with all out masks. - * + * If the rectangle is empty, all masks are set, and if the point is inside + * the rectangle, none are set. + * + * @param px + * the X coordinate of the specified point. + * @param py + * the Y coordinate of the specified point. + * @return the location of the Point relative to the rectangle as the result + * of logical OR operation with all out masks. * @see java.awt.geom.Rectangle2D#outcode(double, double) */ @Override @@ -593,23 +636,19 @@ public class Rectangle extends Rectangle2D implements Shape, Serializable { if (width <= 0) { code |= OUT_LEFT | OUT_RIGHT; - } else - if (px < x) { - code |= OUT_LEFT; - } else - if (px > x + width) { - code |= OUT_RIGHT; - } + } else if (px < x) { + code |= OUT_LEFT; + } else if (px > x + width) { + code |= OUT_RIGHT; + } if (height <= 0) { code |= OUT_TOP | OUT_BOTTOM; - } else - if (py < y) { - code |= OUT_TOP; - } else - if (py > y + height) { - code |= OUT_BOTTOM; - } + } else if (py < y) { + code |= OUT_TOP; + } else if (py > y + height) { + code |= OUT_BOTTOM; + } return code; } @@ -617,10 +656,9 @@ public class Rectangle extends Rectangle2D implements Shape, Serializable { /** * Enlarges the rectangle to cover the specified Rectangle2D. * - * @param r the Rectangle2D object. - * + * @param r + * the Rectangle2D object. * @return the union of the original and the specified Rectangle2D. - * * @see java.awt.geom.Rectangle2D#createUnion(java.awt.geom.Rectangle2D) */ @Override @@ -636,8 +674,8 @@ public class Rectangle extends Rectangle2D implements Shape, Serializable { /** * Enlarges the rectangle to cover the specified rectangle. * - * @param r the Rectangle. - * + * @param r + * the Rectangle. * @return the union of the original and the specified rectangle. */ public Rectangle union(Rectangle r) { @@ -649,11 +687,10 @@ public class Rectangle extends Rectangle2D implements Shape, Serializable { /** * Compares the original Rectangle with the specified object. * - * @param obj the specified Object for comparison. - * - * @return true, if the specified Object is a rectangle with the - * same dimensions as the original rectangle, otherwise false. - * + * @param obj + * the specified Object for comparison. + * @return true, if the specified Object is a rectangle with the same + * dimensions as the original rectangle, false otherwise. * @see java.awt.geom.Rectangle2D#equals(Object) */ @Override @@ -669,18 +706,18 @@ public class Rectangle extends Rectangle2D implements Shape, Serializable { } /** - * Returns a string representation of the rectangle; the string contains - * [x, y, width, height] parameters of the rectangle. + * Returns a string representation of the rectangle; the string contains [x, + * y, width, height] parameters of the rectangle. * * @return the string representation of the rectangle. */ @Override public String toString() { - // The output format based on 1.5 release behaviour. It could be obtained in the following way + // The output format based on 1.5 release behaviour. It could be + // obtained in the following way // System.out.println(new Rectangle().toString()) return getClass().getName() + "[x=" + x + ",y=" + y + //$NON-NLS-1$ //$NON-NLS-2$ - ",width=" + width + ",height=" + height + "]"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + ",width=" + width + ",height=" + height + "]"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ } } - diff --git a/awt/java/awt/RenderingHints.java b/awt/java/awt/RenderingHints.java index 495788490ac36..acf6fa15de07d 100644 --- a/awt/java/awt/RenderingHints.java +++ b/awt/java/awt/RenderingHints.java @@ -18,6 +18,7 @@ * @author Alexey A. Petrenko * @version $Revision$ */ + package java.awt; import java.util.Collection; @@ -27,224 +28,219 @@ import java.util.Map; import java.util.Set; /** - * The RenderingHints class represents preferences for the rendering algorithms. - * The preferences are arbitrary and can be specified by Map objects or by - * key-value pairs. + * The RenderingHints class represents preferences for the rendering algorithms. + * The preferences are arbitrary and can be specified by Map objects or by + * key-value pairs. + * + * @since Android 1.0 */ public class RenderingHints implements Map, Cloneable { - + /** - * The Constant KEY_ALPHA_INTERPOLATION - alpha interpolation rendering - * hint key. + * The Constant KEY_ALPHA_INTERPOLATION - alpha interpolation rendering hint + * key. */ public static final Key KEY_ALPHA_INTERPOLATION = new KeyImpl(1); - - /** + + /** * The Constant VALUE_ALPHA_INTERPOLATION_DEFAULT - alpha interpolation * rendering hint value. */ - public static final Object VALUE_ALPHA_INTERPOLATION_DEFAULT = new KeyValue(KEY_ALPHA_INTERPOLATION); - - /** + public static final Object VALUE_ALPHA_INTERPOLATION_DEFAULT = new KeyValue( + KEY_ALPHA_INTERPOLATION); + + /** * The Constant VALUE_ALPHA_INTERPOLATION_SPEED - alpha interpolation * rendering hint value. */ - public static final Object VALUE_ALPHA_INTERPOLATION_SPEED = new KeyValue(KEY_ALPHA_INTERPOLATION); - - /** + public static final Object VALUE_ALPHA_INTERPOLATION_SPEED = new KeyValue( + KEY_ALPHA_INTERPOLATION); + + /** * The Constant VALUE_ALPHA_INTERPOLATION_QUALITY - alpha interpolation * rendering hint value. */ - public static final Object VALUE_ALPHA_INTERPOLATION_QUALITY = new KeyValue(KEY_ALPHA_INTERPOLATION); + public static final Object VALUE_ALPHA_INTERPOLATION_QUALITY = new KeyValue( + KEY_ALPHA_INTERPOLATION); - /** - * The Constant KEY_ANTIALIASING - antialiasing rendering - * hint key. + /** + * The Constant KEY_ANTIALIASING - antialiasing rendering hint key. */ public static final Key KEY_ANTIALIASING = new KeyImpl(2); - + /** - * The Constant VALUE_ANTIALIAS_DEFAULT - antialiasing - * rendering hint value. + * The Constant VALUE_ANTIALIAS_DEFAULT - antialiasing rendering hint value. */ public static final Object VALUE_ANTIALIAS_DEFAULT = new KeyValue(KEY_ANTIALIASING); - - /** - * The Constant VALUE_ANTIALIAS_ON - antialiasing - * rendering hint value. + + /** + * The Constant VALUE_ANTIALIAS_ON - antialiasing rendering hint value. */ public static final Object VALUE_ANTIALIAS_ON = new KeyValue(KEY_ANTIALIASING); - + /** - * The Constant VALUE_ANTIALIAS_OFF - antialiasing - * rendering hint value. + * The Constant VALUE_ANTIALIAS_OFF - antialiasing rendering hint value. */ public static final Object VALUE_ANTIALIAS_OFF = new KeyValue(KEY_ANTIALIASING); - /** - * The Constant KEY_COLOR_RENDERING - color rendering - * hint key. + /** + * The Constant KEY_COLOR_RENDERING - color rendering hint key. */ public static final Key KEY_COLOR_RENDERING = new KeyImpl(3); - + /** - * The Constant VALUE_COLOR_RENDER_DEFAULT - color - * rendering hint value. + * The Constant VALUE_COLOR_RENDER_DEFAULT - color rendering hint value. */ public static final Object VALUE_COLOR_RENDER_DEFAULT = new KeyValue(KEY_COLOR_RENDERING); - - /** - * The Constant VALUE_COLOR_RENDER_SPEED - color - * rendering hint value. + + /** + * The Constant VALUE_COLOR_RENDER_SPEED - color rendering hint value. */ public static final Object VALUE_COLOR_RENDER_SPEED = new KeyValue(KEY_COLOR_RENDERING); - - /** - * The Constant VALUE_COLOR_RENDER_QUALITY - color - * rendering hint value. + + /** + * The Constant VALUE_COLOR_RENDER_QUALITY - color rendering hint value. */ public static final Object VALUE_COLOR_RENDER_QUALITY = new KeyValue(KEY_COLOR_RENDERING); /** - * The Constant KEY_DITHERING - dithering - * rendering hint key. + * The Constant KEY_DITHERING - dithering rendering hint key. */ public static final Key KEY_DITHERING = new KeyImpl(4); - + /** - * The Constant VALUE_DITHER_DEFAULT - dithering - * rendering hint value. + * The Constant VALUE_DITHER_DEFAULT - dithering rendering hint value. */ public static final Object VALUE_DITHER_DEFAULT = new KeyValue(KEY_DITHERING); - - /** - * The Constant VALUE_DITHER_DISABLE - dithering - * rendering hint value. + + /** + * The Constant VALUE_DITHER_DISABLE - dithering rendering hint value. */ public static final Object VALUE_DITHER_DISABLE = new KeyValue(KEY_DITHERING); - - /** - * The Constant VALUE_DITHER_DISABLE - dithering - * rendering hint value. + + /** + * The Constant VALUE_DITHER_DISABLE - dithering rendering hint value. */ public static final Object VALUE_DITHER_ENABLE = new KeyValue(KEY_DITHERING); - /** - * The Constant KEY_FRACTIONALMETRICS - fractional metrics - * rendering hint key. + /** + * The Constant KEY_FRACTIONALMETRICS - fractional metrics rendering hint + * key. */ public static final Key KEY_FRACTIONALMETRICS = new KeyImpl(5); - + /** * The Constant VALUE_FRACTIONALMETRICS_DEFAULT - fractional metrics * rendering hint value. */ public static final Object VALUE_FRACTIONALMETRICS_DEFAULT = new KeyValue(KEY_FRACTIONALMETRICS); - + /** - * The Constant VALUE_FRACTIONALMETRICS_ON - fractional metrics - * rendering hint value. + * The Constant VALUE_FRACTIONALMETRICS_ON - fractional metrics rendering + * hint value. */ public static final Object VALUE_FRACTIONALMETRICS_ON = new KeyValue(KEY_FRACTIONALMETRICS); - + /** - * The Constant VALUE_FRACTIONALMETRICS_OFF - fractional metrics - * rendering hint value. + * The Constant VALUE_FRACTIONALMETRICS_OFF - fractional metrics rendering + * hint value. */ public static final Object VALUE_FRACTIONALMETRICS_OFF = new KeyValue(KEY_FRACTIONALMETRICS); - /** - * The Constant KEY_INTERPOLATION - interpolation - * rendering hint key. + /** + * The Constant KEY_INTERPOLATION - interpolation rendering hint key. */ public static final Key KEY_INTERPOLATION = new KeyImpl(6); - - /** - * The Constant VALUE_INTERPOLATION_BICUBIC - interpolation - * rendering hint value. + + /** + * The Constant VALUE_INTERPOLATION_BICUBIC - interpolation rendering hint + * value. */ public static final Object VALUE_INTERPOLATION_BICUBIC = new KeyValue(KEY_INTERPOLATION); - + /** - * The Constant VALUE_INTERPOLATION_BILINEAR - interpolation - * rendering hint value. + * The Constant VALUE_INTERPOLATION_BILINEAR - interpolation rendering hint + * value. */ public static final Object VALUE_INTERPOLATION_BILINEAR = new KeyValue(KEY_INTERPOLATION); - - /** The Constant VALUE_INTERPOLATION_NEAREST_NEIGHBOR - interpolation + + /** + * The Constant VALUE_INTERPOLATION_NEAREST_NEIGHBOR - interpolation * rendering hint value. */ - public static final Object VALUE_INTERPOLATION_NEAREST_NEIGHBOR = new KeyValue(KEY_INTERPOLATION); + public static final Object VALUE_INTERPOLATION_NEAREST_NEIGHBOR = new KeyValue( + KEY_INTERPOLATION); /** * The Constant KEY_RENDERING - rendering hint key. */ public static final Key KEY_RENDERING = new KeyImpl(7); - - /** - * The Constant VALUE_RENDER_DEFAULT - rendering hint value. + + /** + * The Constant VALUE_RENDER_DEFAULT - rendering hint value. */ public static final Object VALUE_RENDER_DEFAULT = new KeyValue(KEY_RENDERING); - - /** - * The Constant VALUE_RENDER_SPEED - rendering hint value. + + /** + * The Constant VALUE_RENDER_SPEED - rendering hint value. */ public static final Object VALUE_RENDER_SPEED = new KeyValue(KEY_RENDERING); - - /** - * The Constant VALUE_RENDER_QUALITY - rendering hint value. + + /** + * The Constant VALUE_RENDER_QUALITY - rendering hint value. */ public static final Object VALUE_RENDER_QUALITY = new KeyValue(KEY_RENDERING); - /** - * The Constant KEY_STROKE_CONTROL - stroke control hint key. + /** + * The Constant KEY_STROKE_CONTROL - stroke control hint key. */ public static final Key KEY_STROKE_CONTROL = new KeyImpl(8); - - /** - * The Constant VALUE_STROKE_DEFAULT - stroke hint value. + + /** + * The Constant VALUE_STROKE_DEFAULT - stroke hint value. */ public static final Object VALUE_STROKE_DEFAULT = new KeyValue(KEY_STROKE_CONTROL); - - /** - * The Constant VALUE_STROKE_NORMALIZE - stroke hint value. + + /** + * The Constant VALUE_STROKE_NORMALIZE - stroke hint value. */ public static final Object VALUE_STROKE_NORMALIZE = new KeyValue(KEY_STROKE_CONTROL); - - /** - * The Constant VALUE_STROKE_PURE - stroke hint value. + + /** + * The Constant VALUE_STROKE_PURE - stroke hint value. */ public static final Object VALUE_STROKE_PURE = new KeyValue(KEY_STROKE_CONTROL); - /** - * The Constant KEY_TEXT_ANTIALIASING - text antialiasing hint key. + /** + * The Constant KEY_TEXT_ANTIALIASING - text antialiasing hint key. */ public static final Key KEY_TEXT_ANTIALIASING = new KeyImpl(9); - + /** - * The Constant VALUE_TEXT_ANTIALIAS_DEFAULT - text antialiasing hint key. + * The Constant VALUE_TEXT_ANTIALIAS_DEFAULT - text antialiasing hint key. */ public static final Object VALUE_TEXT_ANTIALIAS_DEFAULT = new KeyValue(KEY_TEXT_ANTIALIASING); - + /** * The Constant VALUE_TEXT_ANTIALIAS_ON - text antialiasing hint key. */ public static final Object VALUE_TEXT_ANTIALIAS_ON = new KeyValue(KEY_TEXT_ANTIALIASING); - + /** - * The Constant VALUE_TEXT_ANTIALIAS_OFF - text antialiasing hint key. + * The Constant VALUE_TEXT_ANTIALIAS_OFF - text antialiasing hint key. */ public static final Object VALUE_TEXT_ANTIALIAS_OFF = new KeyValue(KEY_TEXT_ANTIALIASING); /** The map. */ private HashMap map = new HashMap(); - + /** - * Instantiates a new rendering hints object from specified Map object with defined - * key/value pairs or null for empty RenderingHints. + * Instantiates a new rendering hints object from specified Map object with + * defined key/value pairs or null for empty RenderingHints. * - * @param map the Map object with defined key/value pairs or null for - * empty RenderingHints. + * @param map + * the Map object with defined key/value pairs or null for empty + * RenderingHints. */ public RenderingHints(Map map) { super(); @@ -254,10 +250,13 @@ public class RenderingHints implements Map, Cloneable { } /** - * Instantiates a new rendering hints object with the specified key/value pair. + * Instantiates a new rendering hints object with the specified key/value + * pair. * - * @param key the key of hint property. - * @param value the value of hint property. + * @param key + * the key of hint property. + * @param value + * the value of hint property. */ public RenderingHints(Key key, Object value) { super(); @@ -268,21 +267,22 @@ public class RenderingHints implements Map, Cloneable { * Adds the properties represented by key/value pairs from the specified * RenderingHints object to current object. * - * @param hints the RenderingHints to be added. + * @param hints + * the RenderingHints to be added. */ public void add(RenderingHints hints) { map.putAll(hints.map); } /** - * Puts the specified value to the specified key. Neither the key nor - * the value can be null. - * - * @param key the rendering hint key. - * @param value the rendering hint value. + * Puts the specified value to the specified key. Neither the key nor the + * value can be null. * + * @param key + * the rendering hint key. + * @param value + * the rendering hint value. * @return the previous rendering hint value assigned to the key or null. - * */ public Object put(Object key, Object value) { if (!((Key)key).isCompatibleValue(value)) { @@ -293,13 +293,13 @@ public class RenderingHints implements Map, Cloneable { } /** - * Removes the specified key and corresponding value from - * the RenderingHints object. + * Removes the specified key and corresponding value from the RenderingHints + * object. * - * @param key the specified hint key to be removed. - * - * @return the object of previous rendering hint value which is - * assigned to the specified key, or null. + * @param key + * the specified hint key to be removed. + * @return the object of previous rendering hint value which is assigned to + * the specified key, or null. */ public Object remove(Object key) { return map.remove(key); @@ -308,8 +308,8 @@ public class RenderingHints implements Map, Cloneable { /** * Gets the value assigned to the specified key. * - * @param key the rendering hint key. - * + * @param key + * the rendering hint key. * @return the object assigned to the specified key. */ public Object get(Object key) { @@ -319,7 +319,7 @@ public class RenderingHints implements Map, Cloneable { /** * Returns a set of rendering hints keys for current RenderingHints object. * - * @return the set of rendering hints keys. + * @return the set of rendering hints keys. */ public Set keySet() { return map.keySet(); @@ -336,23 +336,23 @@ public class RenderingHints implements Map, Cloneable { } /** - * Puts all of the preferences from the specified Map into - * the current RenderingHints object. These mappings replace - * all existing preferences. + * Puts all of the preferences from the specified Map into the current + * RenderingHints object. These mappings replace all existing preferences. * - * @param m the specified Map of preferences. + * @param m + * the specified Map of preferences. */ public void putAll(Map m) { if (m instanceof RenderingHints) { - map.putAll(((RenderingHints) m).map); + map.putAll(((RenderingHints)m).map); } else { Set entries = m.entrySet(); - if (entries != null){ + if (entries != null) { Iterator it = entries.iterator(); while (it.hasNext()) { - Map.Entry entry = (Map.Entry) it.next(); - Key key = (Key) entry.getKey(); + Map.Entry entry = (Map.Entry)it.next(); + Key key = (Key)entry.getKey(); Object val = entry.getValue(); put(key, val); } @@ -361,7 +361,8 @@ public class RenderingHints implements Map, Cloneable { } /** - * Returns a Collection of values contained in current RenderingHints object. + * Returns a Collection of values contained in current RenderingHints + * object. * * @return the Collection of RenderingHints's values. */ @@ -373,10 +374,10 @@ public class RenderingHints implements Map, Cloneable { * Checks whether or not current RenderingHints object contains at least one * the value which is equal to the specified Object. * - * @param value the specified Object. - * + * @param value + * the specified Object. * @return true, if the specified object is assigned to at least one - * RenderingHint's key, false otherwise. + * RenderingHint's key, false otherwise. */ public boolean containsValue(Object value) { return map.containsValue(value); @@ -386,11 +387,10 @@ public class RenderingHints implements Map, Cloneable { * Checks whether or not current RenderingHints object contains the key * which is equal to the specified Object. * - * @param key the specified Object. - * + * @param key + * the specified Object. * @return true, if the RenderingHints object contains the specified Object - * as a key, false otherwise. - * + * as a key, false otherwise. */ public boolean containsKey(Object key) { if (key == null) { @@ -401,8 +401,8 @@ public class RenderingHints implements Map, Cloneable { } /** - * Checks whether or not the RenderingHints object contains any - * key/value pairs. + * Checks whether or not the RenderingHints object contains any key/value + * pairs. * * @return true, if the RenderingHints object is empty, false otherwise. */ @@ -429,11 +429,10 @@ public class RenderingHints implements Map, Cloneable { /** * Compares the RenderingHints object with the specified object. * - * @param o the specified Object to be compaired. - * - * @return true, if the Object is a Map whose key/value pairs - * match this RenderingHints' key/value pairs, - * false otherwise. + * @param o + * the specified Object to be compared. + * @return true, if the Object is a Map whose key/value pairs match this + * RenderingHints' key/value pairs, false otherwise. */ @Override public boolean equals(Object o) { @@ -452,7 +451,7 @@ public class RenderingHints implements Map, Cloneable { Key key = (Key)it.next(); Object v1 = get(key); Object v2 = m.get(key); - if (!(v1==null?v2==null:v1.equals(v2))) { + if (!(v1 == null ? v2 == null : v1.equals(v2))) { return false; } } @@ -485,28 +484,30 @@ public class RenderingHints implements Map, Cloneable { /** * Returns the string representation of the RenderingHints object. * - * @return the String object which represents RenderingHints object. + * @return the String object which represents RenderingHints object. */ @Override public String toString() { - return "RenderingHints["+map.toString()+"]"; //$NON-NLS-1$ //$NON-NLS-2$ + return "RenderingHints[" + map.toString() + "]"; //$NON-NLS-1$ //$NON-NLS-2$ } /** - * The RenderingHints.Key class is abstract and defines a base type for - * all RenderingHints keys. + * The RenderingHints.Key class is abstract and defines a base type for all + * RenderingHints keys. + * + * @since Android 1.0 */ public abstract static class Key { - + /** The key. */ private final int key; /** - * Instantiates a new key with unique int identifier. - * No two objects of the same subclass with the same integer key - * can be instantiated. + * Instantiates a new key with unique integer identifier. No two objects + * of the same subclass with the same integer key can be instantiated. * - * @param key the unique key. + * @param key + * the unique key. */ protected Key(int key) { this.key = key; @@ -515,10 +516,10 @@ public class RenderingHints implements Map, Cloneable { /** * Compares the Key object with the specified object. * - * @param o the specified Object to be compaired. - * - * @return true, if the Key is equal to the specified object, - * false otherwise. + * @param o + * the specified Object to be compared. + * @return true, if the Key is equal to the specified object, false + * otherwise. */ @Override public final boolean equals(Object o) { @@ -536,11 +537,11 @@ public class RenderingHints implements Map, Cloneable { } /** - * Returns int unique key with which this Key object has been + * Returns integer unique key with which this Key object has been * instantiated. * - * @return the int unique key with which this Key object has been - * instantiated. + * @return the integer unique key with which this Key object has been + * instantiated. */ protected final int intKey() { return key; @@ -549,10 +550,10 @@ public class RenderingHints implements Map, Cloneable { /** * Checks whether or not specified value is compatible with the Key. * - * @param val the Object. - * + * @param val + * the Object. * @return true, if the specified value is compatible with the Key, - * false otherwise. + * false otherwise. */ public abstract boolean isCompatibleValue(Object val); } @@ -563,9 +564,10 @@ public class RenderingHints implements Map, Cloneable { private static class KeyImpl extends Key { /** - * Instantiates a new key impl. + * Instantiates a new key implementation. * - * @param key the key + * @param key + * the key. */ protected KeyImpl(int key) { super(key); @@ -585,14 +587,17 @@ public class RenderingHints implements Map, Cloneable { * Private class KeyValue is used as value for Key class instance. */ private static class KeyValue { - - /** The key. */ + + /** + * The key. + */ private final Key key; /** * Instantiates a new key value. * - * @param key the key + * @param key + * the key. */ protected KeyValue(Key key) { this.key = key; diff --git a/awt/java/awt/Shape.java b/awt/java/awt/Shape.java index 3dbad25a84bee..59bc623b8161c 100644 --- a/awt/java/awt/Shape.java +++ b/awt/java/awt/Shape.java @@ -18,6 +18,7 @@ * @author Alexey A. Petrenko * @version $Revision$ */ + package java.awt; import java.awt.geom.AffineTransform; @@ -26,137 +27,136 @@ import java.awt.geom.Point2D; import java.awt.geom.Rectangle2D; /** - * The Shape interface defines a geometric shape defined by a boundary - * (outline) path. The path outline can be accessed through a - * PathIterator object. The Shape - * interface provides methods for obtaining the bounding box (which is - * the smallest rectangle containing the shape and for obtaining a PathIterator - * object for current Shape, as well as utility methods which - * determine if the Shape contains or intersects a Rectangle or contains a Point. + * The Shape interface defines a geometric shape defined by a boundary (outline) + * path. The path outline can be accessed through a PathIterator object. The + * Shape interface provides methods for obtaining the bounding box (which is the + * smallest rectangle containing the shape and for obtaining a PathIterator + * object for current Shape, as well as utility methods which determine if the + * Shape contains or intersects a Rectangle or contains a Point. + * + * @since Android 1.0 */ public interface Shape { - + /** - * Checks whether or not the point with specified coordinates lies inside + * Checks whether or not the point with specified coordinates lies inside * the Shape. * - * @param x the X coordinate. - * @param y the Y coordinate. - * - * @return true, if the specified coordinates lie inside the Shape, - * otherwise false. + * @param x + * the X coordinate. + * @param y + * the Y coordinate. + * @return true, if the specified coordinates lie inside the Shape, false + * otherwise. */ public boolean contains(double x, double y); /** - * Checks whether or not the rectangle with specified - * [x, y, width, height] parameters lies inside the Shape. - * - * @param x the X double coordinate of the rectangle's upper left - * corner. - * @param y the Y double coordinate of the rectangle's upper left - * corner. - * @param w the width of rectangle. - * @param h the height of rectangle. - * - * @return true, if the specified rectangle lies inside the Shape, - * otherwise false. + * Checks whether or not the rectangle with specified [x, y, width, height] + * parameters lies inside the Shape. + * + * @param x + * the X double coordinate of the rectangle's upper left corner. + * @param y + * the Y double coordinate of the rectangle's upper left corner. + * @param w + * the width of rectangle. + * @param h + * the height of rectangle. + * @return true, if the specified rectangle lies inside the Shape, false + * otherwise. */ public boolean contains(double x, double y, double w, double h); /** * Checks whether or not the specified Point2D lies inside the Shape. * - * @param point the Point2D object. - * - * @return true, if the specified Point2D lies inside the Shape, - * otherwise false. + * @param point + * the Point2D object. + * @return true, if the specified Point2D lies inside the Shape, false + * otherwise. */ public boolean contains(Point2D point); /** * Checks whether or not the specified rectangle lies inside the Shape. * - * @param r the Rectangle2D object. - * - * @return true, if the specified rectangle lies inside the Shape, - * otherwise false. + * @param r + * the Rectangle2D object. + * @return true, if the specified rectangle lies inside the Shape, false + * otherwise. */ public boolean contains(Rectangle2D r); /** - * Gets the bounding rectangle of the Shape. The bounding rectangle - * is the smallest rectangle which contains the Shape. + * Gets the bounding rectangle of the Shape. The bounding rectangle is the + * smallest rectangle which contains the Shape. * * @return the bounding rectangle of the Shape. */ public Rectangle getBounds(); /** - * Gets the Rectangle2D which represents Shape bounds. - * The bounding rectangle is the smallest rectangle which contains - * the Shape. + * Gets the Rectangle2D which represents Shape bounds. The bounding + * rectangle is the smallest rectangle which contains the Shape. * * @return the bounding rectangle of the Shape. */ public Rectangle2D getBounds2D(); /** - * Gets the PathIterator object of the Shape which provides - * access to the shape's boundary modified - * by the specified AffineTransform. - * - * @param at the specified AffineTransform object, or null. + * Gets the PathIterator object of the Shape which provides access to the + * shape's boundary modified by the specified AffineTransform. * + * @param at + * the specified AffineTransform object or null. * @return PathIterator object for the Shape. */ public PathIterator getPathIterator(AffineTransform at); /** - * Gets the PathIterator object of the Shape which provides - * access to the coordinates of the shapes boundary modified - * by the specified AffineTransform. The flatness parameter - * defines the amount of subdivision of the curved segments and - * specifies the maximum distance which every point on the - * unflattened transformed curve can deviate from the returned - * flattened path segments. - * - * @param at the specified AffineTransform object, or null. - * @param flatness the maximum number of the control points for - * a given curve which varies from colinear before a subdivided - * curve is replaced by a straight line connecting the endpoints. - * + * Gets the PathIterator object of the Shape which provides access to the + * coordinates of the shapes boundary modified by the specified + * AffineTransform. The flatness parameter defines the amount of subdivision + * of the curved segments and specifies the maximum distance which every + * point on the unflattened transformed curve can deviate from the returned + * flattened path segments. + * + * @param at + * the specified AffineTransform object or null. + * @param flatness + * the maximum number of the control points for a given curve + * which varies from colinear before a subdivided curve is + * replaced by a straight line connecting the endpoints. * @return PathIterator object for the Shape. */ public PathIterator getPathIterator(AffineTransform at, double flatness); /** - * Checks whether or not the interior of rectangular specified by - * [x, y, width, height] parameters intersects the interior of - * the Shape. - * - * @param x the X double coordinate of the rectangle's upper left - * corner. - * @param y the Y double coordinate of the rectangle's upper left - * corner. - * @param w the width of rectangle. - * @param h the height of rectangle. - * - * @return true, if the rectangle specified by - * [x, y, width, height] parameters intersects the interior of - * the Shape, otherwise false. - * + * Checks whether or not the interior of rectangular specified by [x, y, + * width, height] parameters intersects the interior of the Shape. + * + * @param x + * the X double coordinate of the rectangle's upper left corner. + * @param y + * the Y double coordinate of the rectangle's upper left corner. + * @param w + * the width of rectangle. + * @param h + * the height of rectangle. + * @return true, if the rectangle specified by [x, y, width, height] + * parameters intersects the interior of the Shape, false otherwise. */ public boolean intersects(double x, double y, double w, double h); /** - * Checks whether or not the interior of rectangl specified by - * Rectangle2D object intersects the interior of the Shape. - * - * @param r the Rectangle2D object. + * Checks whether or not the interior of rectangle specified by Rectangle2D + * object intersects the interior of the Shape. * - * @return true, if the Rectangle2D intersects the interior of - * the Shape, otherwise false. + * @param r + * the Rectangle2D object. + * @return true, if the Rectangle2D intersects the interior of the Shape, + * otherwise false. */ public boolean intersects(Rectangle2D r); } diff --git a/awt/java/awt/Stroke.java b/awt/java/awt/Stroke.java index e6d683d733c2b..6d17a23bd7d9e 100644 --- a/awt/java/awt/Stroke.java +++ b/awt/java/awt/Stroke.java @@ -18,29 +18,32 @@ * @author Alexey A. Petrenko * @version $Revision$ */ + package java.awt; /** - * The Stroke interface gives a pen style to be used by the - * Graphics2D interface. It provides a means for getting a stroked version - * of a shape, which is the version that is suitable for drawing via - * the Graphics2D interface. Stroking a shape gives the shape's outline - * a width or drawing style. + * The Stroke interface gives a pen style to be used by the Graphics2D + * interface. It provides a means for getting a stroked version of a shape, + * which is the version that is suitable for drawing via the Graphics2D + * interface. Stroking a shape gives the shape's outline a width or drawing + * style. *

    - * The Draw methods from Graphics2D interface should use the Stroke object for - * rendering the shape's outline. The stroke should be set by - * setStroke(java.awt.Stroke) method of the Graphics2D interface. + * The Draw methods from Graphics2D interface should use the Stroke object for + * rendering the shape's outline. The stroke should be set by + * setStroke(java.awt.Stroke) method of the Graphics2D interface. + * * @see java.awt.Graphics2D#setStroke(java.awt.Stroke) + * @since Android 1.0 */ public interface Stroke { - + /** - * Creates the stroked shape, which is the version that is suitable for drawing via - * the Graphics2D interface. Stroking a shape gives the shape's outline - * a width or drawing style. - * - * @param p the original shape. + * Creates the stroked shape, which is the version that is suitable for + * drawing via the Graphics2D interface. Stroking a shape gives the shape's + * outline a width or drawing style. * + * @param p + * the original shape. * @return the stroked shape. */ public Shape createStrokedShape(Shape p); diff --git a/awt/java/awt/Toolkit.java b/awt/java/awt/Toolkit.java index 0c066b2a0bdcf..e38d5240208ec 100644 --- a/awt/java/awt/Toolkit.java +++ b/awt/java/awt/Toolkit.java @@ -56,34 +56,50 @@ import org.apache.harmony.awt.wtk.NativeEventThread; import org.apache.harmony.awt.wtk.ShutdownWatchdog; import org.apache.harmony.awt.wtk.Synchronizer; import org.apache.harmony.awt.wtk.WTK; +import org.apache.harmony.luni.util.NotImplementedException; /** - * The Toolkit class is the representation of the platform-specific - * Abstract Window Toolkit implementation. Toolkit's subclasses - * are used to bind the various components to particular native - * toolkit implementations. + * The Toolkit class is the representation of the platform-specific Abstract + * Window Toolkit implementation. Toolkit's subclasses are used to bind the + * various components to particular native toolkit implementations. + * + * @since Android 1.0 */ public abstract class Toolkit { - - /** The Constant RECOURCE_PATH. */ + + /** + * The Constant RECOURCE_PATH. + */ private static final String RECOURCE_PATH = "org.apache.harmony.awt.resources.AWTProperties"; //$NON-NLS-1$ - - /** The Constant properties. */ + + /** + * The Constant properties. + */ private static final ResourceBundle properties = loadResources(RECOURCE_PATH); - - /** The dispatcher. */ + + /** + * The dispatcher. + */ Dispatcher dispatcher; - /** The system event queue core. */ + /** + * The system event queue core. + */ private EventQueueCore systemEventQueueCore; - /** The dispatch thread. */ + /** + * The dispatch thread. + */ EventDispatchThread dispatchThread; - /** The native thread. */ + /** + * The native thread. + */ NativeEventThread nativeThread; - /** The awt events manager. */ + /** + * The AWT events manager. + */ protected AWTEventsManager awtEventsManager; /** @@ -92,47 +108,68 @@ public abstract class Toolkit { private class AWTTreeLock { } - /** The awt tree lock. */ + /** + * The AWT tree lock. + */ final Object awtTreeLock = new AWTTreeLock(); - /** The synchronizer. */ + /** + * The synchronizer. + */ private final Synchronizer synchronizer = ContextStorage.getSynchronizer(); - /** The shutdown watchdog. */ + /** + * The shutdown watchdog. + */ final ShutdownWatchdog shutdownWatchdog = new ShutdownWatchdog(); - /** The auto number. */ + /** + * The auto number. + */ final AutoNumber autoNumber = new AutoNumber(); - /** The event type lookup. */ + /** + * The event type lookup. + */ final AWTEvent.EventTypeLookup eventTypeLookup = new AWTEvent.EventTypeLookup(); - /** The b dynamic layout set. */ + /** + * The b dynamic layout set. + */ private boolean bDynamicLayoutSet = true; - /** The set of desktop properties that user set directly. */ + /** + * The set of desktop properties that user set directly. + */ private final HashSet userPropSet = new HashSet(); - /** The desktop properties. */ + /** + * The desktop properties. + */ protected Map desktopProperties; - /** The desktop props support. */ + /** + * The desktop props support. + */ protected PropertyChangeSupport desktopPropsSupport; /** - * For this component the native window is being created - * It is used in the callback-driven window creation - * (e.g. on Windows in the handler of WM_CREATE event) - * to establish the connection between this component - * and its native window. + * For this component the native window is being created It is used in the + * callback-driven window creation (e.g. on Windows in the handler of + * WM_CREATE event) to establish the connection between this component and + * its native window. */ private Object recentNativeWindowComponent; - /** The wtk. */ + /** + * The wtk. + */ private WTK wtk; /** * The Class ComponentInternalsImpl. + * + * @since Android 1.0 */ protected final class ComponentInternalsImpl extends ComponentInternals { @@ -143,13 +180,15 @@ public abstract class Toolkit { public void shutdown() { dispatchThread.shutdown(); } - + /** - * Sets the desktop property to the specified value and fires a property - * change event. + * Sets the desktop property to the specified value and fires a property + * change event. * - * @param name the name of property. - * @param value the new value of property. + * @param name + * the name of property. + * @param value + * the new value of property. */ @Override public void setDesktopProperty(String name, Object value) { @@ -157,12 +196,12 @@ public abstract class Toolkit { } } - /** - * A lot of methods must throw HeadlessException - * if GraphicsEnvironment.isHeadless() returns true. + * A lot of methods must throw HeadlessException if + * GraphicsEnvironment.isHeadless() returns true. * - * @throws HeadlessException the headless exception + * @throws HeadlessException + * the headless exception. */ static void checkHeadless() throws HeadlessException { if (GraphicsEnvironment.getLocalGraphicsEnvironment().isHeadlessInstance()) @@ -170,51 +209,49 @@ public abstract class Toolkit { } /** - * Lock awt. + * Lock AWT. */ final void lockAWT() { synchronizer.lock(); } /** - * Static lock awt. + * Static lock AWT. */ static final void staticLockAWT() { ContextStorage.getSynchronizer().lock(); } /** - * Unlock awt. + * Unlock AWT. */ final void unlockAWT() { synchronizer.unlock(); } /** - * Static unlock awt. + * Static unlock AWT. */ static final void staticUnlockAWT() { ContextStorage.getSynchronizer().unlock(); - } - - /** - * InvokeAndWait under AWT lock. W/o this method system can hang up. - * Added to support modality (Dialog.show() & PopupMenu.show()) from - * not event dispatch thread. Use in other cases is not recommended. - * - * Still can be called only for whole API methods that - * cannot be called from other classes API methods. - * Examples: - * show() for modal dialogs - correct, only user can call it, - * directly or through setVisible(true) - * setBounds() for components - incorrect, setBounds() - * can be called from layoutContainer() - * for layout managers - * - * @param runnable the runnable + } + + /** + * InvokeAndWait under AWT lock. W/o this method system can hang up. Added + * to support modality (Dialog.show() & PopupMenu.show()) from not event + * dispatch thread. Use in other cases is not recommended. Still can be + * called only for whole API methods that cannot be called from other + * classes API methods. Examples: show() for modal dialogs - correct, only + * user can call it, directly or through setVisible(true) setBounds() for + * components - incorrect, setBounds() can be called from layoutContainer() + * for layout managers * - * @throws InterruptedException the interrupted exception - * @throws InvocationTargetException the invocation target exception + * @param runnable + * the runnable. + * @throws InterruptedException + * the interrupted exception. + * @throws InvocationTargetException + * the invocation target exception. */ final void unsafeInvokeAndWait(Runnable runnable) throws InterruptedException, InvocationTargetException { @@ -229,7 +266,7 @@ public abstract class Toolkit { /** * Gets the synchronizer. * - * @return the synchronizer + * @return the synchronizer. */ final Synchronizer getSynchronizer() { return synchronizer; @@ -238,19 +275,20 @@ public abstract class Toolkit { /** * Gets the wTK. * - * @return the wTK + * @return the wTK. */ final WTK getWTK() { return wtk; } /** - * Gets the property with the specified key and default value. - * This method returns the defValue if the property is not found. - * - * @param propName the name of property. - * @param defVal the default value. + * Gets the property with the specified key and default value. This method + * returns the defValue if the property is not found. * + * @param propName + * the name of property. + * @param defVal + * the default value. * @return the property value. */ public static String getProperty(String propName, String defVal) { @@ -273,11 +311,11 @@ public abstract class Toolkit { staticUnlockAWT(); } } - + /** * Gets the default Toolkit. * - * @return the default Toolkit + * @return the default Toolkit. */ public static Toolkit getDefaultToolkit() { synchronized (ContextStorage.getContextLock()) { @@ -290,34 +328,34 @@ public abstract class Toolkit { } staticLockAWT(); try { - defToolkit = GraphicsEnvironment.isHeadless() ? - new HeadlessToolkit() : new ToolkitImpl(); + defToolkit = GraphicsEnvironment.isHeadless() ? new HeadlessToolkit() + : new ToolkitImpl(); ContextStorage.setDefaultToolkit(defToolkit); return defToolkit; } finally { staticUnlockAWT(); } - //TODO: read system property named awt.toolkit - //and create an instance of the specified class, - //by default use ToolkitImpl + // TODO: read system property named awt.toolkit + // and create an instance of the specified class, + // by default use ToolkitImpl } } - + /** * Gets the default Font. * - * @return the derault Font for Toolkit. + * @return the default Font for Toolkit. */ Font getDefaultFont() { return wtk.getSystemProperties().getDefaultFont(); } - + /** * Load resources. * - * @param path the path - * - * @return the resource bundle + * @param path + * the path. + * @return the resource bundle. */ private static ResourceBundle loadResources(String path) { try { @@ -330,7 +368,7 @@ public abstract class Toolkit { /** * Gets the wTK class name. * - * @return the wTK class name + * @return the wTK class name. */ private static String getWTKClassName() { return "com.android.internal.awt.AndroidWTK"; @@ -339,9 +377,9 @@ public abstract class Toolkit { /** * Gets the component by id. * - * @param id the id - * - * @return the component by id + * @param id + * the id. + * @return the component by id. */ Component getComponentById(long id) { if (id == 0) { @@ -362,12 +400,12 @@ public abstract class Toolkit { /** * Instantiates a new toolkit. */ - public Toolkit() { + public Toolkit() { init(); } /** - * Inits AWT. + * Initiates AWT. */ protected void init() { lockAWT(); @@ -397,43 +435,52 @@ public abstract class Toolkit { unlockAWT(); } } - + /** * Synchronizes this toolkit's graphics. */ public abstract void sync(); /** - * Returns the construction status of a specified image that is being created. - * - * @param a0 the image to be checked. - * @param a1 the width of scaled image for which the status is being checked, or -1. - * @param a2 the height of scaled image for which the status is being checked, or -1. - * @param a3 the ImageObserver object to be notified while - * the image is being prepared. + * Returns the construction status of a specified image that is being + * created. * - * @return the ImageObserver flags which give the current state of the image data. + * @param a0 + * the image to be checked. + * @param a1 + * the width of scaled image for which the status is being + * checked or -1. + * @param a2 + * the height of scaled image for which the status is being + * checked or -1. + * @param a3 + * the ImageObserver object to be notified while the image is + * being prepared. + * @return the ImageObserver flags which give the current state of the image + * data. */ public abstract int checkImage(Image a0, int a1, int a2, ImageObserver a3); - + /** * Creates the image with the specified ImageProducer. * - * @param a0 the ImageProducer to be used for image creation. - * + * @param a0 + * the ImageProducer to be used for image creation. * @return the image with the specified ImageProducer. */ public abstract Image createImage(ImageProducer a0); /** - * Creates the image from the specified byte array, offset and length. - * The byte array should contain data with image format supported by - * Toolkit such as JPEG, GIF, or PNG. - * - * @param a0 the byte array with the image data. - * @param a1 the offset of the beggining the image data in the byte array. - * @param a2 the length of the image data in the byte array. + * Creates the image from the specified byte array, offset and length. The + * byte array should contain data with image format supported by Toolkit + * such as JPEG, GIF, or PNG. * + * @param a0 + * the byte array with the image data. + * @param a1 + * the offset of the beginning the image data in the byte array. + * @param a2 + * the length of the image data in the byte array. * @return the created Image. */ public abstract Image createImage(byte[] a0, int a1, int a2); @@ -441,8 +488,8 @@ public abstract class Toolkit { /** * Creates the image using image data from the specified URL. * - * @param a0 the URL for extracting image data. - * + * @param a0 + * the URL for extracting image data. * @return the Image. */ public abstract Image createImage(URL a0); @@ -450,8 +497,8 @@ public abstract class Toolkit { /** * Creates the image using image data from the specified file. * - * @param a0 the file name which contains image data of supported format. - * + * @param a0 + * the file name which contains image data of supported format. * @return the Image. */ public abstract Image createImage(String a0); @@ -460,22 +507,20 @@ public abstract class Toolkit { * Gets the color model. * * @return the ColorModel of Toolkit's screen. - * - * @throws HeadlessException if the - * GraphicsEnvironment.isHeadless() method returns true. + * @throws HeadlessException + * if the GraphicsEnvironment.isHeadless() method returns true. */ public abstract ColorModel getColorModel() throws HeadlessException; - + /** * Gets the screen device metrics for the specified font. * - * @param font the Font. - * + * @param font + * the Font. * @return the FontMetrics for the specified Font. - * * @deprecated Use getLineMetrics method from Font class. */ - + @Deprecated public abstract FontMetrics getFontMetrics(Font font); @@ -483,13 +528,18 @@ public abstract class Toolkit { * Prepares the specified image for rendering on the screen with the * specified size. * - * @param a0 the Image to be prepared. - * @param a1 the width of the screen representation or -1 for the current screen. - * @param a2 the height of the screen representation or -1 for the current screen. - * @param a3 the ImageObserver object to be notified as soon as - * the image is prepared. - * - * @return true, if image is fully prepared; false otherwise. + * @param a0 + * the Image to be prepared. + * @param a1 + * the width of the screen representation or -1 for the current + * screen. + * @param a2 + * the height of the screen representation or -1 for the current + * screen. + * @param a3 + * the ImageObserver object to be notified as soon as the image + * is prepared. + * @return true, if image is fully prepared, false otherwise. */ public abstract boolean prepareImage(Image a0, int a1, int a2, ImageObserver a3); @@ -502,21 +552,19 @@ public abstract class Toolkit { * Returns the array of font names which are available in this Toolkit. * * @return the array of font names which are available in this Toolkit. - * * @deprecated use GraphicsEnvironment.getAvailableFontFamilyNames() method. */ @Deprecated public abstract String[] getFontList(); - + /** - * Gets the the Font implementation using the specified peer - * interface. - * - * @param a0 the Font name to be implemented. - * @param a1 the the font style: PLAIN, BOLD, ITALIC. + * Gets the the Font implementation using the specified peer interface. * + * @param a0 + * the Font name to be implemented. + * @param a1 + * the the font style: PLAIN, BOLD, ITALIC. * @return the FontPeer implementation of the specified Font. - * * @deprecated use java.awt.GraphicsEnvironment.getAllFonts method. */ @@ -524,27 +572,27 @@ public abstract class Toolkit { protected abstract FontPeer getFontPeer(String a0, int a1); /** - * Gets the image from the specified file which contains image data in - * a supported image format (such as JPEG, GIF, or PNG); this method - * should return the same Image for multiple calls of this method with - * the same image file name. - * - * @param a0 the file name which contains image data in - * a supported image format (such as JPEG, GIF, or PNG). + * Gets the image from the specified file which contains image data in a + * supported image format (such as JPEG, GIF, or PNG); this method should + * return the same Image for multiple calls of this method with the same + * image file name. * + * @param a0 + * the file name which contains image data in a supported image + * format (such as JPEG, GIF, or PNG). * @return the Image. */ public abstract Image getImage(String a0); /** - * Gets the image from the specified URL which contains image data in - * a supported image format (such as JPEG, GIF, or PNG); this method - * should return the same Image for multiple calls of this method with - * the same image URL. - * - * @param a0 the URL which contains image data in - * a supported image format (such as JPEG, GIF, or PNG). + * Gets the image from the specified URL which contains image data in a + * supported image format (such as JPEG, GIF, or PNG); this method should + * return the same Image for multiple calls of this method with the same + * image URL. * + * @param a0 + * the URL which contains image data in a supported image format + * (such as JPEG, GIF, or PNG). * @return the Image. */ public abstract Image getImage(URL a0); @@ -553,20 +601,17 @@ public abstract class Toolkit { * Gets the screen resolution. * * @return the screen resolution. - * - * @throws HeadlessException if the GraphicsEnvironment.isHeadless() - * method returns true. + * @throws HeadlessException + * if the GraphicsEnvironment.isHeadless() method returns true. */ public abstract int getScreenResolution() throws HeadlessException; /** * Gets the screen size. * - * @return a Dimension object containing the width and height of - * the screen. - * - * @throws HeadlessException if the GraphicsEnvironment.isHeadless() - * method returns true. + * @return a Dimension object containing the width and height of the screen. + * @throws HeadlessException + * if the GraphicsEnvironment.isHeadless() method returns true. */ public abstract Dimension getScreenSize() throws HeadlessException; @@ -578,15 +623,14 @@ public abstract class Toolkit { protected abstract EventQueue getSystemEventQueueImpl(); /** - * Returns a map of text attributes for the abstract level description - * of the specified input method highlight, or null if no mapping is found. - * - * @param highlight the InputMethodHighlight. + * Returns a map of text attributes for the abstract level description of + * the specified input method highlight, or null if no mapping is found. * - * @return the Map - * - * @throws HeadlessException if the GraphicsEnvironment.isHeadless() - * method returns true. + * @param highlight + * the InputMethodHighlight. + * @return the Map. + * @throws HeadlessException + * if the GraphicsEnvironment.isHeadless() method returns true. */ public abstract Map mapInputMethodHighlight( InputMethodHighlight highlight) throws HeadlessException; @@ -594,14 +638,14 @@ public abstract class Toolkit { /** * Map input method highlight impl. * - * @param highlight the highlight - * - * @return the map - * - * @throws HeadlessException the headless exception + * @param highlight + * the highlight. + * @return the map. + * @throws HeadlessException + * the headless exception. */ - Map mapInputMethodHighlightImpl( - InputMethodHighlight highlight) throws HeadlessException { + Map mapInputMethodHighlightImpl(InputMethodHighlight highlight) + throws HeadlessException { HashMap map = new HashMap(); wtk.getSystemProperties().mapInputMethodHighlight(highlight, map); return Collections. unmodifiableMap(map); @@ -611,9 +655,11 @@ public abstract class Toolkit { * Adds the specified PropertyChangeListener listener for the specified * property. * - * @param propName the property name for which the specified PropertyChangeListener - * will be added. - * @param l the PropertyChangeListener object. + * @param propName + * the property name for which the specified + * PropertyChangeListener will be added. + * @param l + * the PropertyChangeListener object. */ public void addPropertyChangeListener(String propName, PropertyChangeListener l) { lockAWT(); @@ -624,31 +670,32 @@ public abstract class Toolkit { } finally { unlockAWT(); } - if (l != null) { // there is no guarantee that null listener will not be added + if (l != null) { // there is no guarantee that null listener will not be + // added desktopPropsSupport.addPropertyChangeListener(propName, l); } } /** - * Returns an array of the property change listeners registered with - * this Toolkit. + * Returns an array of the property change listeners registered with this + * Toolkit. * - * @return an array of the property change listeners registered with - * this Toolkit. + * @return an array of the property change listeners registered with this + * Toolkit. */ public PropertyChangeListener[] getPropertyChangeListeners() { return desktopPropsSupport.getPropertyChangeListeners(); } /** - * Returns an array of the property change listeners registered with - * this Toolkit for notification regarding the specified property. - * - * @param propName the property name for which the PropertyChangeListener - * was registered. + * Returns an array of the property change listeners registered with this + * Toolkit for notification regarding the specified property. * - * @return the array of PropertyChangeListeners registered for the specified - * property name. + * @param propName + * the property name for which the PropertyChangeListener was + * registered. + * @return the array of PropertyChangeListeners registered for the specified + * property name. */ public PropertyChangeListener[] getPropertyChangeListeners(String propName) { return desktopPropsSupport.getPropertyChangeListeners(propName); @@ -658,28 +705,33 @@ public abstract class Toolkit { * Removes the specified property change listener registered for the * specified property name. * - * @param propName the property name. - * @param l the PropertyChangeListener registered for the specified property name. + * @param propName + * the property name. + * @param l + * the PropertyChangeListener registered for the specified + * property name. */ public void removePropertyChangeListener(String propName, PropertyChangeListener l) { desktopPropsSupport.removePropertyChangeListener(propName, l); } - + /** * Creates a custom cursor with the specified Image, hot spot, and cursor * description. * - * @param img the image of activated cursor. - * @param hotSpot the Point giving the coordinates of the cursor's hot spot. - * @param name the cursor description. - * + * @param img + * the image of activated cursor. + * @param hotSpot + * the Point giving the coordinates of the cursor's hot spot. + * @param name + * the cursor description. * @return the cursor with the specified Image, hot spot, and cursor - * description. - * - * @throws IndexOutOfBoundsException if the hot spot values are outside - * the bounds of the cursor. - * @throws HeadlessException if isHeadless() method of GraphicsEnvironment - * class returns true. + * description. + * @throws IndexOutOfBoundsException + * if the hot spot values are outside the bounds of the cursor. + * @throws HeadlessException + * if isHeadless() method of GraphicsEnvironment class returns + * true. */ public Cursor createCustomCursor(Image img, Point hotSpot, String name) throws IndexOutOfBoundsException, HeadlessException { @@ -698,20 +750,19 @@ public abstract class Toolkit { } /** - * Returns the supported cursor dimension which is closest to the - * specified width and height. If the Toolkit only supports a single - * cursor size, this method should return the supported cursor size. - * If custom cursor is not supported, a dimension of 0, 0 should be - * returned. - * - * @param prefWidth the preffered cursor width. - * @param prefHeight the preffered cursor height. + * Returns the supported cursor dimension which is closest to the specified + * width and height. If the Toolkit only supports a single cursor size, this + * method should return the supported cursor size. If custom cursor is not + * supported, a dimension of 0, 0 should be returned. * - * @return the supported cursor dimension which is closest to the - * specified width and height. - * - * @throws HeadlessException if GraphicsEnvironment.isHeadless() - * returns true. + * @param prefWidth + * the preferred cursor width. + * @param prefHeight + * the preferred cursor height. + * @return the supported cursor dimension which is closest to the specified + * width and height. + * @throws HeadlessException + * if GraphicsEnvironment.isHeadless() returns true. */ public Dimension getBestCursorSize(int prefWidth, int prefHeight) throws HeadlessException { lockAWT(); @@ -723,10 +774,10 @@ public abstract class Toolkit { } /** - * Gets the value for the specified desktop property. - * - * @param propName the property name. + * Gets the value for the specified desktop property. * + * @param propName + * the property name. * @return the Object that is the property's value. */ public final Object getDesktopProperty(String propName) { @@ -754,17 +805,19 @@ public abstract class Toolkit { /** * Returns the locking key state for the specified key. * - * @param a0 the key code: VK_CAPS_LOCK, VK_NUM_LOCK, VK_SCROLL_LOCK, - * or VK_KANA_LOCK. - * - * @return true if the specified key code is in the locked state, - * false otherwise. - * - * @throws UnsupportedOperationException if the state of this key - * can't be retrieved, or if the keyboard doesn't have this key. - * @throws NotImplementedException if this method is not implemented. - */ - public boolean getLockingKeyState(int a0) throws UnsupportedOperationException, org.apache.harmony.luni.util.NotImplementedException { + * @param a0 + * the key code: VK_CAPS_LOCK, VK_NUM_LOCK, VK_SCROLL_LOCK, or + * VK_KANA_LOCK. + * @return true if the specified key code is in the locked state, false + * otherwise. + * @throws UnsupportedOperationException + * if the state of this key can't be retrieved, or if the + * keyboard doesn't have this key. + * @throws NotImplementedException + * if this method is not implemented. + */ + public boolean getLockingKeyState(int a0) throws UnsupportedOperationException, + org.apache.harmony.luni.util.NotImplementedException { lockAWT(); try { } finally { @@ -781,9 +834,8 @@ public abstract class Toolkit { * custom cursor. * * @return the maximum cursor colors. - * - * @throws HeadlessException if the GraphicsEnvironment.isHeadless() - * method returns true. + * @throws HeadlessException + * if the GraphicsEnvironment.isHeadless() method returns true. */ public int getMaximumCursorColors() throws HeadlessException { lockAWT(); @@ -796,11 +848,10 @@ public abstract class Toolkit { /** * Gets the menu shortcut key mask. - * - * @return the menu shortcut key mask. * - * @throws HeadlessException if the GraphicsEnvironment.isHeadless() - * method returns true. + * @return the menu shortcut key mask. + * @throws HeadlessException + * if the GraphicsEnvironment.isHeadless() method returns true. */ public int getMenuShortcutKeyMask() throws HeadlessException { lockAWT(); @@ -814,12 +865,11 @@ public abstract class Toolkit { /** * Gets the screen insets. * - * @param gc the GraphicsConfiguration. - * + * @param gc + * the GraphicsConfiguration. * @return the insets of this toolkit. - * - * @throws HeadlessException if the GraphicsEnvironment.isHeadless() - * method returns true. + * @throws HeadlessException + * if the GraphicsEnvironment.isHeadless() method returns true. */ public Insets getScreenInsets(GraphicsConfiguration gc) throws HeadlessException { if (gc == null) { @@ -827,17 +877,17 @@ public abstract class Toolkit { } lockAWT(); try { - return new Insets(0, 0, 0, 0); //TODO: get real screen insets + return new Insets(0, 0, 0, 0); // TODO: get real screen insets } finally { unlockAWT(); } } /** - * Gets the system EventQueue instance. - * If the default implementation of checkAwtEventQueueAccess is used, - * then this results of a call to the security manager's checkPermission - * method with an AWTPermission("accessEventQueue") permission. + * Gets the system EventQueue instance. If the default implementation of + * checkAwtEventQueueAccess is used, then this results of a call to the + * security manager's checkPermission method with an + * AWTPermission("accessEventQueue") permission. * * @return the system EventQueue instance. */ @@ -849,19 +899,20 @@ public abstract class Toolkit { return getSystemEventQueueImpl(); } - /** + /** * Gets the system event queue core. * - * @return the system event queue core + * @return the system event queue core. */ EventQueueCore getSystemEventQueueCore() { return systemEventQueueCore; } - + /** * Sets the system event queue core. * - * @param core the new system event queue core + * @param core + * the new system event queue core. */ void setSystemEventQueueCore(EventQueueCore core) { systemEventQueueCore = core; @@ -882,11 +933,10 @@ public abstract class Toolkit { /** * Checks if dynamic layout of Containers is active or not. * - * @return true, if is dynamic layout of Containers is active, - * false otherwise. - * - * @throws HeadlessException if the GraphicsEnvironment.isHeadless() - * method returns true. + * @return true, if is dynamic layout of Containers is active, false + * otherwise. + * @throws HeadlessException + * if the GraphicsEnvironment.isHeadless() method returns true. */ public boolean isDynamicLayoutActive() throws HeadlessException { lockAWT(); @@ -898,17 +948,15 @@ public abstract class Toolkit { } } - /** - * Returns if the layout of Containers is checked dynamically during resizing, - * or statically after resizing is completed. - * - * @return true, if if the layout of Containers is checked dynamically during - * resizing; false, if the layout of Containers is checked statically after - * resizing is completed. + * Returns if the layout of Containers is checked dynamically during + * resizing, or statically after resizing is completed. * - * @throws HeadlessException if the GraphicsEnvironment.isHeadless() - * method returns true. + * @return true, if if the layout of Containers is checked dynamically + * during resizing; false, if the layout of Containers is checked + * statically after resizing is completed. + * @throws HeadlessException + * if the GraphicsEnvironment.isHeadless() method returns true. */ protected boolean isDynamicLayoutSet() throws HeadlessException { lockAWT(); @@ -922,12 +970,11 @@ public abstract class Toolkit { /** * Checks if the specified frame state is supported by Toolkit or not. * - * @param state the frame state. - * - * @return true, if frame state is supported; false othrwise. - * - * @throws HeadlessException if the GraphicsEnvironment.isHeadless() - * method returns true. + * @param state + * the frame state. + * @return true, if frame state is supported, false otherwise. + * @throws HeadlessException + * if the GraphicsEnvironment.isHeadless() method returns true. */ public boolean isFrameStateSupported(int state) throws HeadlessException { lockAWT(); @@ -941,8 +988,8 @@ public abstract class Toolkit { /** * Loads the value of the desktop property with the specified property name. * - * @param propName the property name. - * + * @param propName + * the property name. * @return the desktop property values. */ protected Object lazilyLoadDesktopProperty(String propName) { @@ -952,11 +999,11 @@ public abstract class Toolkit { /** * Loads the current system color values to the specified array. * - * @param colors the array where the current system color values - * are written by this method. - * - * @throws HeadlessException if the GraphicsEnvironment.isHeadless() - * method returns true. + * @param colors + * the array where the current system color values are written by + * this method. + * @throws HeadlessException + * if the GraphicsEnvironment.isHeadless() method returns true. */ protected void loadSystemColors(int[] colors) throws HeadlessException { lockAWT(); @@ -969,8 +1016,10 @@ public abstract class Toolkit { /** * Sets the value of the desktop property with the specified name. * - * @param propName the property's name. - * @param value the property's value. + * @param propName + * the property's name. + * @param value + * the property's value. */ protected final void setDesktopProperty(String propName, Object value) { Object oldVal; @@ -986,15 +1035,15 @@ public abstract class Toolkit { } /** - * Sets the layout state, whether the Container layout is checked - * dynamically during resizing, or statically after resizing is completed. - * - * @param dynamic the new dynamic layout state - if true the layout of - * Containers is checked dynamically during resizing, if false - - * statically after resizing is completed. + * Sets the layout state, whether the Container layout is checked + * dynamically during resizing, or statically after resizing is completed. * - * @throws HeadlessException if the GraphicsEnvironment.isHeadless() - * method returns true. + * @param dynamic + * the new dynamic layout state - if true the layout of + * Containers is checked dynamically during resizing, if false - + * statically after resizing is completed. + * @throws HeadlessException + * if the GraphicsEnvironment.isHeadless() method returns true. */ public void setDynamicLayout(boolean dynamic) throws HeadlessException { lockAWT(); @@ -1008,16 +1057,20 @@ public abstract class Toolkit { /** * Sets the locking key state for the specified key code. * - * @param a0 the key code: VK_CAPS_LOCK, VK_NUM_LOCK, VK_SCROLL_LOCK, - * or VK_KANA_LOCK. - * @param a1 the state - true to set the specified key code to the locked state, - * false - to unlock it. - * - * @throws UnsupportedOperationException if the state of this key - * can't be set, or if the keyboard doesn't have this key. - * @throws NotImplementedException if this method is not implemented. - */ - public void setLockingKeyState(int a0, boolean a1) throws UnsupportedOperationException, org.apache.harmony.luni.util.NotImplementedException { + * @param a0 + * the key code: VK_CAPS_LOCK, VK_NUM_LOCK, VK_SCROLL_LOCK, or + * VK_KANA_LOCK. + * @param a1 + * the state - true to set the specified key code to the locked + * state, false - to unlock it. + * @throws UnsupportedOperationException + * if the state of this key can't be set, or if the keyboard + * doesn't have this key. + * @throws NotImplementedException + * if this method is not implemented. + */ + public void setLockingKeyState(int a0, boolean a1) throws UnsupportedOperationException, + org.apache.harmony.luni.util.NotImplementedException { lockAWT(); try { } finally { @@ -1029,7 +1082,6 @@ public abstract class Toolkit { return; } - /** * On queue empty. */ @@ -1040,14 +1092,14 @@ public abstract class Toolkit { /** * Creates the wtk. * - * @param clsName the cls name - * - * @return the wTK + * @param clsName + * the cls name. + * @return the wTK. */ private WTK createWTK(String clsName) { WTK newWTK = null; try { - newWTK = (WTK) Class.forName(clsName).newInstance(); + newWTK = (WTK)Class.forName(clsName).newInstance(); } catch (Exception e) { throw new RuntimeException(e); } @@ -1056,7 +1108,9 @@ public abstract class Toolkit { /** * Connect the component to its native window - * @param winId - id of native window just created + * + * @param winId + * the id of native window just created. */ boolean onWindowCreated(long winId) { return false; @@ -1065,45 +1119,50 @@ public abstract class Toolkit { /** * Gets the native event queue. * - * @return the native event queue + * @return the native event queue. */ NativeEventQueue getNativeEventQueue() { return wtk.getNativeEventQueue(); } /** - * Returns a shared instance of implementation of org.apache.harmony.awt.wtk.NativeCursor - * for current platform for + * Returns a shared instance of implementation of + * org.apache.harmony.awt.wtk.NativeCursor for current platform for. * - * @param type - Java Cursor type - * - * @return new instance of implementation of NativeCursor + * @param type + * the Java Cursor type. + * @return new instance of implementation of NativeCursor. */ NativeCursor createNativeCursor(int type) { return wtk.getCursorFactory().getCursor(type); } /** - * Returns a shared instance of implementation of org.apache.harmony.awt.wtk.NativeCursor - * for current platform for custom cursor - * - * @param img the img - * @param hotSpot the hot spot - * @param name the name + * Returns a shared instance of implementation of + * org.apache.harmony.awt.wtk.NativeCursor for current platform for custom + * cursor * - * @return new instance of implementation of NativeCursor + * @param img + * the img. + * @param hotSpot + * the hot spot. + * @param name + * the name. + * @return new instance of implementation of NativeCursor. */ NativeCursor createCustomNativeCursor(Image img, Point hotSpot, String name) { return wtk.getCursorFactory().createCustomCursor(img, hotSpot.x, hotSpot.y); } /** - * Adds an AWTEventListener to the Toolkit to listen for events - * of types corresponding to bits in the specified event mask. - * Event masks are defined in AWTEvent class. + * Adds an AWTEventListener to the Toolkit to listen for events of types + * corresponding to bits in the specified event mask. Event masks are + * defined in AWTEvent class. * - * @param listener the AWTEventListener. - * @param eventMask he bitmask of event types. + * @param listener + * the AWTEventListener. + * @param eventMask + * the bitmask of event types. */ public void addAWTEventListener(AWTEventListener listener, long eventMask) { lockAWT(); @@ -1119,9 +1178,10 @@ public abstract class Toolkit { } /** - * Removes the specified awt event listener. + * Removes the specified AWT event listener. * - * @param listener the AWTEventListener to be removed. + * @param listener + * the AWTEventListener to be removed. */ public void removeAWTEventListener(AWTEventListener listener) { lockAWT(); @@ -1139,7 +1199,8 @@ public abstract class Toolkit { /** * Gets the array of all AWT event listeners registered with this Toolkit. * - * @return the array of all AWT event listeners registered with this Toolkit. + * @return the array of all AWT event listeners registered with this + * Toolkit. */ public AWTEventListener[] getAWTEventListeners() { lockAWT(); @@ -1155,13 +1216,13 @@ public abstract class Toolkit { } /** - * Returns the array of the AWT event listeners registered with this Toolkit + * Returns the array of the AWT event listeners registered with this Toolkit * for the event types corresponding to the specified event mask. * - * @param eventMask the bit mask of event type. - * - * @return the array of the AWT event listeners registered in this Toolkit - * for the event types corresponding to the specified event mask. + * @param eventMask + * the bit mask of event type. + * @return the array of the AWT event listeners registered in this Toolkit + * for the event types corresponding to the specified event mask. */ public AWTEventListener[] getAWTEventListeners(long eventMask) { lockAWT(); @@ -1177,30 +1238,37 @@ public abstract class Toolkit { } /** - * Dispatch awt event. + * Dispatch AWT event. * - * @param event the event + * @param event + * the event. */ void dispatchAWTEvent(AWTEvent event) { awtEventsManager.dispatchAWTEvent(event); } - + /** * The Class AWTEventsManager. */ final class AWTEventsManager { - /** The permission. */ + /** + * The permission. + */ AWTPermission permission = new AWTPermission("listenToAllAWTEvents"); //$NON-NLS-1$ - /** The listeners. */ + /** + * The listeners. + */ private final AWTListenerList listeners = new AWTListenerList(); /** - * Adds the awt event listener. + * Adds the AWT event listener. * - * @param listener the listener - * @param eventMask the event mask + * @param listener + * the listener. + * @param eventMask + * the event mask. */ void addAWTEventListener(AWTEventListener listener, long eventMask) { if (listener != null) { @@ -1209,9 +1277,10 @@ public abstract class Toolkit { } /** - * Removes the awt event listener. + * Removes the AWT event listener. * - * @param listener the listener + * @param listener + * the listener. */ void removeAWTEventListener(AWTEventListener listener) { if (listener != null) { @@ -1225,9 +1294,9 @@ public abstract class Toolkit { } /** - * Gets the aWT event listeners. + * Gets the AWT event listeners. * - * @return the aWT event listeners + * @return the AWT event listeners. */ AWTEventListener[] getAWTEventListeners() { HashSet listenersSet = new HashSet(); @@ -1238,11 +1307,11 @@ public abstract class Toolkit { } /** - * Gets the aWT event listeners. + * Gets the AWT event listeners. * - * @param eventMask the event mask - * - * @return the aWT event listeners + * @param eventMask + * the event mask. + * @return the AWT event listeners. */ AWTEventListener[] getAWTEventListeners(long eventMask) { HashSet listenersSet = new HashSet(); @@ -1255,9 +1324,10 @@ public abstract class Toolkit { } /** - * Dispatch awt event. + * Dispatch AWT event. * - * @param event the event + * @param event + * the event. */ void dispatchAWTEvent(AWTEvent event) { AWTEvent.EventDescriptor descriptor = eventTypeLookup.getEventDescriptor(event); @@ -1271,68 +1341,104 @@ public abstract class Toolkit { } } } - + /** * The Class AutoNumber. */ static final class AutoNumber { - /** The next component. */ + /** + * The next component. + */ int nextComponent = 0; - /** The next canvas. */ + /** + * The next canvas. + */ int nextCanvas = 0; - /** The next panel. */ + /** + * The next panel. + */ int nextPanel = 0; - /** The next window. */ + /** + * The next window. + */ int nextWindow = 0; - /** The next frame. */ + /** + * The next frame. + */ int nextFrame = 0; - /** The next dialog. */ + /** + * The next dialog. + */ int nextDialog = 0; - /** The next button. */ + /** + * The next button. + */ int nextButton = 0; - /** The next menu component. */ + /** + * The next menu component. + */ int nextMenuComponent = 0; - /** The next label. */ + /** + * The next label. + */ int nextLabel = 0; - /** The next check box. */ + /** + * The next check box. + */ int nextCheckBox = 0; - /** The next scrollbar. */ + /** + * The next scrollbar. + */ int nextScrollbar = 0; - /** The next scroll pane. */ + /** + * The next scroll pane. + */ int nextScrollPane = 0; - /** The next list. */ + /** + * The next list. + */ int nextList = 0; - /** The next choice. */ + /** + * The next choice. + */ int nextChoice = 0; - /** The next file dialog. */ + /** + * The next file dialog. + */ int nextFileDialog = 0; - /** The next text area. */ + /** + * The next text area. + */ int nextTextArea = 0; - /** The next text field. */ + /** + * The next text field. + */ int nextTextField = 0; } - + private class Lock { } - /** The lock. */ + /** + * The lock. + */ private final Object lock = new Lock(); - + } diff --git a/awt/java/awt/Transparency.java b/awt/java/awt/Transparency.java index 97931141aa1f7..44a1e7f2e46e1 100644 --- a/awt/java/awt/Transparency.java +++ b/awt/java/awt/Transparency.java @@ -18,34 +18,40 @@ * @author Pavel Dolgov * @version $Revision$ */ + package java.awt; /** * The Transparency interface defines transparency's general modes. + * + * @since Android 1.0 */ public interface Transparency { - /** The Constant OPAQUE represents completely opaque data, - * all pixels have an alpha value of 1.0. + /** + * The Constant OPAQUE represents completely opaque data, all pixels have an + * alpha value of 1.0. */ public static final int OPAQUE = 1; - /** The Constant BITMASK represents data which can be either - * completely opaque, with an alpha value of 1.0, or completely - * transparent, with an alpha value of 0.0. + /** + * The Constant BITMASK represents data which can be either completely + * opaque, with an alpha value of 1.0, or completely transparent, with an + * alpha value of 0.0. */ public static final int BITMASK = 2; - /** The Constant TRANSLUCENT represents data which alpha value - * can vary between and including 0.0 and 1.0. */ + /** + * The Constant TRANSLUCENT represents data which alpha value can vary + * between and including 0.0 and 1.0. + */ public static final int TRANSLUCENT = 3; /** * Gets the transparency mode. * - * @return the transparency mode: OPAQUE, BITMASK or TRANSLUCENT. + * @return the transparency mode: OPAQUE, BITMASK or TRANSLUCENT. */ public int getTransparency(); } - diff --git a/awt/java/awt/color/CMMException.java b/awt/java/awt/color/CMMException.java index 16fe76eae94cf..18b9a7e563960 100644 --- a/awt/java/awt/color/CMMException.java +++ b/awt/java/awt/color/CMMException.java @@ -21,18 +21,22 @@ package java.awt.color; /** - * The CMMException is thrown as soon as a native CMM error - * occures. + * The CMMException is thrown as soon as a native CMM error occurs. + * + * @since Android 1.0 */ public class CMMException extends java.lang.RuntimeException { - /** The Constant serialVersionUID. */ + /** + * The Constant serialVersionUID. + */ private static final long serialVersionUID = 5775558044142994965L; /** * Instantiates a new CMM exception with detail message. * - * @param s the String - detail message. + * @param s + * the detail message of the exception. */ public CMMException (String s) { super (s); diff --git a/awt/java/awt/color/ColorSpace.java b/awt/java/awt/color/ColorSpace.java index f961514106ef6..44c491b749299 100644 --- a/awt/java/awt/color/ColorSpace.java +++ b/awt/java/awt/color/ColorSpace.java @@ -26,131 +26,209 @@ import org.apache.harmony.awt.gl.color.LUTColorConverter; import org.apache.harmony.awt.internal.nls.Messages; /** - * The ColorSpace class defines a color space type for a Color and provides methods - * for arrays of color component operations. + * The ColorSpace class defines a color space type for a Color and provides + * methods for arrays of color component operations. + * + * @since Android 1.0 */ public abstract class ColorSpace implements Serializable { /** The Constant serialVersionUID. */ private static final long serialVersionUID = -409452704308689724L; - /** The Constant TYPE_XYZ indicates XYZ color space type. */ + /** + * The Constant TYPE_XYZ indicates XYZ color space type. + */ public static final int TYPE_XYZ = 0; - /** The Constant TYPE_Lab indicates Lab color space type. */ + /** + * The Constant TYPE_Lab indicates Lab color space type. + */ public static final int TYPE_Lab = 1; - /** The Constant TYPE_Luv indicates Luv color space type. */ + /** + * The Constant TYPE_Luv indicates Luv color space type. + */ public static final int TYPE_Luv = 2; - /** The Constant TYPE_YCbCr indicates YCbCr color space type. */ + /** + * The Constant TYPE_YCbCr indicates YCbCr color space type. + */ public static final int TYPE_YCbCr = 3; - /** The Constant TYPE_Yxy indicates Yxy color space type. */ + /** + * The Constant TYPE_Yxy indicates Yxy color space type. + */ public static final int TYPE_Yxy = 4; - /** The Constant TYPE_RGB indicates RGB color space type. */ + /** + * The Constant TYPE_RGB indicates RGB color space type. + */ public static final int TYPE_RGB = 5; - /** The Constant TYPE_GRAY indicates Gray color space type. */ + /** + * The Constant TYPE_GRAY indicates Gray color space type. + */ public static final int TYPE_GRAY = 6; - /** The Constant TYPE_HSV indicates HSV color space type. */ + /** + * The Constant TYPE_HSV indicates HSV color space type. + */ public static final int TYPE_HSV = 7; - /** The Constant TYPE_HLS indicates HLS color space type. */ + /** + * The Constant TYPE_HLS indicates HLS color space type. + */ public static final int TYPE_HLS = 8; - /** The Constant TYPE_CMYK indicates CMYK color space type. */ + /** + * The Constant TYPE_CMYK indicates CMYK color space type. + */ public static final int TYPE_CMYK = 9; - /** The Constant TYPE_CMY indicates CMY color space type. */ + /** + * The Constant TYPE_CMY indicates CMY color space type. + */ public static final int TYPE_CMY = 11; - /** The Constant TYPE_2CLR indicates color spaces with 2 components. */ + /** + * The Constant TYPE_2CLR indicates color spaces with 2 components. + */ public static final int TYPE_2CLR = 12; - /** The Constant TYPE_3CLR indicates color spaces with 3 components. */ + /** + * The Constant TYPE_3CLR indicates color spaces with 3 components. + */ public static final int TYPE_3CLR = 13; - /** The Constant TYPE_4CLR indicates color spaces with 4 components. */ + /** + * The Constant TYPE_4CLR indicates color spaces with 4 components. + */ public static final int TYPE_4CLR = 14; - /** The Constant TYPE_5CLR indicates color spaces with 5 components. */ + /** + * The Constant TYPE_5CLR indicates color spaces with 5 components. + */ public static final int TYPE_5CLR = 15; - /** The Constant TYPE_6CLR indicates color spaces with 6 components. */ + /** + * The Constant TYPE_6CLR indicates color spaces with 6 components. + */ public static final int TYPE_6CLR = 16; - /** The Constant TYPE_7CLR indicates color spaces with 7 components. */ + /** + * The Constant TYPE_7CLR indicates color spaces with 7 components. + */ public static final int TYPE_7CLR = 17; - /** The Constant TYPE_8CLR indicates color spaces with 8 components. */ + /** + * The Constant TYPE_8CLR indicates color spaces with 8 components. + */ public static final int TYPE_8CLR = 18; - /** The Constant TYPE_9CLR indicates color spaces with 9 components. */ + /** + * The Constant TYPE_9CLR indicates color spaces with 9 components. + */ public static final int TYPE_9CLR = 19; - /** The Constant TYPE_ACLR indicates color spaces with 10 components. */ + /** + * The Constant TYPE_ACLR indicates color spaces with 10 components. + */ public static final int TYPE_ACLR = 20; - /** The Constant TYPE_BCLR indicates color spaces with 11 components. */ + /** + * The Constant TYPE_BCLR indicates color spaces with 11 components. + */ public static final int TYPE_BCLR = 21; - /** The Constant TYPE_CCLR indicates color spaces with 12 components. */ + /** + * The Constant TYPE_CCLR indicates color spaces with 12 components. + */ public static final int TYPE_CCLR = 22; - /** The Constant TYPE_DCLR indicates color spaces with 13 components. */ + /** + * The Constant TYPE_DCLR indicates color spaces with 13 components. + */ public static final int TYPE_DCLR = 23; - /** The Constant TYPE_ECLR indicates color spaces with 14 components. */ + /** + * The Constant TYPE_ECLR indicates color spaces with 14 components. + */ public static final int TYPE_ECLR = 24; - /** The Constant TYPE_FCLR indicates color spaces with 15 components. */ + /** + * The Constant TYPE_FCLR indicates color spaces with 15 components. + */ public static final int TYPE_FCLR = 25; - /** The Constant CS_sRGB indicates standard RGB color space.*/ + /** + * The Constant CS_sRGB indicates standard RGB color space. + */ public static final int CS_sRGB = 1000; - /** The Constant CS_LINEAR_RGB indicates linear RGB color space. */ + /** + * The Constant CS_LINEAR_RGB indicates linear RGB color space. + */ public static final int CS_LINEAR_RGB = 1004; - /** The Constant CS_CIEXYZ indicates CIEXYZ conversion color space. */ + /** + * The Constant CS_CIEXYZ indicates CIEXYZ conversion color space. + */ public static final int CS_CIEXYZ = 1001; - /** The Constant CS_PYCC indicates Photo YCC conversion color space. */ + /** + * The Constant CS_PYCC indicates Photo YCC conversion color space. + */ public static final int CS_PYCC = 1002; - /** The Constant CS_GRAY indicates linear gray scale color space. */ + /** + * The Constant CS_GRAY indicates linear gray scale color space. + */ public static final int CS_GRAY = 1003; - /** The cs_ gray. */ + /** + * The cs_ gray. + */ private static ColorSpace cs_Gray = null; - /** The cs_ pycc. */ + /** + * The cs_ pycc. + */ private static ColorSpace cs_PYCC = null; - /** The cs_ ciexyz. */ + /** + * The cs_ ciexyz. + */ private static ColorSpace cs_CIEXYZ = null; - /** The cs_ lrgb. */ + /** + * The cs_ lrgb. + */ private static ColorSpace cs_LRGB = null; - /** The cs_s rgb. */ + /** + * The cs_s rgb. + */ private static ColorSpace cs_sRGB = null; - /** The type. */ + /** + * The type. + */ private int type; - /** The num components. */ + /** + * The num components. + */ private int numComponents; /** - * Instantiates a ColorSpace with the specified - * ColorSpace type and number of components. + * Instantiates a ColorSpace with the specified ColorSpace type and number + * of components. * - * @param type the type of color space. - * @param numcomponents the number of components. + * @param type + * the type of color space. + * @param numcomponents + * the number of components. */ protected ColorSpace(int type, int numcomponents) { this.numComponents = numcomponents; @@ -160,8 +238,8 @@ public abstract class ColorSpace implements Serializable { /** * Gets the name of the component for the specified component index. * - * @param idx the index of the component. - * + * @param idx + * the index of the component. * @return the name of the component. */ public String getName(int idx) { @@ -174,56 +252,54 @@ public abstract class ColorSpace implements Serializable { } /** - * Perform transformation a color from this ColorSpace - * into the RGB color space. - * - * @param colorvalue the color value in this ColorSpace. + * Performs the transformation of a color from this ColorSpace into the RGB + * color space. * - * @return the float array with color components in the - * RGB color space. + * @param colorvalue + * the color value in this ColorSpace. + * @return the float array with color components in the RGB color space. */ public abstract float[] toRGB(float[] colorvalue); /** - * Perform transformation a color from this ColorSpace - * into the CS_CIEXYZ color space. + * Performs the transformation of a color from this ColorSpace into the + * CS_CIEXYZ color space. * - * @param colorvalue the color value in this ColorSpace. - * - * @return the float array with color components in the - * CS_CIEXYZ color space. + * @param colorvalue + * the color value in this ColorSpace. + * @return the float array with color components in the CS_CIEXYZ color + * space. */ public abstract float[] toCIEXYZ(float[] colorvalue); /** - * Performs color transformation from the RGB color space - * into this ColorSpace. + * Performs the transformation of a color from the RGB color space into this + * ColorSpace. * - * @param rgbvalue a float array in the RGB color space. - * - * @return the float[] an array of transformed color - * components. + * @param rgbvalue + * the float array representing a color in the RGB color space. + * @return the float array with the transformed color components. */ public abstract float[] fromRGB(float[] rgbvalue); /** - * Performs color transformation from the CS_CIEXYZ color space + * Performs the transformation of a color from the CS_CIEXYZ color space * into this ColorSpace. * - * @param colorvalue a float array in the CS_CIEXYZ color space. - * - * @return the float[] an array of transformed color - * components. + * @param colorvalue + * the float array representing a color in the CS_CIEXYZ color + * space. + * @return the float array with the transformed color components. */ public abstract float[] fromCIEXYZ(float[] colorvalue); /** - * Gets the minimum normalized color component value for - * the specified component. - * - * @param component the component. + * Gets the minimum normalized color component value for the specified + * component. * - * @return the miniimum normalized value of the component. + * @param component + * the component to determine the minimum value. + * @return the minimum normalized value of the component. */ public float getMinValue(int component) { if (component < 0 || component > numComponents - 1) { @@ -234,11 +310,11 @@ public abstract class ColorSpace implements Serializable { } /** - * Gets the maximum normalized color component value for - * the specified component. - * - * @param component the component. + * Gets the maximum normalized color component value for the specified + * component. * + * @param component + * the component to determine the maximum value. * @return the maximum normalized value of the component. */ public float getMaxValue(int component) { @@ -252,8 +328,7 @@ public abstract class ColorSpace implements Serializable { /** * Checks if this ColorSpace has CS_sRGB type or not. * - * @return true, if this ColorSpace has CS_sRGB type, - * false otherwise. + * @return true, if this ColorSpace has CS_sRGB type, false otherwise. */ public boolean isCS_sRGB() { // If our color space is sRGB, then cs_sRGB @@ -281,12 +356,11 @@ public abstract class ColorSpace implements Serializable { /** - * Gets the single instance of ColorSpace with the specified - * ColorSpace: CS_sRGB, CS_LINEAR_RGB, CS_CIEXYZ, CS_GRAY, - * or CS_PYCC. - * - * @param colorspace the identifier of the specified Colorspace. + * Gets the single instance of ColorSpace with the specified ColorSpace: + * CS_sRGB, CS_LINEAR_RGB, CS_CIEXYZ, CS_GRAY, or CS_PYCC. * + * @param colorspace + * the identifier of the specified Colorspace. * @return the single instance of the desired ColorSpace. */ public static ColorSpace getInstance(int colorspace) { diff --git a/awt/java/awt/color/ICC_ColorSpace.java b/awt/java/awt/color/ICC_ColorSpace.java index 5ece2efe1935e..5b4d7e99f5cb1 100644 --- a/awt/java/awt/color/ICC_ColorSpace.java +++ b/awt/java/awt/color/ICC_ColorSpace.java @@ -28,19 +28,24 @@ import org.apache.harmony.awt.internal.nls.Messages; import java.io.*; /** - * ICC_ColorSpace class implements ColorSpace abstract class and - * represents device independent and device dependent color spaces. - * This color space is based on the International Color Consortium - * Specification (ICC) File Format for Color Profiles: - * http://www.color.org + * This class implements the abstract class ColorSpace and represents device + * independent and device dependent color spaces. This color space is based on + * the International Color Consortium Specification (ICC) File Format for Color + * Profiles: http://www.color.org + * + * @since Android 1.0 */ public class ICC_ColorSpace extends ColorSpace { - /** The Constant serialVersionUID. */ + /** + * The Constant serialVersionUID. + */ private static final long serialVersionUID = 3455889114070431483L; // Need to keep compatibility with serialized form - /** The Constant serialPersistentFields. */ + /** + * The Constant serialPersistentFields. + */ private static final ObjectStreamField[] serialPersistentFields = { new ObjectStreamField("thisProfile", ICC_Profile.class), //$NON-NLS-1$ @@ -53,63 +58,94 @@ public class ICC_ColorSpace extends ColorSpace { /** - * According to ICC specification (from http://www.color.org) - * "For the CIEXYZ encoding, each component (X, Y, and Z) - * is encoded as a u1Fixed15Number". - * This means that max value for this encoding is 1 + (32767/32768) - */ + * According to ICC specification (from http://www.color.org) "For the + * CIEXYZ encoding, each component (X, Y, and Z) is encoded as a + * u1Fixed15Number". This means that max value for this encoding is 1 + + * (32767/32768) + */ private static final float MAX_XYZ = 1f + (32767f/32768f); - /** The Constant MAX_SHORT. */ + /** + * The Constant MAX_SHORT. + */ private static final float MAX_SHORT = 65535f; - /** The Constant INV_MAX_SHORT. */ + /** + * The Constant INV_MAX_SHORT. + */ private static final float INV_MAX_SHORT = 1f/MAX_SHORT; - /** The Constant SHORT2XYZ_FACTOR. */ + /** + * The Constant SHORT2XYZ_FACTOR. + */ private static final float SHORT2XYZ_FACTOR = MAX_XYZ/MAX_SHORT; - /** The Constant XYZ2SHORT_FACTOR. */ + /** + * The Constant XYZ2SHORT_FACTOR. + */ private static final float XYZ2SHORT_FACTOR = MAX_SHORT/MAX_XYZ; - /** The profile. */ + /** + * The profile. + */ private ICC_Profile profile = null; - /** The min values. */ + /** + * The min values. + */ private float minValues[] = null; - /** The max values. */ + /** + * The max values. + */ private float maxValues[] = null; // cache transforms here - performance gain - /** The to rgb transform. */ + /** + * The to rgb transform. + */ private ICC_Transform toRGBTransform = null; - /** The from rgb transform. */ + /** + * The from rgb transform. + */ private ICC_Transform fromRGBTransform = null; - /** The to xyz transform. */ + /** + * The to xyz transform. + */ private ICC_Transform toXYZTransform = null; - /** The from xyz transform. */ + /** + * The from xyz transform. + */ private ICC_Transform fromXYZTransform = null; - /** The converter. */ + /** + * The converter. + */ private final ColorConverter converter = new ColorConverter(); - /** The scaler. */ + /** + * The scaler. + */ private final ColorScaler scaler = new ColorScaler(); - /** The scaling data loaded. */ + /** + * The scaling data loaded. + */ private boolean scalingDataLoaded = false; - /** The resolved deserialized inst. */ + /** + * The resolved deserialized inst. + */ private ICC_ColorSpace resolvedDeserializedInst; /** * Instantiates a new ICC color space from an ICC_Profile object. * - * @param pf the ICC_Profile object. + * @param pf + * the ICC_Profile object. */ public ICC_ColorSpace(ICC_Profile pf) { super(pf.getColorSpaceType(), pf.getNumComponents()); @@ -132,7 +168,7 @@ public class ICC_ColorSpace extends ColorSpace { } /** - * Returns the ICC_Profile for this ICC_ColorSpace. + * Gets the ICC_Profile for this ICC_ColorSpace. * * @return the ICC_Profile for this ICC_ColorSpace. */ @@ -144,6 +180,14 @@ public class ICC_ColorSpace extends ColorSpace { return profile; } + /** + * Performs the transformation of a color from this ColorSpace into the RGB + * color space. + * + * @param colorvalue + * the color value in this ColorSpace. + * @return the float array with color components in the RGB color space. + */ @Override public float[] toRGB(float[] colorvalue) { if (toRGBTransform == null) { @@ -174,6 +218,15 @@ public class ICC_ColorSpace extends ColorSpace { return res; } + /** + * Performs the transformation of a color from this ColorSpace into the + * CS_CIEXYZ color space. + * + * @param colorvalue + * the color value in this ColorSpace. + * @return the float array with color components in the CS_CIEXYZ color + * space. + */ @Override public float[] toCIEXYZ(float[] colorvalue) { if (toXYZTransform == null) { @@ -212,6 +265,14 @@ public class ICC_ColorSpace extends ColorSpace { return res; } + /** + * Performs the transformation of a color from the RGB color space into this + * ColorSpace. + * + * @param rgbvalue + * the float array representing a color in the RGB color space. + * @return the float array with the transformed color components. + */ @Override public float[] fromRGB(float[] rgbvalue) { if (fromRGBTransform == null) { @@ -241,6 +302,15 @@ public class ICC_ColorSpace extends ColorSpace { return res; } + /** + * Performs the transformation of a color from the CS_CIEXYZ color space + * into this ColorSpace. + * + * @param xyzvalue + * the float array representing a color in the CS_CIEXYZ color + * space. + * @return the float array with the transformed color components. + */ @Override public float[] fromCIEXYZ(float[] xyzvalue) { if (fromXYZTransform == null) { @@ -279,6 +349,14 @@ public class ICC_ColorSpace extends ColorSpace { return res; } + /** + * Gets the minimum normalized color component value for the specified + * component. + * + * @param component + * the component to determine the minimum value. + * @return the minimum normalized value of the component. + */ @Override public float getMinValue(int component) { if ((component < 0) || (component > this.getNumComponents() - 1)) { @@ -289,6 +367,14 @@ public class ICC_ColorSpace extends ColorSpace { return minValues[component]; } + /** + * Gets the maximum normalized color component value for the specified + * component. + * + * @param component + * the component to determine the maximum value. + * @return the maximum normalized value of the component. + */ @Override public float getMaxValue(int component) { if ((component < 0) || (component > this.getNumComponents() - 1)) { @@ -334,9 +420,10 @@ public class ICC_ColorSpace extends ColorSpace { /** * Write object. * - * @param out the out - * - * @throws IOException Signals that an I/O exception has occurred. + * @param out + * the out + * @throws IOException + * Signals that an I/O exception has occurred. */ private void writeObject(ObjectOutputStream out) throws IOException { ObjectOutputStream.PutField fields = out.putFields(); @@ -354,10 +441,12 @@ public class ICC_ColorSpace extends ColorSpace { /** * Read object. * - * @param in the in - * - * @throws IOException Signals that an I/O exception has occurred. - * @throws ClassNotFoundException the class not found exception + * @param in + * the in + * @throws IOException + * Signals that an I/O exception has occurred. + * @throws ClassNotFoundException + * the class not found exception */ private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException { ObjectInputStream.GetField fields = in.readFields(); @@ -369,8 +458,8 @@ public class ICC_ColorSpace extends ColorSpace { * Read resolve. * * @return the object - * - * @throws ObjectStreamException the object stream exception + * @throws ObjectStreamException + * the object stream exception */ Object readResolve() throws ObjectStreamException { return resolvedDeserializedInst; diff --git a/awt/java/awt/color/ICC_Profile.java b/awt/java/awt/color/ICC_Profile.java index ad704e05ea378..8ffee6c4b3218 100644 --- a/awt/java/awt/color/ICC_Profile.java +++ b/awt/java/awt/color/ICC_Profile.java @@ -18,6 +18,7 @@ * @author Oleg V. Khaschansky * @version $Revision$ */ + package java.awt.color; import java.io.File; @@ -40,427 +41,681 @@ import org.apache.harmony.awt.gl.color.NativeCMM; import org.apache.harmony.awt.internal.nls.Messages; /** - * The ICC_Profile class represents a color profile data for color spaces - * based on the International Color Consortium Specification ICC.1:2001-12, - * File Format for Color Profiles. + * The ICC_Profile class represents a color profile data for color spaces based + * on the International Color Consortium Specification ICC.1:2001-12, File + * Format for Color Profiles. + * + * @since Android 1.0 */ public class ICC_Profile implements Serializable { - /** The Constant serialVersionUID. */ + /** + * The Constant serialVersionUID. + */ private static final long serialVersionUID = -3938515861990936766L; // NOTE: Constant field values are noted in 1.5 specification. /** - * The Constant CLASS_INPUT indicates that profile class is input. + * The Constant CLASS_INPUT indicates that profile class is input. */ public static final int CLASS_INPUT = 0; - /** - * The Constant CLASS_DISPLAY indicates that profile class is display. + /** + * The Constant CLASS_DISPLAY indicates that profile class is display. */ public static final int CLASS_DISPLAY = 1; - /** - * The Constant CLASS_OUTPUT indicates that profile class is output. + /** + * The Constant CLASS_OUTPUT indicates that profile class is output. */ public static final int CLASS_OUTPUT = 2; - /** - * The Constant CLASS_DEVICELINK indicates that profile class - * is device link. + /** + * The Constant CLASS_DEVICELINK indicates that profile class is device + * link. */ public static final int CLASS_DEVICELINK = 3; - /** - * The Constant CLASS_COLORSPACECONVERSION indicates that profile class - * is color space conversion. + /** + * The Constant CLASS_COLORSPACECONVERSION indicates that profile class is + * color space conversion. */ public static final int CLASS_COLORSPACECONVERSION = 4; - /** The Constant CLASS_ABSTRACT indicates that profile class is abstract. */ + /** + * The Constant CLASS_ABSTRACT indicates that profile class is abstract. + */ public static final int CLASS_ABSTRACT = 5; - /** - * The Constant CLASS_NAMEDCOLOR indicates that profile class - * is named color. + /** + * The Constant CLASS_NAMEDCOLOR indicates that profile class is named + * color. */ public static final int CLASS_NAMEDCOLOR = 6; - /** The Constant icSigXYZData - ICC Profile Color Space Type Signature. */ + /** + * The Constant icSigXYZData - ICC Profile Color Space Type Signature. + */ public static final int icSigXYZData = 1482250784; - /** The Constant icSigLabData - ICC Profile Color Space Type Signature. */ + /** + * The Constant icSigLabData - ICC Profile Color Space Type Signature. + */ public static final int icSigLabData = 1281450528; - /** The Constant icSigLuvData - ICC Profile Color Space Type Signature. */ + /** + * The Constant icSigLuvData - ICC Profile Color Space Type Signature. + */ public static final int icSigLuvData = 1282766368; - /** The Constant icSigYCbCrData - ICC Profile Color Space Type Signature. */ + /** + * The Constant icSigYCbCrData - ICC Profile Color Space Type Signature. + */ public static final int icSigYCbCrData = 1497588338; - /** The Constant icSigYxyData - ICC Profile Color Space Type Signature. */ + /** + * The Constant icSigYxyData - ICC Profile Color Space Type Signature. + */ public static final int icSigYxyData = 1501067552; - /** The Constant icSigRgbData - ICC Profile Color Space Type Signature. */ + /** + * The Constant icSigRgbData - ICC Profile Color Space Type Signature. + */ public static final int icSigRgbData = 1380401696; - /** The Constant icSigGrayData - ICC Profile Color Space Type Signature. */ + /** + * The Constant icSigGrayData - ICC Profile Color Space Type Signature. + */ public static final int icSigGrayData = 1196573017; - /** The Constant icSigHsvData - ICC Profile Color Space Type Signature. */ + /** + * The Constant icSigHsvData - ICC Profile Color Space Type Signature. + */ public static final int icSigHsvData = 1213421088; - /** The Constant icSigHlsData - ICC Profile Color Space Type Signature. */ + /** + * The Constant icSigHlsData - ICC Profile Color Space Type Signature. + */ public static final int icSigHlsData = 1212961568; - /** The Constant icSigCmykData - ICC Profile Color Space Type Signature. */ + /** + * The Constant icSigCmykData - ICC Profile Color Space Type Signature. + */ public static final int icSigCmykData = 1129142603; - /** The Constant icSigCmyData - ICC Profile Color Space Type Signature. */ + /** + * The Constant icSigCmyData - ICC Profile Color Space Type Signature. + */ public static final int icSigCmyData = 1129142560; - /** The Constant icSigSpace2CLR - ICC Profile Color Space Type Signature. */ + /** + * The Constant icSigSpace2CLR - ICC Profile Color Space Type Signature. + */ public static final int icSigSpace2CLR = 843271250; - /** The Constant icSigSpace3CLR - ICC Profile Color Space Type Signature. */ + /** + * The Constant icSigSpace3CLR - ICC Profile Color Space Type Signature. + */ public static final int icSigSpace3CLR = 860048466; - /** The Constant icSigSpace4CLR - ICC Profile Color Space Type Signature. */ + /** + * The Constant icSigSpace4CLR - ICC Profile Color Space Type Signature. + */ public static final int icSigSpace4CLR = 876825682; - /** The Constant icSigSpace5CLR - ICC Profile Color Space Type Signature. */ + /** + * The Constant icSigSpace5CLR - ICC Profile Color Space Type Signature. + */ public static final int icSigSpace5CLR = 893602898; - /** The Constant icSigSpace6CLR - ICC Profile Color Space Type Signature. */ + /** + * The Constant icSigSpace6CLR - ICC Profile Color Space Type Signature. + */ public static final int icSigSpace6CLR = 910380114; - /** The Constant icSigSpace7CLR - ICC Profile Color Space Type Signature. */ + /** + * The Constant icSigSpace7CLR - ICC Profile Color Space Type Signature. + */ public static final int icSigSpace7CLR = 927157330; - /** The Constant icSigSpace8CLR - ICC Profile Color Space Type Signature. */ + /** + * The Constant icSigSpace8CLR - ICC Profile Color Space Type Signature. + */ public static final int icSigSpace8CLR = 943934546; - /** The Constant icSigSpace9CLR - ICC Profile Color Space Type Signature. */ + /** + * The Constant icSigSpace9CLR - ICC Profile Color Space Type Signature. + */ public static final int icSigSpace9CLR = 960711762; - /** The Constant icSigSpaceACLR - ICC Profile Color Space Type Signature. */ + /** + * The Constant icSigSpaceACLR - ICC Profile Color Space Type Signature. + */ public static final int icSigSpaceACLR = 1094929490; - /** The Constant icSigSpaceBCLR - ICC Profile Color Space Type Signature. */ + /** + * The Constant icSigSpaceBCLR - ICC Profile Color Space Type Signature. + */ public static final int icSigSpaceBCLR = 1111706706; - /** The Constant icSigSpaceCCLR - ICC Profile Color Space Type Signature. */ + /** + * The Constant icSigSpaceCCLR - ICC Profile Color Space Type Signature. + */ public static final int icSigSpaceCCLR = 1128483922; - /** The Constant icSigSpaceDCLR - ICC Profile Color Space Type Signature. */ + /** + * The Constant icSigSpaceDCLR - ICC Profile Color Space Type Signature. + */ public static final int icSigSpaceDCLR = 1145261138; - /** The Constant icSigSpaceECLR - ICC Profile Color Space Type Signature. */ + /** + * The Constant icSigSpaceECLR - ICC Profile Color Space Type Signature. + */ public static final int icSigSpaceECLR = 1162038354; - /** The Constant icSigSpaceFCLR - ICC Profile Color Space Type Signature. */ + /** + * The Constant icSigSpaceFCLR - ICC Profile Color Space Type Signature. + */ public static final int icSigSpaceFCLR = 1178815570; - /** The Constant icSigInputClass - ICC Profile Class Signature. */ + /** + * The Constant icSigInputClass - ICC Profile Class Signature. + */ public static final int icSigInputClass = 1935896178; - /** The Constant icSigDisplayClass - ICC Profile Class Signature. */ + /** + * The Constant icSigDisplayClass - ICC Profile Class Signature. + */ public static final int icSigDisplayClass = 1835955314; - /** The Constant icSigOutputClass - ICC Profile Class Signature. */ + /** + * The Constant icSigOutputClass - ICC Profile Class Signature. + */ public static final int icSigOutputClass = 1886549106; - /** The Constant icSigLinkClass - ICC Profile Class Signature. */ + /** + * The Constant icSigLinkClass - ICC Profile Class Signature. + */ public static final int icSigLinkClass = 1818848875; - /** The Constant icSigAbstractClass - ICC Profile Class Signature. */ + /** + * The Constant icSigAbstractClass - ICC Profile Class Signature. + */ public static final int icSigAbstractClass = 1633842036; - /** The Constant icSigColorantOrderTag - ICC Profile Tag Signature. */ + /** + * The Constant icSigColorantOrderTag - ICC Profile Tag Signature. + */ public static final int icSigColorantOrderTag = 1668051567; - /** The Constant icSigColorantTableTag - ICC Profile Tag Signature. */ + /** + * The Constant icSigColorantTableTag - ICC Profile Tag Signature. + */ public static final int icSigColorantTableTag = 1668051572; - /** The Constant icSigColorSpaceClass - ICC Profile Tag Signature. */ + /** + * The Constant icSigColorSpaceClass - ICC Profile Tag Signature. + */ public static final int icSigColorSpaceClass = 1936744803; - /** The Constant icSigNamedColorClass - ICC Profile Tag Signature. */ + /** + * The Constant icSigNamedColorClass - ICC Profile Tag Signature. + */ public static final int icSigNamedColorClass = 1852662636; - /** The Constant icPerceptual - ICC Profile Rendering Intent. */ + /** + * The Constant icPerceptual - ICC Profile Rendering Intent. + */ public static final int icPerceptual = 0; - /** The Constant icRelativeColorimetric - ICC Profile Rendering Intent. */ + /** + * The Constant icRelativeColorimetric - ICC Profile Rendering Intent. + */ public static final int icRelativeColorimetric = 1; - /** The Constant icSaturation - ICC Profile Rendering Intent. */ + /** + * The Constant icSaturation - ICC Profile Rendering Intent. + */ public static final int icSaturation = 2; - /** The Constant icAbsoluteColorimetric - ICC Profile Rendering Intent. */ + /** + * The Constant icAbsoluteColorimetric - ICC Profile Rendering Intent. + */ public static final int icAbsoluteColorimetric = 3; - /** The Constant icSigHead - ICC Profile Tag Signature. */ + /** + * The Constant icSigHead - ICC Profile Tag Signature. + */ public static final int icSigHead = 1751474532; - /** The Constant icSigAToB0Tag - ICC Profile Tag Signature. */ + /** + * The Constant icSigAToB0Tag - ICC Profile Tag Signature. + */ public static final int icSigAToB0Tag = 1093812784; - /** The Constant icSigAToB1Tag - ICC Profile Tag Signature. */ + /** + * The Constant icSigAToB1Tag - ICC Profile Tag Signature. + */ public static final int icSigAToB1Tag = 1093812785; - /** The Constant icSigAToB2Tag - ICC Profile Tag Signature. */ + /** + * The Constant icSigAToB2Tag - ICC Profile Tag Signature. + */ public static final int icSigAToB2Tag = 1093812786; - /** The Constant icSigBlueColorantTag - ICC Profile Tag Signature. */ + /** + * The Constant icSigBlueColorantTag - ICC Profile Tag Signature. + */ public static final int icSigBlueColorantTag = 1649957210; - /** The Constant icSigBlueMatrixColumnTag - ICC Profile Tag Signature. */ + /** + * The Constant icSigBlueMatrixColumnTag - ICC Profile Tag Signature. + */ public static final int icSigBlueMatrixColumnTag = 1649957210; - /** The Constant icSigBlueTRCTag - ICC Profile Tag Signature. */ + /** + * The Constant icSigBlueTRCTag - ICC Profile Tag Signature. + */ public static final int icSigBlueTRCTag = 1649693251; - /** The Constant icSigBToA0Tag - ICC Profile Tag Signature. */ + /** + * The Constant icSigBToA0Tag - ICC Profile Tag Signature. + */ public static final int icSigBToA0Tag = 1110589744; - /** The Constant icSigBToA1Tag - ICC Profile Tag Signature. */ + /** + * The Constant icSigBToA1Tag - ICC Profile Tag Signature. + */ public static final int icSigBToA1Tag = 1110589745; - /** The Constant icSigBToA2Tag - ICC Profile Tag Signature. */ + /** + * The Constant icSigBToA2Tag - ICC Profile Tag Signature. + */ public static final int icSigBToA2Tag = 1110589746; - /** The Constant icSigCalibrationDateTimeTag - ICC Profile Tag Signature. */ + /** + * The Constant icSigCalibrationDateTimeTag - ICC Profile Tag Signature. + */ public static final int icSigCalibrationDateTimeTag = 1667329140; - /** The Constant icSigCharTargetTag - ICC Profile Tag Signature. */ + /** + * The Constant icSigCharTargetTag - ICC Profile Tag Signature. + */ public static final int icSigCharTargetTag = 1952543335; - /** The Constant icSigCopyrightTag - ICC Profile Tag Signature. */ + /** + * The Constant icSigCopyrightTag - ICC Profile Tag Signature. + */ public static final int icSigCopyrightTag = 1668313716; - /** The Constant icSigCrdInfoTag - ICC Profile Tag Signature. */ + /** + * The Constant icSigCrdInfoTag - ICC Profile Tag Signature. + */ public static final int icSigCrdInfoTag = 1668441193; - /** The Constant icSigDeviceMfgDescTag - ICC Profile Tag Signature. */ + /** + * The Constant icSigDeviceMfgDescTag - ICC Profile Tag Signature. + */ public static final int icSigDeviceMfgDescTag = 1684893284; - /** The Constant icSigDeviceModelDescTag - ICC Profile Tag Signature. */ + /** + * The Constant icSigDeviceModelDescTag - ICC Profile Tag Signature. + */ public static final int icSigDeviceModelDescTag = 1684890724; - /** The Constant icSigDeviceSettingsTag - ICC Profile Tag Signature. */ + /** + * The Constant icSigDeviceSettingsTag - ICC Profile Tag Signature. + */ public static final int icSigDeviceSettingsTag = 1684371059; - /** The Constant icSigGamutTag - ICC Profile Tag Signature. */ + /** + * The Constant icSigGamutTag - ICC Profile Tag Signature. + */ public static final int icSigGamutTag = 1734438260; - /** The Constant icSigGrayTRCTag - ICC Profile Tag Signature. */ + /** + * The Constant icSigGrayTRCTag - ICC Profile Tag Signature. + */ public static final int icSigGrayTRCTag = 1800688195; - /** The Constant icSigGreenColorantTag - ICC Profile Tag Signature. */ + /** + * The Constant icSigGreenColorantTag - ICC Profile Tag Signature. + */ public static final int icSigGreenColorantTag = 1733843290; - /** The Constant icSigGreenMatrixColumnTag - ICC Profile Tag Signature. */ + /** + * The Constant icSigGreenMatrixColumnTag - ICC Profile Tag Signature. + */ public static final int icSigGreenMatrixColumnTag = 1733843290; - /** The Constant icSigGreenTRCTag - ICC Profile Tag Signature. */ + /** + * The Constant icSigGreenTRCTag - ICC Profile Tag Signature. + */ public static final int icSigGreenTRCTag = 1733579331; - /** The Constant icSigLuminanceTag - ICC Profile Tag Signature. */ + /** + * The Constant icSigLuminanceTag - ICC Profile Tag Signature. + */ public static final int icSigLuminanceTag = 1819635049; - /** The Constant icSigMeasurementTag - ICC Profile Tag Signature. */ + /** + * The Constant icSigMeasurementTag - ICC Profile Tag Signature. + */ public static final int icSigMeasurementTag = 1835360627; - /** The Constant icSigMediaBlackPointTag - ICC Profile Tag Signature. */ + /** + * The Constant icSigMediaBlackPointTag - ICC Profile Tag Signature. + */ public static final int icSigMediaBlackPointTag = 1651208308; - /** The Constant icSigMediaWhitePointTag - ICC Profile Tag Signature. */ + /** + * The Constant icSigMediaWhitePointTag - ICC Profile Tag Signature. + */ public static final int icSigMediaWhitePointTag = 2004119668; - /** The Constant icSigNamedColor2Tag - ICC Profile Tag Signature. */ + /** + * The Constant icSigNamedColor2Tag - ICC Profile Tag Signature. + */ public static final int icSigNamedColor2Tag = 1852009522; - /** The Constant icSigOutputResponseTag - ICC Profile Tag Signature. */ + /** + * The Constant icSigOutputResponseTag - ICC Profile Tag Signature. + */ public static final int icSigOutputResponseTag = 1919251312; - /** The Constant icSigPreview0Tag - ICC Profile Tag Signature. */ + /** + * The Constant icSigPreview0Tag - ICC Profile Tag Signature. + */ public static final int icSigPreview0Tag = 1886545200; - /** The Constant icSigPreview1Tag - ICC Profile Tag Signature. */ + /** + * The Constant icSigPreview1Tag - ICC Profile Tag Signature. + */ public static final int icSigPreview1Tag = 1886545201; - /** The Constant icSigPreview2Tag - ICC Profile Tag Signature. */ + /** + * The Constant icSigPreview2Tag - ICC Profile Tag Signature. + */ public static final int icSigPreview2Tag = 1886545202; - /** The Constant icSigProfileDescriptionTag - ICC Profile Tag Signature. */ + /** + * The Constant icSigProfileDescriptionTag - ICC Profile Tag Signature. + */ public static final int icSigProfileDescriptionTag = 1684370275; - /** The Constant icSigProfileSequenceDescTag - ICC Profile Tag Signature. */ + /** + * The Constant icSigProfileSequenceDescTag - ICC Profile Tag Signature. + */ public static final int icSigProfileSequenceDescTag = 1886610801; - /** The Constant icSigPs2CRD0Tag - ICC Profile Tag Signature. */ + /** + * The Constant icSigPs2CRD0Tag - ICC Profile Tag Signature. + */ public static final int icSigPs2CRD0Tag = 1886610480; - /** The Constant icSigPs2CRD1Tag - ICC Profile Tag Signature. */ + /** + * The Constant icSigPs2CRD1Tag - ICC Profile Tag Signature. + */ public static final int icSigPs2CRD1Tag = 1886610481; - /** The Constant icSigPs2CRD2Tag - ICC Profile Tag Signature. */ + /** + * The Constant icSigPs2CRD2Tag - ICC Profile Tag Signature. + */ public static final int icSigPs2CRD2Tag = 1886610482; - /** The Constant icSigPs2CRD3Tag - ICC Profile Tag Signature. */ + /** + * The Constant icSigPs2CRD3Tag - ICC Profile Tag Signature. + */ public static final int icSigPs2CRD3Tag = 1886610483; - /** The Constant icSigPs2CSATag - ICC Profile Tag Signature. */ + /** + * The Constant icSigPs2CSATag - ICC Profile Tag Signature. + */ public static final int icSigPs2CSATag = 1886597747; - /** The Constant icSigPs2RenderingIntentTag - ICC Profile Tag Signature. */ + /** + * The Constant icSigPs2RenderingIntentTag - ICC Profile Tag Signature. + */ public static final int icSigPs2RenderingIntentTag = 1886597737; - /** The Constant icSigRedColorantTag - ICC Profile Tag Signature. */ + /** + * The Constant icSigRedColorantTag - ICC Profile Tag Signature. + */ public static final int icSigRedColorantTag = 1918392666; - /** The Constant icSigRedMatrixColumnTag - ICC Profile Tag Signature. */ + /** + * The Constant icSigRedMatrixColumnTag - ICC Profile Tag Signature. + */ public static final int icSigRedMatrixColumnTag = 1918392666; - /** The Constant icSigRedTRCTag - ICC Profile Tag Signature. */ + /** + * The Constant icSigRedTRCTag - ICC Profile Tag Signature. + */ public static final int icSigRedTRCTag = 1918128707; - /** The Constant icSigScreeningDescTag - ICC Profile Tag Signature. */ + /** + * The Constant icSigScreeningDescTag - ICC Profile Tag Signature. + */ public static final int icSigScreeningDescTag = 1935897188; - /** The Constant icSigScreeningTag - ICC Profile Tag Signature. */ + /** + * The Constant icSigScreeningTag - ICC Profile Tag Signature. + */ public static final int icSigScreeningTag = 1935897198; - /** The Constant icSigTechnologyTag - ICC Profile Tag Signature. */ + /** + * The Constant icSigTechnologyTag - ICC Profile Tag Signature. + */ public static final int icSigTechnologyTag = 1952801640; - /** The Constant icSigUcrBgTag - ICC Profile Tag Signature. */ + /** + * The Constant icSigUcrBgTag - ICC Profile Tag Signature. + */ public static final int icSigUcrBgTag = 1650877472; - /** The Constant icSigViewingCondDescTag - ICC Profile Tag Signature. */ + /** + * The Constant icSigViewingCondDescTag - ICC Profile Tag Signature. + */ public static final int icSigViewingCondDescTag = 1987405156; - /** The Constant icSigViewingConditionsTag - ICC Profile Tag Signature. */ + /** + * The Constant icSigViewingConditionsTag - ICC Profile Tag Signature. + */ public static final int icSigViewingConditionsTag = 1986618743; - /** The Constant icSigChromaticAdaptationTag - ICC Profile Tag Signature. */ + /** + * The Constant icSigChromaticAdaptationTag - ICC Profile Tag Signature. + */ public static final int icSigChromaticAdaptationTag = 1667785060; - /** The Constant icSigChromaticityTag - ICC Profile Tag Signature. */ + /** + * The Constant icSigChromaticityTag - ICC Profile Tag Signature. + */ public static final int icSigChromaticityTag = 1667789421; - /** The Constant icHdrSize - ICC Profile Header Location. */ + /** + * The Constant icHdrSize - ICC Profile Header Location. + */ public static final int icHdrSize = 0; - /** The Constant icHdrCmmId - ICC Profile Header Location. */ + /** + * The Constant icHdrCmmId - ICC Profile Header Location. + */ public static final int icHdrCmmId = 4; - /** The Constant icHdrVersion - ICC Profile Header Location. */ + /** + * The Constant icHdrVersion - ICC Profile Header Location. + */ public static final int icHdrVersion = 8; - /** The Constant icHdrDeviceClass - ICC Profile Header Location. */ + /** + * The Constant icHdrDeviceClass - ICC Profile Header Location. + */ public static final int icHdrDeviceClass = 12; - /** The Constant icHdrColorSpace - ICC Profile Header Location. */ + /** + * The Constant icHdrColorSpace - ICC Profile Header Location. + */ public static final int icHdrColorSpace = 16; - /** The Constant icHdrPcs - ICC Profile Header Location. */ + /** + * The Constant icHdrPcs - ICC Profile Header Location. + */ public static final int icHdrPcs = 20; - /** The Constant icHdrDate - ICC Profile Header Location. */ + /** + * The Constant icHdrDate - ICC Profile Header Location. + */ public static final int icHdrDate = 24; - /** The Constant icHdrMagic - ICC Profile Header Location. */ + /** + * The Constant icHdrMagic - ICC Profile Header Location. + */ public static final int icHdrMagic = 36; - /** The Constant icHdrPlatform - ICC Profile Header Location. */ + /** + * The Constant icHdrPlatform - ICC Profile Header Location. + */ public static final int icHdrPlatform = 40; - /** The Constant icHdrProfileID - ICC Profile Header Location. */ + /** + * The Constant icHdrProfileID - ICC Profile Header Location. + */ public static final int icHdrProfileID = 84; - /** The Constant icHdrFlags - ICC Profile Header Location. */ + /** + * The Constant icHdrFlags - ICC Profile Header Location. + */ public static final int icHdrFlags = 44; - /** The Constant icHdrManufacturer - ICC Profile Header Location. */ + /** + * The Constant icHdrManufacturer - ICC Profile Header Location. + */ public static final int icHdrManufacturer = 48; - /** The Constant icHdrModel - ICC Profile Header Location. */ + /** + * The Constant icHdrModel - ICC Profile Header Location. + */ public static final int icHdrModel = 52; - /** The Constant icHdrAttributes - ICC Profile Header Location. */ + /** + * The Constant icHdrAttributes - ICC Profile Header Location. + */ public static final int icHdrAttributes = 56; - /** The Constant icHdrRenderingIntent - ICC Profile Header Location. */ + /** + * The Constant icHdrRenderingIntent - ICC Profile Header Location. + */ public static final int icHdrRenderingIntent = 64; - /** The Constant icHdrIlluminant - ICC Profile Header Location. */ + /** + * The Constant icHdrIlluminant - ICC Profile Header Location. + */ public static final int icHdrIlluminant = 68; - /** The Constant icHdrCreator - ICC Profile Header Location. */ + /** + * The Constant icHdrCreator - ICC Profile Header Location. + */ public static final int icHdrCreator = 80; - /** The Constant icICCAbsoluteColorimetric - ICC Profile Rendering Intent. */ + /** + * The Constant icICCAbsoluteColorimetric - ICC Profile Rendering Intent. + */ public static final int icICCAbsoluteColorimetric = 3; - /** The Constant icMediaRelativeColorimetric - ICC Profile Rendering Intent. */ + /** + * The Constant icMediaRelativeColorimetric - ICC Profile Rendering Intent. + */ public static final int icMediaRelativeColorimetric = 1; - /** The Constant icTagType - ICC Profile Constant. */ + /** + * The Constant icTagType - ICC Profile Constant. + */ public static final int icTagType = 0; - /** The Constant icTagReserved - ICC Profile Constant. */ + /** + * The Constant icTagReserved - ICC Profile Constant. + */ public static final int icTagReserved = 4; - /** The Constant icCurveCount - ICC Profile Constant. */ + /** + * The Constant icCurveCount - ICC Profile Constant. + */ public static final int icCurveCount = 8; - /** The Constant icCurveData - ICC Profile Constant. */ + /** + * The Constant icCurveData - ICC Profile Constant. + */ public static final int icCurveData = 12; - /** The Constant icXYZNumberX - ICC Profile Constant. */ + /** + * The Constant icXYZNumberX - ICC Profile Constant. + */ public static final int icXYZNumberX = 8; - /** Size of a profile header. */ + /** + * Size of a profile header. + */ private static final int headerSize = 128; - /** header magic number. */ + /** + * header magic number. + */ private static final int headerMagicNumber = 0x61637370; // Cache of predefined profiles - /** The s rgb profile. */ + /** + * The s rgb profile. + */ private static ICC_Profile sRGBProfile; - - /** The xyz profile. */ + + /** + * The xyz profile. + */ private static ICC_Profile xyzProfile; - - /** The gray profile. */ + + /** + * The gray profile. + */ private static ICC_Profile grayProfile; - - /** The pycc profile. */ + + /** + * The pycc profile. + */ private static ICC_Profile pyccProfile; - - /** The linear rgb profile. */ + + /** + * The linear rgb profile. + */ private static ICC_Profile linearRGBProfile; - /** Handle to the current profile. */ + /** + * Handle to the current profile. + */ private transient long profileHandle = 0; - /** If handle is used by another class this object is not responsible for closing profile. */ + /** + * If handle is used by another class this object is not responsible for + * closing profile. + */ private transient boolean handleStolen = false; - /** Cached header data. */ + /** + * Cached header data. + */ private transient byte[] headerData = null; - /** Serialization support. */ + /** + * Serialization support. + */ private transient ICC_Profile openedProfileObject; /** - * Instantiates a new iC c_ profile. + * Instantiates a new ICC profile with the given data. * - * @param data the data + * @param data + * the data. */ private ICC_Profile(byte[] data) { profileHandle = NativeCMM.cmmOpenProfile(data); @@ -476,7 +731,8 @@ public class ICC_Profile implements Serializable { /** * Used to instantiate subclasses (ICC_ProfileGrey and ICC_ProfileRGB). * - * @param profileHandle - should be valid handle to opened color profile + * @param profileHandle + * - should be valid handle to opened color profile */ ICC_Profile(long profileHandle) { this.profileHandle = profileHandle; @@ -487,10 +743,11 @@ public class ICC_Profile implements Serializable { /** * Writes the ICC_Profile to a file with the specified name. * - * @param fileName the file name. - * - * @throws IOException signals that an I/O exception has occurred during - * writing or opening the file. + * @param fileName + * the file name. + * @throws IOException + * if an I/O exception has occurred during writing or opening + * the file. */ public void write(String fileName) throws IOException { FileOutputStream oStream = new FileOutputStream(fileName); @@ -501,9 +758,10 @@ public class ICC_Profile implements Serializable { /** * Serializable implementation. * - * @param s the s - * - * @throws IOException Signals that an I/O exception has occurred. + * @param s + * the s + * @throws IOException + * Signals that an I/O exception has occurred. */ private void writeObject(ObjectOutputStream s) throws IOException { s.defaultWriteObject(); @@ -514,10 +772,12 @@ public class ICC_Profile implements Serializable { /** * Serializable implementation. * - * @param s the s - * - * @throws IOException Signals that an I/O exception has occurred. - * @throws ClassNotFoundException the class not found exception + * @param s + * the s + * @throws IOException + * Signals that an I/O exception has occurred. + * @throws ClassNotFoundException + * the class not found exception */ private void readObject(ObjectInputStream s) throws IOException, ClassNotFoundException { s.defaultReadObject(); @@ -547,9 +807,9 @@ public class ICC_Profile implements Serializable { * Resolves instances being deserialized into instances registered with CMM. * * @return ICC_Profile object for profile registered with CMM. - * - * @throws ObjectStreamException if there is an error in the serialized - * files or during the process of reading them. + * @throws ObjectStreamException + * if there is an error in the serialized files or during the + * process of reading them. */ protected Object readResolve() throws ObjectStreamException { return openedProfileObject; @@ -558,20 +818,23 @@ public class ICC_Profile implements Serializable { /** * Writes the ICC_Profile to an OutputStream. * - * @param s the OutputStream. - * - * @throws IOException signals that an I/O exception has occurred during - * writing or opening OutputStream. + * @param s + * the OutputStream. + * @throws IOException + * signals that an I/O exception has occurred during writing or + * opening OutputStream. */ public void write(OutputStream s) throws IOException { s.write(getData()); } /** - * Sets a tagged data element in the profile from a byte array. + * Sets a tagged data element in the profile from a byte array. * - * @param tagSignature the ICC tag signature for the data element to be set. - * @param tagData the data to be set for the specified tag signature. + * @param tagSignature + * the ICC tag signature for the data element to be set. + * @param tagData + * the data to be set for the specified tag signature. */ public void setData(int tagSignature, byte[] tagData) { NativeCMM.cmmSetProfileElement(profileHandle, tagSignature, tagData); @@ -582,21 +845,17 @@ public class ICC_Profile implements Serializable { } /** - * Gets a tagged data element from the profile as a byte array. - * Elements are identified by tag signatures as defined in - * the ICC specification. - * - * @param tagSignature the ICC tag signature for the data element to get. + * Gets a tagged data element from the profile as a byte array. Elements are + * identified by tag signatures as defined in the ICC specification. * + * @param tagSignature + * the ICC tag signature for the data element to get. * @return a byte array that contains the tagged data element. */ public byte[] getData(int tagSignature) { int tagSize = 0; try { - tagSize = NativeCMM.cmmGetProfileElementSize( - profileHandle, - tagSignature - ); + tagSize = NativeCMM.cmmGetProfileElementSize(profileHandle, tagSignature); } catch (CMMException e) { // We'll get this exception if there's no element with // the specified tag signature @@ -625,7 +884,7 @@ public class ICC_Profile implements Serializable { */ @Override protected void finalize() { - if (profileHandle!=0 && !handleStolen) { + if (profileHandle != 0 && !handleStolen) { NativeCMM.cmmCloseProfile(profileHandle); } @@ -663,16 +922,16 @@ public class ICC_Profile implements Serializable { // Not an ICC profile class // awt.15F=Profile class does not comply with ICC specification throw new IllegalArgumentException(Messages.getString("awt.15F")); //$NON-NLS-1$ - + } /** - * Returns the color space type of the Profile Connection Space (PCS). + * Gets the color space type of the Profile Connection Space (PCS). * * @return the PCS type. */ public int getPCSType() { - return csFromSignature(getIntFromHeader(icHdrPcs)); + return csFromSignature(getIntFromHeader(icHdrPcs)); } /** @@ -740,7 +999,7 @@ public class ICC_Profile implements Serializable { * @return the minor version of this ICC profile. */ public int getMinorVersion() { - return getByteFromHeader(icHdrVersion+1); + return getByteFromHeader(icHdrVersion + 1); } /** @@ -762,13 +1021,14 @@ public class ICC_Profile implements Serializable { } /** - * Tries to open file at the specified path. Path entries can be - * divided by a separator character. + * Tries to open the file at the specified path. Path entries can be divided + * by a separator character. * - * @param path the path - * @param fileName the file name - * - * @return the file input stream + * @param path + * the path to the file. + * @param fileName + * the file name. + * @return the input stream to read the file. */ private static FileInputStream tryPath(String path, String fileName) { FileInputStream fiStream = null; @@ -786,7 +1046,8 @@ public class ICC_Profile implements Serializable { if (fiStream != null) { return fiStream; } - } catch (FileNotFoundException e) {} + } catch (FileNotFoundException e) { + } } return fiStream; @@ -795,18 +1056,18 @@ public class ICC_Profile implements Serializable { /** * Gets the single instance of ICC_Profile from data in the specified file. * - * @param fileName the specified name of file with ICC profile data. - * + * @param fileName + * the specified name of file with ICC profile data. * @return single instance of ICC_Profile. - * - * @throws IOException signals that an I/O error occured while reading the file - * or the file doesn't exist. + * @throws IOException + * signals that an I/O error occurred while reading the file or + * the file does not exist. */ public static ICC_Profile getInstance(String fileName) throws IOException { final String fName = fileName; // to use in the privileged block - FileInputStream fiStream = (FileInputStream) AccessController.doPrivileged( - new PrivilegedAction() { + FileInputStream fiStream = (FileInputStream)AccessController + .doPrivileged(new PrivilegedAction() { public FileInputStream run() { FileInputStream fiStream = null; @@ -816,7 +1077,8 @@ public class ICC_Profile implements Serializable { if (fiStream != null) { return fiStream; } - } catch (FileNotFoundException e) {} + } catch (FileNotFoundException e) { + } // Check java.iccprofile.path entries fiStream = tryPath(System.getProperty("java.iccprofile.path"), fName); //$NON-NLS-1$ @@ -833,9 +1095,8 @@ public class ICC_Profile implements Serializable { // Check directory with java sample profiles String home = System.getProperty("java.home"); //$NON-NLS-1$ if (home != null) { - fiStream = tryPath( - home + File.separatorChar + - "lib" + File.separatorChar + "cmm", fName //$NON-NLS-1$ //$NON-NLS-2$ + fiStream = tryPath(home + File.separatorChar + + "lib" + File.separatorChar + "cmm", fName //$NON-NLS-1$ //$NON-NLS-2$ ); } @@ -854,17 +1115,17 @@ public class ICC_Profile implements Serializable { } /** - * Gets the single instance of ICC_Profile with data in - * the specified InputStream. - * - * @param s the InputStream with ICC profile data. + * Gets the single instance of ICC_Profile with data in the specified + * InputStream. * + * @param s + * the InputStream with ICC profile data. * @return single instance of ICC_Profile. - * - * @throws IOException if an I/O exception has occurred during reading - * from InputStream. - * @throws IllegalArgumentException if the file does not contain valid - * ICC Profile data. + * @throws IOException + * if an I/O exception has occurred during reading from + * InputStream. + * @throws IllegalArgumentException + * if the file does not contain valid ICC Profile data. */ public static ICC_Profile getInstance(InputStream s) throws IOException { byte[] header = new byte[headerSize]; @@ -877,10 +1138,7 @@ public class ICC_Profile implements Serializable { } // Check the profile data for consistency - if ( - ICC_ProfileHelper.getBigEndianFromByteArray(header, icHdrMagic) != - headerMagicNumber - ) { + if (ICC_ProfileHelper.getBigEndianFromByteArray(header, icHdrMagic) != headerMagicNumber) { throw new IllegalArgumentException(invalidDataMessage); } @@ -892,10 +1150,7 @@ public class ICC_Profile implements Serializable { System.arraycopy(header, 0, profileData, 0, headerSize); // Read the profile itself - if ( - s.read(profileData, headerSize, profileSize - headerSize) != - profileSize - headerSize - ) { + if (s.read(profileData, headerSize, profileSize - headerSize) != profileSize - headerSize) { throw new IllegalArgumentException(invalidDataMessage); } @@ -903,16 +1158,15 @@ public class ICC_Profile implements Serializable { } /** - * Gets the single instance of ICC_Profile from the specified data in - * a byte array. + * Gets the single instance of ICC_Profile from the specified data in a byte + * array. * - * @param data the byte array of ICC profile. - * - * @return single instance of ICC_Profile from the specified data in - * a byte array. - * - * @throws IllegalArgumentException if the file does not contain valid - * ICC Profile data. + * @param data + * the byte array of ICC profile. + * @return single instance of ICC_Profile from the specified data in a byte + * array. + * @throws IllegalArgumentException + * if the file does not contain valid ICC Profile data. */ public static ICC_Profile getInstance(byte[] data) { ICC_Profile res = null; @@ -924,29 +1178,28 @@ public class ICC_Profile implements Serializable { throw new IllegalArgumentException(Messages.getString("awt.162")); //$NON-NLS-1$ } - if (System.getProperty("os.name").toLowerCase().indexOf("windows") >= 0) { //$NON-NLS-1$ //$NON-NLS-2$ - try { - if ( res.getColorSpaceType () == ColorSpace.TYPE_RGB && - res.getDataSize(icSigMediaWhitePointTag) > 0 && - res.getDataSize(icSigRedColorantTag) > 0 && - res.getDataSize(icSigGreenColorantTag) > 0 && - res.getDataSize(icSigBlueColorantTag) > 0 && - res.getDataSize(icSigRedTRCTag) > 0 && - res.getDataSize(icSigGreenTRCTag) > 0 && - res.getDataSize(icSigBlueTRCTag) > 0 - ) { - res = new ICC_ProfileRGB(res.getProfileHandle()); - } else if ( res.getColorSpaceType () == ColorSpace.TYPE_GRAY && - res.getDataSize(icSigMediaWhitePointTag) > 0 && - res.getDataSize(icSigGrayTRCTag) > 0 - ) { - res = new ICC_ProfileGray (res.getProfileHandle()); - } + if (System.getProperty("os.name").toLowerCase().indexOf("windows") >= 0) { //$NON-NLS-1$ //$NON-NLS-2$ + try { + if (res.getColorSpaceType() == ColorSpace.TYPE_RGB + && res.getDataSize(icSigMediaWhitePointTag) > 0 + && res.getDataSize(icSigRedColorantTag) > 0 + && res.getDataSize(icSigGreenColorantTag) > 0 + && res.getDataSize(icSigBlueColorantTag) > 0 + && res.getDataSize(icSigRedTRCTag) > 0 + && res.getDataSize(icSigGreenTRCTag) > 0 + && res.getDataSize(icSigBlueTRCTag) > 0) { + res = new ICC_ProfileRGB(res.getProfileHandle()); + } else if (res.getColorSpaceType() == ColorSpace.TYPE_GRAY + && res.getDataSize(icSigMediaWhitePointTag) > 0 + && res.getDataSize(icSigGrayTRCTag) > 0) { + res = new ICC_ProfileGray(res.getProfileHandle()); + } - } catch (CMMException e) { /* return res in this case */ } - } + } catch (CMMException e) { /* return res in this case */ + } + } - return res; + return res; } /** @@ -954,80 +1207,77 @@ public class ICC_Profile implements Serializable { * defined by the ColorSpace class: CS_sRGB, CS_LINEAR_RGB, CS_CIEXYZ, * CS_PYCC, CS_GRAY. * - * @param cspace the type of color space defined in the ColorSpace class. - * + * @param cspace + * the type of color space defined in the ColorSpace class. * @return single instance of ICC_Profile. - * - * @throws IllegalArgumentException is not one of the defined color - * space types. + * @throws IllegalArgumentException + * is not one of the defined color space types. */ public static ICC_Profile getInstance(int cspace) { - try { - switch (cspace) { + try { + switch (cspace) { - case ColorSpace.CS_sRGB: - if (sRGBProfile == null) { - sRGBProfile = getInstance("sRGB.pf"); //$NON-NLS-1$ - } - return sRGBProfile; + case ColorSpace.CS_sRGB: + if (sRGBProfile == null) { + sRGBProfile = getInstance("sRGB.pf"); //$NON-NLS-1$ + } + return sRGBProfile; - case ColorSpace.CS_CIEXYZ: - if (xyzProfile == null) { - xyzProfile = getInstance("CIEXYZ.pf"); //$NON-NLS-1$ - } - return xyzProfile; + case ColorSpace.CS_CIEXYZ: + if (xyzProfile == null) { + xyzProfile = getInstance("CIEXYZ.pf"); //$NON-NLS-1$ + } + return xyzProfile; - case ColorSpace.CS_GRAY: - if (grayProfile == null) { - grayProfile = getInstance("GRAY.pf"); //$NON-NLS-1$ - } - return grayProfile; + case ColorSpace.CS_GRAY: + if (grayProfile == null) { + grayProfile = getInstance("GRAY.pf"); //$NON-NLS-1$ + } + return grayProfile; - case ColorSpace.CS_PYCC: - if (pyccProfile == null) { - pyccProfile = getInstance("PYCC.pf"); //$NON-NLS-1$ - } - return pyccProfile; + case ColorSpace.CS_PYCC: + if (pyccProfile == null) { + pyccProfile = getInstance("PYCC.pf"); //$NON-NLS-1$ + } + return pyccProfile; - case ColorSpace.CS_LINEAR_RGB: - if (linearRGBProfile == null) { - linearRGBProfile = getInstance("LINEAR_RGB.pf"); //$NON-NLS-1$ + case ColorSpace.CS_LINEAR_RGB: + if (linearRGBProfile == null) { + linearRGBProfile = getInstance("LINEAR_RGB.pf"); //$NON-NLS-1$ + } + return linearRGBProfile; + } + + } catch (IOException e) { + // awt.163=Can't open color profile + throw new IllegalArgumentException(Messages.getString("Can't open color profile")); //$NON-NLS-1$ } - return linearRGBProfile; - } - } catch (IOException e) { - // awt.163=Can't open color profile - throw new IllegalArgumentException(Messages.getString("Can't open color profile")); //$NON-NLS-1$ + // awt.164=Not a predefined color space + throw new IllegalArgumentException(Messages.getString("Not a predefined color space")); //$NON-NLS-1$ } - // awt.164=Not a predefined color space - throw new IllegalArgumentException(Messages.getString("Not a predefined color space")); //$NON-NLS-1$ - } - /** * Reads an integer from the profile header at the specified position. * - * @param idx - offset in bytes from the beginning of the header - * - * @return the int from header + * @param idx + * - offset in bytes from the beginning of the header + * @return the integer value from header */ private int getIntFromHeader(int idx) { if (headerData == null) { headerData = getData(icSigHead); } - return ((headerData[idx] & 0xFF) << 24)| - ((headerData[idx+1] & 0xFF) << 16)| - ((headerData[idx+2] & 0xFF) << 8) | - ((headerData[idx+3] & 0xFF)); + return ((headerData[idx] & 0xFF) << 24) | ((headerData[idx + 1] & 0xFF) << 16) + | ((headerData[idx + 2] & 0xFF) << 8) | ((headerData[idx + 3] & 0xFF)); } /** * Reads byte from the profile header at the specified position. * - * @param idx - offset in bytes from the beginning of the header - * + * @param idx + * - offset in bytes from the beginning of the header * @return the byte from header */ private byte getByteFromHeader(int idx) { @@ -1039,11 +1289,11 @@ public class ICC_Profile implements Serializable { } /** - * Converts ICC color space signature to the java predefined - * color space type. - * - * @param signature the signature + * Converts ICC color space signature to the java predefined color space + * type. * + * @param signature + * the signature * @return the int */ private int csFromSignature(int signature) { @@ -1102,7 +1352,7 @@ public class ICC_Profile implements Serializable { } // awt.165=Color space doesn't comply with ICC specification - throw new IllegalArgumentException (Messages.getString("awt.165")); //$NON-NLS-1$ + throw new IllegalArgumentException(Messages.getString("awt.165")); //$NON-NLS-1$ } /** @@ -1118,22 +1368,19 @@ public class ICC_Profile implements Serializable { /** * Gets the data size. * - * @param tagSignature the tag signature - * + * @param tagSignature + * the tag signature * @return the data size */ private int getDataSize(int tagSignature) { - return NativeCMM.cmmGetProfileElementSize( - profileHandle, - tagSignature - ); + return NativeCMM.cmmGetProfileElementSize(profileHandle, tagSignature); } /** * Reads XYZ value from the tag data. * - * @param tagSignature the tag signature - * + * @param tagSignature + * the tag signature * @return the XYZ value */ float[] getXYZValue(int tagSignature) { @@ -1153,20 +1400,20 @@ public class ICC_Profile implements Serializable { /** * Gets the media white point. * - * @return the media white point + * @return the media white point. */ float[] getMediaWhitePoint() { return getXYZValue(icSigMediaWhitePointTag); } /** - * If TRC is not a table returns gamma via return value - * and sets dataTRC to null. If TRC is a table returns 0 - * and fills dataTRC with values. - * - * @param tagSignature the tag signature - * @param dataTRC the data trc + * If TRC is not a table returns gamma via return value and sets dataTRC to + * null. If TRC is a table returns 0 and fills dataTRC with values. * + * @param tagSignature + * the tag signature + * @param dataTRC + * the data trc * @return - gamma or zero if TRC is a table */ private float getGammaOrTRC(int tagSignature, short[] dataTRC) { @@ -1195,8 +1442,8 @@ public class ICC_Profile implements Serializable { /** * Gets the gamma. * - * @param tagSignature the tag signature - * + * @param tagSignature + * the tag signature * @return the gamma */ float getGamma(int tagSignature) { @@ -1211,10 +1458,10 @@ public class ICC_Profile implements Serializable { } /** - * Gets the tRC. - * - * @param tagSignature the tag signature + * Gets the TRC. * + * @param tagSignature + * the tag signature * @return the tRC */ short[] getTRC(int tagSignature) { @@ -1228,4 +1475,3 @@ public class ICC_Profile implements Serializable { return dataTRC; } } - diff --git a/awt/java/awt/color/ICC_ProfileGray.java b/awt/java/awt/color/ICC_ProfileGray.java index f009b18fcd1ad..f74810174298a 100644 --- a/awt/java/awt/color/ICC_ProfileGray.java +++ b/awt/java/awt/color/ICC_ProfileGray.java @@ -22,21 +22,26 @@ package java.awt.color; /** * The ICC_ProfileGray class represent profiles with TYPE_GRAY color space type, - * and includes the grayTRCTag and mediaWhitePointTag tags. + * and includes the grayTRCTag and mediaWhitePointTag tags. The gray component + * can be transformed from a GRAY device profile color space to the CIEXYZ + * Profile through the tone reproduction curve (TRC): + *

    + * PCSY = grayTRC[deviceGray] * - * The gray component can be transformed from a GRAY device profile color space - * to the CIEXYZ Profile through the tone reproduction curve (TRC): - *

    PCSY = grayTRC[deviceGray] + * @since Android 1.0 */ public class ICC_ProfileGray extends ICC_Profile { - /** The Constant serialVersionUID. */ + /** + * The Constant serialVersionUID. + */ private static final long serialVersionUID = -1124721290732002649L; /** * Instantiates a new iC c_ profile gray. * - * @param profileHandle the profile handle + * @param profileHandle + * the profile handle */ ICC_ProfileGray(long profileHandle) { super(profileHandle); @@ -45,12 +50,17 @@ public class ICC_ProfileGray extends ICC_Profile { /** * Gets the TRC as an array of shorts. * - * @return a short array of the TRC. + * @return the short array of the TRC. */ public short[] getTRC() { return super.getTRC(icSigGrayTRCTag); } + /** + * Gets the media white point. + * + * @return the media white point + */ @Override public float[] getMediaWhitePoint() { return super.getMediaWhitePoint(); diff --git a/awt/java/awt/color/ICC_ProfileRGB.java b/awt/java/awt/color/ICC_ProfileRGB.java index beb1a0c24b44d..9c6010fcde63c 100644 --- a/awt/java/awt/color/ICC_ProfileRGB.java +++ b/awt/java/awt/color/ICC_ProfileRGB.java @@ -23,38 +23,58 @@ package java.awt.color; import org.apache.harmony.awt.internal.nls.Messages; /** - * The ICC_ProfileRGB class represents profiles with RGB color space type and - * contains the redColorantTag, greenColorantTag, blueColorantTag, redTRCTag, + * The ICC_ProfileRGB class represents profiles with RGB color space type and + * contains the redColorantTag, greenColorantTag, blueColorantTag, redTRCTag, * greenTRCTag, blueTRCTag, and mediaWhitePointTag tags. + * + * @since Android 1.0 */ public class ICC_ProfileRGB extends ICC_Profile { - /** The Constant serialVersionUID. */ + /** + * The Constant serialVersionUID. + */ private static final long serialVersionUID = 8505067385152579334L; /** - * Instantiates a new iC c_ profile rgb. + * Instantiates a new RGB ICC_Profile. * - * @param profileHandle the profile handle + * @param profileHandle + * the profile handle */ ICC_ProfileRGB(long profileHandle) { super(profileHandle); } - /** The Constant REDCOMPONENT indicates the red component. */ + /** + * The Constant REDCOMPONENT indicates the red component. + */ public static final int REDCOMPONENT = 0; - /** The Constant GREENCOMPONENT indicates the green component. */ + /** + * The Constant GREENCOMPONENT indicates the green component. + */ public static final int GREENCOMPONENT = 1; - /** The Constant BLUECOMPONENT indicates the blue component. */ + /** + * The Constant BLUECOMPONENT indicates the blue component. + */ public static final int BLUECOMPONENT = 2; // awt.15E=Unknown component. Must be REDCOMPONENT, GREENCOMPONENT or BLUECOMPONENT. - /** The Constant UNKNOWN_COMPONENT_MSG. */ + /** + * The Constant UNKNOWN_COMPONENT_MSG. + */ private static final String UNKNOWN_COMPONENT_MSG = Messages .getString("awt.15E"); //$NON-NLS-1$ + /** + * Gets the TRC. + * + * @param component + * the tag signature. + * @return the TRC value. + */ @Override public short[] getTRC(int component) { switch (component) { @@ -70,6 +90,13 @@ public class ICC_ProfileRGB extends ICC_Profile { throw new IllegalArgumentException(UNKNOWN_COMPONENT_MSG); } + /** + * Gets the gamma. + * + * @param component + * the tag signature. + * @return the gamma value. + */ @Override public float getGamma(int component) { switch (component) { @@ -86,11 +113,11 @@ public class ICC_ProfileRGB extends ICC_Profile { } /** - * Gets a float matrix which contains the X, Y, and Z components of - * the profile's redColorantTag, greenColorantTag, and blueColorantTag. + * Gets a float matrix which contains the X, Y, and Z components of the + * profile's redColorantTag, greenColorantTag, and blueColorantTag. * - * @return a float matrix which contains the X, Y, and Z components of - * the profile's redColorantTag, greenColorantTag, and blueColorantTag. + * @return the float matrix which contains the X, Y, and Z components of the + * profile's redColorantTag, greenColorantTag, and blueColorantTag. */ public float[][] getMatrix() { float [][] m = new float[3][3]; // The matrix @@ -114,6 +141,11 @@ public class ICC_ProfileRGB extends ICC_Profile { return m; } + /** + * Gets the media white point. + * + * @return the media white point. + */ @Override public float[] getMediaWhitePoint() { return super.getMediaWhitePoint(); diff --git a/awt/java/awt/color/ProfileDataException.java b/awt/java/awt/color/ProfileDataException.java index ca169fe756699..335f314caf1cd 100644 --- a/awt/java/awt/color/ProfileDataException.java +++ b/awt/java/awt/color/ProfileDataException.java @@ -21,18 +21,23 @@ package java.awt.color; /** - * The ProfileDataException class represents an error which occurs - * while accessing or processing an ICC_Profile object. + * The ProfileDataException class represents an error which occurs while + * accessing or processing an ICC_Profile object. + * + * @since Android 1.0 */ public class ProfileDataException extends RuntimeException { - /** The Constant serialVersionUID. */ + /** + * The Constant serialVersionUID. + */ private static final long serialVersionUID = 7286140888240322498L; /** * Instantiates a new profile data exception with detailed message. * - * @param s the detailed message. + * @param s + * the detailed message of the exception. */ public ProfileDataException(String s) { super(s); diff --git a/awt/java/awt/color/package.html b/awt/java/awt/color/package.html new file mode 100644 index 0000000000000..609d963a80a3f --- /dev/null +++ b/awt/java/awt/color/package.html @@ -0,0 +1,8 @@ + + +

    + This package contains classes representing color spaces and profiles based on the International Color Consortium (ICC) Profile Format Specification. +

    + @since Android 1.0 + + diff --git a/awt/java/awt/event/AWTEventListener.java b/awt/java/awt/event/AWTEventListener.java index f621c9b1559ca..76293b3a7d3d0 100644 --- a/awt/java/awt/event/AWTEventListener.java +++ b/awt/java/awt/event/AWTEventListener.java @@ -23,6 +23,12 @@ package java.awt.event; import java.awt.AWTEvent; import java.util.EventListener; +/** + * This class is not supported in Android 1.0. It is merely provided to maintain + * interface compatibility with desktop Java implementations. + * + * @since Android 1.0 + */ public interface AWTEventListener extends EventListener { public void eventDispatched(AWTEvent event); diff --git a/awt/java/awt/event/AWTEventListenerProxy.java b/awt/java/awt/event/AWTEventListenerProxy.java index 5ee5e59a901b6..3edc41f3e6576 100644 --- a/awt/java/awt/event/AWTEventListenerProxy.java +++ b/awt/java/awt/event/AWTEventListenerProxy.java @@ -26,6 +26,12 @@ import java.util.EventListenerProxy; import org.apache.harmony.awt.internal.nls.Messages; +/** + * This class is not supported in Android 1.0. It is merely provided to maintain + * interface compatibility with desktop Java implementations. + * + * @since Android 1.0 + */ public class AWTEventListenerProxy extends EventListenerProxy implements AWTEventListener { private AWTEventListener listener; diff --git a/awt/java/awt/event/ActionEvent.java b/awt/java/awt/event/ActionEvent.java index c32fc4bd292b1..e882e0db9e376 100644 --- a/awt/java/awt/event/ActionEvent.java +++ b/awt/java/awt/event/ActionEvent.java @@ -22,6 +22,12 @@ package java.awt.event; import java.awt.AWTEvent; +/** + * This class is not supported in Android 1.0. It is merely provided to maintain + * interface compatibility with desktop Java implementations. + * + * @since Android 1.0 + */ public class ActionEvent extends AWTEvent { private static final long serialVersionUID = -7671078796273832149L; diff --git a/awt/java/awt/event/ActionListener.java b/awt/java/awt/event/ActionListener.java index 473d2b682846c..a6eee7a1659ae 100644 --- a/awt/java/awt/event/ActionListener.java +++ b/awt/java/awt/event/ActionListener.java @@ -22,6 +22,12 @@ package java.awt.event; import java.util.EventListener; +/** + * This class is not supported in Android 1.0. It is merely provided to maintain + * interface compatibility with desktop Java implementations. + * + * @since Android 1.0 + */ public interface ActionListener extends EventListener { public void actionPerformed(ActionEvent e); diff --git a/awt/java/awt/event/AdjustmentEvent.java b/awt/java/awt/event/AdjustmentEvent.java index a2b11a8f30448..be2d6c4baf44e 100644 --- a/awt/java/awt/event/AdjustmentEvent.java +++ b/awt/java/awt/event/AdjustmentEvent.java @@ -23,6 +23,12 @@ package java.awt.event; import java.awt.AWTEvent; import java.awt.Adjustable; +/** + * This class is not supported in Android 1.0. It is merely provided to maintain + * interface compatibility with desktop Java implementations. + * + * @since Android 1.0 + */ public class AdjustmentEvent extends AWTEvent { private static final long serialVersionUID = 5700290645205279921L; diff --git a/awt/java/awt/event/AdjustmentListener.java b/awt/java/awt/event/AdjustmentListener.java index ef7c378635ff4..5f6a72473f900 100644 --- a/awt/java/awt/event/AdjustmentListener.java +++ b/awt/java/awt/event/AdjustmentListener.java @@ -22,6 +22,12 @@ package java.awt.event; import java.util.EventListener; +/** + * This class is not supported in Android 1.0. It is merely provided to maintain + * interface compatibility with desktop Java implementations. + * + * @since Android 1.0 + */ public interface AdjustmentListener extends EventListener { public void adjustmentValueChanged(AdjustmentEvent e); diff --git a/awt/java/awt/event/ComponentAdapter.java b/awt/java/awt/event/ComponentAdapter.java index 4f0bd90fd968a..c42235f9678eb 100644 --- a/awt/java/awt/event/ComponentAdapter.java +++ b/awt/java/awt/event/ComponentAdapter.java @@ -20,6 +20,12 @@ */ package java.awt.event; +/** + * This class is not supported in Android 1.0. It is merely provided to maintain + * interface compatibility with desktop Java implementations. + * + * @since Android 1.0 + */ public abstract class ComponentAdapter implements ComponentListener { public ComponentAdapter() { diff --git a/awt/java/awt/event/ComponentEvent.java b/awt/java/awt/event/ComponentEvent.java index d0bca542db64e..760d3abf2a86c 100644 --- a/awt/java/awt/event/ComponentEvent.java +++ b/awt/java/awt/event/ComponentEvent.java @@ -23,6 +23,12 @@ package java.awt.event; import java.awt.AWTEvent; import java.awt.Component; +/** + * This class is not supported in Android 1.0. It is merely provided to maintain + * interface compatibility with desktop Java implementations. + * + * @since Android 1.0 + */ public class ComponentEvent extends AWTEvent { private static final long serialVersionUID = 8101406823902992965L; diff --git a/awt/java/awt/event/ComponentListener.java b/awt/java/awt/event/ComponentListener.java index 147e9e07de75e..a5adba2e9b235 100644 --- a/awt/java/awt/event/ComponentListener.java +++ b/awt/java/awt/event/ComponentListener.java @@ -22,6 +22,12 @@ package java.awt.event; import java.util.EventListener; +/** + * This class is not supported in Android 1.0. It is merely provided to maintain + * interface compatibility with desktop Java implementations. + * + * @since Android 1.0 + */ public interface ComponentListener extends EventListener { public void componentHidden(ComponentEvent e); diff --git a/awt/java/awt/event/ContainerAdapter.java b/awt/java/awt/event/ContainerAdapter.java index 12dc3dea0150a..44983c7930fc0 100644 --- a/awt/java/awt/event/ContainerAdapter.java +++ b/awt/java/awt/event/ContainerAdapter.java @@ -20,6 +20,12 @@ */ package java.awt.event; +/** + * This class is not supported in Android 1.0. It is merely provided to maintain + * interface compatibility with desktop Java implementations. + * + * @since Android 1.0 + */ public abstract class ContainerAdapter implements ContainerListener { public ContainerAdapter() { diff --git a/awt/java/awt/event/ContainerEvent.java b/awt/java/awt/event/ContainerEvent.java index 1a1055c4c9d85..372c9e4775760 100644 --- a/awt/java/awt/event/ContainerEvent.java +++ b/awt/java/awt/event/ContainerEvent.java @@ -23,6 +23,12 @@ package java.awt.event; import java.awt.Component; //???AWT: import java.awt.Container; +/** + * This class is not supported in Android 1.0. It is merely provided to maintain + * interface compatibility with desktop Java implementations. + * + * @since Android 1.0 + */ public class ContainerEvent extends ComponentEvent { private static final long serialVersionUID = -4114942250539772041L; diff --git a/awt/java/awt/event/ContainerListener.java b/awt/java/awt/event/ContainerListener.java index bf47664fc71f0..517859e431028 100644 --- a/awt/java/awt/event/ContainerListener.java +++ b/awt/java/awt/event/ContainerListener.java @@ -22,6 +22,12 @@ package java.awt.event; import java.util.EventListener; +/** + * This class is not supported in Android 1.0. It is merely provided to maintain + * interface compatibility with desktop Java implementations. + * + * @since Android 1.0 + */ public interface ContainerListener extends EventListener { public void componentAdded(ContainerEvent e); diff --git a/awt/java/awt/event/FocusAdapter.java b/awt/java/awt/event/FocusAdapter.java index 3489e110a9aed..3a3e37fb052d4 100644 --- a/awt/java/awt/event/FocusAdapter.java +++ b/awt/java/awt/event/FocusAdapter.java @@ -20,6 +20,12 @@ */ package java.awt.event; +/** + * This class is not supported in Android 1.0. It is merely provided to maintain + * interface compatibility with desktop Java implementations. + * + * @since Android 1.0 + */ public abstract class FocusAdapter implements FocusListener { public FocusAdapter() { diff --git a/awt/java/awt/event/FocusEvent.java b/awt/java/awt/event/FocusEvent.java index 1db5263f4b1e4..4a18689579065 100644 --- a/awt/java/awt/event/FocusEvent.java +++ b/awt/java/awt/event/FocusEvent.java @@ -22,6 +22,12 @@ package java.awt.event; import java.awt.Component; +/** + * This class is not supported in Android 1.0. It is merely provided to maintain + * interface compatibility with desktop Java implementations. + * + * @since Android 1.0 + */ public class FocusEvent extends ComponentEvent { private static final long serialVersionUID = 523753786457416396L; diff --git a/awt/java/awt/event/FocusListener.java b/awt/java/awt/event/FocusListener.java index ee98d9042d23b..6bbbd001f7884 100644 --- a/awt/java/awt/event/FocusListener.java +++ b/awt/java/awt/event/FocusListener.java @@ -22,6 +22,12 @@ package java.awt.event; import java.util.EventListener; +/** + * This class is not supported in Android 1.0. It is merely provided to maintain + * interface compatibility with desktop Java implementations. + * + * @since Android 1.0 + */ public interface FocusListener extends EventListener { public void focusGained(FocusEvent e); diff --git a/awt/java/awt/event/HierarchyBoundsAdapter.java b/awt/java/awt/event/HierarchyBoundsAdapter.java index 24e3d9d0013c7..bbfe8ff2d8137 100644 --- a/awt/java/awt/event/HierarchyBoundsAdapter.java +++ b/awt/java/awt/event/HierarchyBoundsAdapter.java @@ -20,6 +20,12 @@ */ package java.awt.event; +/** + * This class is not supported in Android 1.0. It is merely provided to maintain + * interface compatibility with desktop Java implementations. + * + * @since Android 1.0 + */ public abstract class HierarchyBoundsAdapter implements HierarchyBoundsListener { public HierarchyBoundsAdapter() { diff --git a/awt/java/awt/event/HierarchyBoundsListener.java b/awt/java/awt/event/HierarchyBoundsListener.java index 4288f52d6b2c5..3e8f2e7907370 100644 --- a/awt/java/awt/event/HierarchyBoundsListener.java +++ b/awt/java/awt/event/HierarchyBoundsListener.java @@ -22,6 +22,12 @@ package java.awt.event; import java.util.EventListener; +/** + * This class is not supported in Android 1.0. It is merely provided to maintain + * interface compatibility with desktop Java implementations. + * + * @since Android 1.0 + */ public interface HierarchyBoundsListener extends EventListener { public void ancestorMoved(HierarchyEvent e); diff --git a/awt/java/awt/event/HierarchyEvent.java b/awt/java/awt/event/HierarchyEvent.java index 188166715a48d..c1d22f44cef66 100644 --- a/awt/java/awt/event/HierarchyEvent.java +++ b/awt/java/awt/event/HierarchyEvent.java @@ -24,6 +24,12 @@ import java.awt.AWTEvent; import java.awt.Component; //???AWT: import java.awt.Container; +/** + * This class is not supported in Android 1.0. It is merely provided to maintain + * interface compatibility with desktop Java implementations. + * + * @since Android 1.0 + */ public class HierarchyEvent extends AWTEvent { private static final long serialVersionUID = -5337576970038043990L; diff --git a/awt/java/awt/event/HierarchyListener.java b/awt/java/awt/event/HierarchyListener.java index e01ba11b41638..ff3d9bcfcdbad 100644 --- a/awt/java/awt/event/HierarchyListener.java +++ b/awt/java/awt/event/HierarchyListener.java @@ -22,6 +22,12 @@ package java.awt.event; import java.util.EventListener; +/** + * This class is not supported in Android 1.0. It is merely provided to maintain + * interface compatibility with desktop Java implementations. + * + * @since Android 1.0 + */ public interface HierarchyListener extends EventListener { public void hierarchyChanged(HierarchyEvent e); diff --git a/awt/java/awt/event/InputEvent.java b/awt/java/awt/event/InputEvent.java index c98382d803e99..343b7a3b05411 100644 --- a/awt/java/awt/event/InputEvent.java +++ b/awt/java/awt/event/InputEvent.java @@ -22,6 +22,12 @@ package java.awt.event; import java.awt.Component; +/** + * This class is not supported in Android 1.0. It is merely provided to maintain + * interface compatibility with desktop Java implementations. + * + * @since Android 1.0 + */ public abstract class InputEvent extends ComponentEvent { private static final long serialVersionUID = -2482525981698309786L; diff --git a/awt/java/awt/event/InputMethodEvent.java b/awt/java/awt/event/InputMethodEvent.java index a5cac4e034b52..be001a580572e 100644 --- a/awt/java/awt/event/InputMethodEvent.java +++ b/awt/java/awt/event/InputMethodEvent.java @@ -27,6 +27,12 @@ import java.text.AttributedCharacterIterator; import org.apache.harmony.awt.internal.nls.Messages; +/** + * This class is not supported in Android 1.0. It is merely provided to maintain + * interface compatibility with desktop Java implementations. + * + * @since Android 1.0 + */ public class InputMethodEvent extends AWTEvent { private static final long serialVersionUID = 4727190874778922661L; diff --git a/awt/java/awt/event/InputMethodListener.java b/awt/java/awt/event/InputMethodListener.java index 0ab69180a8d4f..85eaa7e6c19b2 100644 --- a/awt/java/awt/event/InputMethodListener.java +++ b/awt/java/awt/event/InputMethodListener.java @@ -22,6 +22,12 @@ package java.awt.event; import java.util.EventListener; +/** + * This class is not supported in Android 1.0. It is merely provided to maintain + * interface compatibility with desktop Java implementations. + * + * @since Android 1.0 + */ public interface InputMethodListener extends EventListener { public void caretPositionChanged(InputMethodEvent e); diff --git a/awt/java/awt/event/InvocationEvent.java b/awt/java/awt/event/InvocationEvent.java index 59346ed47f582..58e3b7298769c 100644 --- a/awt/java/awt/event/InvocationEvent.java +++ b/awt/java/awt/event/InvocationEvent.java @@ -25,6 +25,12 @@ import java.awt.ActiveEvent; import org.apache.harmony.awt.internal.nls.Messages; +/** + * This class is not supported in Android 1.0. It is merely provided to maintain + * interface compatibility with desktop Java implementations. + * + * @since Android 1.0 + */ public class InvocationEvent extends AWTEvent implements ActiveEvent { private static final long serialVersionUID = 436056344909459450L; diff --git a/awt/java/awt/event/ItemEvent.java b/awt/java/awt/event/ItemEvent.java index 842da14b06210..09908f24f8ef4 100644 --- a/awt/java/awt/event/ItemEvent.java +++ b/awt/java/awt/event/ItemEvent.java @@ -23,6 +23,12 @@ package java.awt.event; import java.awt.AWTEvent; import java.awt.ItemSelectable; +/** + * This class is not supported in Android 1.0. It is merely provided to maintain + * interface compatibility with desktop Java implementations. + * + * @since Android 1.0 + */ public class ItemEvent extends AWTEvent { private static final long serialVersionUID = -608708132447206933L; diff --git a/awt/java/awt/event/ItemListener.java b/awt/java/awt/event/ItemListener.java index 33633be35d462..8dec67322a858 100644 --- a/awt/java/awt/event/ItemListener.java +++ b/awt/java/awt/event/ItemListener.java @@ -22,6 +22,12 @@ package java.awt.event; import java.util.EventListener; +/** + * This class is not supported in Android 1.0. It is merely provided to maintain + * interface compatibility with desktop Java implementations. + * + * @since Android 1.0 + */ public interface ItemListener extends EventListener { public void itemStateChanged(ItemEvent e); diff --git a/awt/java/awt/event/KeyAdapter.java b/awt/java/awt/event/KeyAdapter.java index 423b5c9cd987b..a96cca8d8c2b0 100644 --- a/awt/java/awt/event/KeyAdapter.java +++ b/awt/java/awt/event/KeyAdapter.java @@ -20,6 +20,12 @@ */ package java.awt.event; +/** + * This class is not supported in Android 1.0. It is merely provided to maintain + * interface compatibility with desktop Java implementations. + * + * @since Android 1.0 + */ public abstract class KeyAdapter implements KeyListener { public KeyAdapter() { diff --git a/awt/java/awt/event/KeyEvent.java b/awt/java/awt/event/KeyEvent.java index 056c64cbe8fc5..8627f708d05f0 100644 --- a/awt/java/awt/event/KeyEvent.java +++ b/awt/java/awt/event/KeyEvent.java @@ -27,6 +27,12 @@ import java.lang.reflect.Modifier; import org.apache.harmony.awt.internal.nls.Messages; +/** + * This class is not supported in Android 1.0. It is merely provided to maintain + * interface compatibility with desktop Java implementations. + * + * @since Android 1.0 + */ public class KeyEvent extends InputEvent { private static final long serialVersionUID = -2352130953028126954L; diff --git a/awt/java/awt/event/KeyListener.java b/awt/java/awt/event/KeyListener.java index f20fc90d1987b..ec144dfefc436 100644 --- a/awt/java/awt/event/KeyListener.java +++ b/awt/java/awt/event/KeyListener.java @@ -22,6 +22,12 @@ package java.awt.event; import java.util.EventListener; +/** + * This class is not supported in Android 1.0. It is merely provided to maintain + * interface compatibility with desktop Java implementations. + * + * @since Android 1.0 + */ public interface KeyListener extends EventListener { public void keyPressed(KeyEvent e); diff --git a/awt/java/awt/event/MouseAdapter.java b/awt/java/awt/event/MouseAdapter.java index 4973956a268fa..dc19173c34899 100644 --- a/awt/java/awt/event/MouseAdapter.java +++ b/awt/java/awt/event/MouseAdapter.java @@ -20,6 +20,12 @@ */ package java.awt.event; +/** + * This class is not supported in Android 1.0. It is merely provided to maintain + * interface compatibility with desktop Java implementations. + * + * @since Android 1.0 + */ public abstract class MouseAdapter implements MouseListener { public MouseAdapter() { diff --git a/awt/java/awt/event/MouseEvent.java b/awt/java/awt/event/MouseEvent.java index 0b776f9f0c7ca..2b1fa8b2aae85 100644 --- a/awt/java/awt/event/MouseEvent.java +++ b/awt/java/awt/event/MouseEvent.java @@ -26,6 +26,12 @@ import java.awt.Toolkit; import org.apache.harmony.awt.internal.nls.Messages; +/** + * This class is not supported in Android 1.0. It is merely provided to maintain + * interface compatibility with desktop Java implementations. + * + * @since Android 1.0 + */ public class MouseEvent extends InputEvent { private static final long serialVersionUID = -991214153494842848L; diff --git a/awt/java/awt/event/MouseListener.java b/awt/java/awt/event/MouseListener.java index 5d32b0f921dd3..95879b90e6c38 100644 --- a/awt/java/awt/event/MouseListener.java +++ b/awt/java/awt/event/MouseListener.java @@ -22,6 +22,12 @@ package java.awt.event; import java.util.EventListener; +/** + * This class is not supported in Android 1.0. It is merely provided to maintain + * interface compatibility with desktop Java implementations. + * + * @since Android 1.0 + */ public interface MouseListener extends EventListener { public void mouseClicked(MouseEvent e); diff --git a/awt/java/awt/event/MouseMotionAdapter.java b/awt/java/awt/event/MouseMotionAdapter.java index a4bebcc630f79..1ecd0d5ad52de 100644 --- a/awt/java/awt/event/MouseMotionAdapter.java +++ b/awt/java/awt/event/MouseMotionAdapter.java @@ -20,6 +20,12 @@ */ package java.awt.event; +/** + * This class is not supported in Android 1.0. It is merely provided to maintain + * interface compatibility with desktop Java implementations. + * + * @since Android 1.0 + */ public abstract class MouseMotionAdapter implements MouseMotionListener { public MouseMotionAdapter() { diff --git a/awt/java/awt/event/MouseMotionListener.java b/awt/java/awt/event/MouseMotionListener.java index a5c11da6328bb..e1313c340b7a5 100644 --- a/awt/java/awt/event/MouseMotionListener.java +++ b/awt/java/awt/event/MouseMotionListener.java @@ -22,6 +22,12 @@ package java.awt.event; import java.util.EventListener; +/** + * This class is not supported in Android 1.0. It is merely provided to maintain + * interface compatibility with desktop Java implementations. + * + * @since Android 1.0 + */ public interface MouseMotionListener extends EventListener { public void mouseDragged(MouseEvent e); diff --git a/awt/java/awt/event/MouseWheelEvent.java b/awt/java/awt/event/MouseWheelEvent.java index d3ac9d8c8815c..a3ed42436898e 100644 --- a/awt/java/awt/event/MouseWheelEvent.java +++ b/awt/java/awt/event/MouseWheelEvent.java @@ -22,6 +22,12 @@ package java.awt.event; import java.awt.Component; +/** + * This class is not supported in Android 1.0. It is merely provided to maintain + * interface compatibility with desktop Java implementations. + * + * @since Android 1.0 + */ public class MouseWheelEvent extends MouseEvent { private static final long serialVersionUID = -9187413581993563929L; diff --git a/awt/java/awt/event/MouseWheelListener.java b/awt/java/awt/event/MouseWheelListener.java index 8ca1c8b8f790f..2d6a98236b2a9 100644 --- a/awt/java/awt/event/MouseWheelListener.java +++ b/awt/java/awt/event/MouseWheelListener.java @@ -22,6 +22,12 @@ package java.awt.event; import java.util.EventListener; +/** + * This class is not supported in Android 1.0. It is merely provided to maintain + * interface compatibility with desktop Java implementations. + * + * @since Android 1.0 + */ public interface MouseWheelListener extends EventListener { public void mouseWheelMoved(MouseWheelEvent e); diff --git a/awt/java/awt/event/PaintEvent.java b/awt/java/awt/event/PaintEvent.java index d0573e16e21fc..22ac0908df17c 100644 --- a/awt/java/awt/event/PaintEvent.java +++ b/awt/java/awt/event/PaintEvent.java @@ -23,6 +23,12 @@ package java.awt.event; import java.awt.Component; import java.awt.Rectangle; +/** + * This class is not supported in Android 1.0. It is merely provided to maintain + * interface compatibility with desktop Java implementations. + * + * @since Android 1.0 + */ public class PaintEvent extends ComponentEvent { private static final long serialVersionUID = 1267492026433337593L; diff --git a/awt/java/awt/event/TextEvent.java b/awt/java/awt/event/TextEvent.java index e2bfd96a9339e..2a690ad50d319 100644 --- a/awt/java/awt/event/TextEvent.java +++ b/awt/java/awt/event/TextEvent.java @@ -22,6 +22,12 @@ package java.awt.event; import java.awt.AWTEvent; +/** + * This class is not supported in Android 1.0. It is merely provided to maintain + * interface compatibility with desktop Java implementations. + * + * @since Android 1.0 + */ public class TextEvent extends AWTEvent { private static final long serialVersionUID = 6269902291250941179L; diff --git a/awt/java/awt/event/TextListener.java b/awt/java/awt/event/TextListener.java index 6c5a671d2b6c2..05757c42ac415 100644 --- a/awt/java/awt/event/TextListener.java +++ b/awt/java/awt/event/TextListener.java @@ -22,6 +22,12 @@ package java.awt.event; import java.util.EventListener; +/** + * This class is not supported in Android 1.0. It is merely provided to maintain + * interface compatibility with desktop Java implementations. + * + * @since Android 1.0 + */ public interface TextListener extends EventListener { public void textValueChanged(TextEvent e); diff --git a/awt/java/awt/event/WindowAdapter.java b/awt/java/awt/event/WindowAdapter.java index 9d4b37784ae17..970aa8de45a5b 100644 --- a/awt/java/awt/event/WindowAdapter.java +++ b/awt/java/awt/event/WindowAdapter.java @@ -20,6 +20,12 @@ */ package java.awt.event; +/** + * This class is not supported in Android 1.0. It is merely provided to maintain + * interface compatibility with desktop Java implementations. + * + * @since Android 1.0 + */ public abstract class WindowAdapter implements WindowListener, WindowStateListener, WindowFocusListener { public WindowAdapter() { diff --git a/awt/java/awt/event/WindowEvent.java b/awt/java/awt/event/WindowEvent.java index 65a30e4a36cfb..474d2ac82bd8a 100644 --- a/awt/java/awt/event/WindowEvent.java +++ b/awt/java/awt/event/WindowEvent.java @@ -25,6 +25,12 @@ package java.awt.event; //import java.awt.Window; //import java.awt.Frame; +/** + * This class is not supported in Android 1.0. It is merely provided to maintain + * interface compatibility with desktop Java implementations. + * + * @since Android 1.0 + */ public class WindowEvent extends ComponentEvent { private static final long serialVersionUID = -1567959133147912127L; diff --git a/awt/java/awt/event/WindowFocusListener.java b/awt/java/awt/event/WindowFocusListener.java index e0200f282665d..528459f3b510d 100644 --- a/awt/java/awt/event/WindowFocusListener.java +++ b/awt/java/awt/event/WindowFocusListener.java @@ -22,6 +22,12 @@ package java.awt.event; import java.util.EventListener; +/** + * This class is not supported in Android 1.0. It is merely provided to maintain + * interface compatibility with desktop Java implementations. + * + * @since Android 1.0 + */ public interface WindowFocusListener extends EventListener { public void windowGainedFocus(WindowEvent e); diff --git a/awt/java/awt/event/WindowListener.java b/awt/java/awt/event/WindowListener.java index 20a2b08800783..31bd547bd385e 100644 --- a/awt/java/awt/event/WindowListener.java +++ b/awt/java/awt/event/WindowListener.java @@ -22,6 +22,12 @@ package java.awt.event; import java.util.EventListener; +/** + * This class is not supported in Android 1.0. It is merely provided to maintain + * interface compatibility with desktop Java implementations. + * + * @since Android 1.0 + */ public interface WindowListener extends EventListener { public void windowActivated(WindowEvent e); diff --git a/awt/java/awt/event/WindowStateListener.java b/awt/java/awt/event/WindowStateListener.java index 12dbc2085e90f..ba14d9ee8d65e 100644 --- a/awt/java/awt/event/WindowStateListener.java +++ b/awt/java/awt/event/WindowStateListener.java @@ -22,6 +22,12 @@ package java.awt.event; import java.util.EventListener; +/** + * This class is not supported in Android 1.0. It is merely provided to maintain + * interface compatibility with desktop Java implementations. + * + * @since Android 1.0 + */ public interface WindowStateListener extends EventListener { public void windowStateChanged(WindowEvent e); diff --git a/awt/java/awt/font/FontRenderContext.java b/awt/java/awt/font/FontRenderContext.java index 766300d7d00d5..d7de00f2090d6 100644 --- a/awt/java/awt/font/FontRenderContext.java +++ b/awt/java/awt/font/FontRenderContext.java @@ -23,23 +23,30 @@ package java.awt.font; import java.awt.geom.AffineTransform; /** - * The FontRenderContext class contains the information - * about text measurement. Anti-aliasing and fractional-metrics - * modes are defined by an application and affect the size of - * a character. + * The FontRenderContext class contains the information about text measurement. + * Anti-aliasing and fractional-metrics modes are defined by an application and + * affect the size of a character. + * + * @since Android 1.0 */ public class FontRenderContext { // Affine transform of this mode - /** The transform. */ + /** + * The transform. + */ private AffineTransform transform; // Is the anti-aliased mode used - /** The anti aliased. */ + /** + * The anti aliased. + */ private boolean fAntiAliased; // Is the fractional metrics used - /** The fractional metrics. */ + /** + * The fractional metrics. + */ private boolean fFractionalMetrics; @@ -47,9 +54,12 @@ public class FontRenderContext { * Instantiates a new FontRenderContext object with the specified * AffineTransform, anti-aliasing and fractional metrics flags. * - * @param trans the AffineTransform. - * @param antiAliased the anti-aliasing flag. - * @param usesFractionalMetrics the fractional metrics flag. + * @param trans + * the AffineTransform. + * @param antiAliased + * the anti-aliasing flag. + * @param usesFractionalMetrics + * the fractional metrics flag. */ public FontRenderContext(AffineTransform trans, boolean antiAliased, boolean usesFractionalMetrics) { @@ -67,12 +77,12 @@ public class FontRenderContext { } /** - * Compares the specified Object with current FontRenderContext object. - * - * @param obj the Object to be compared. + * Compares the specified Object with current FontRenderContext object. * + * @param obj + * the Object to be compared. * @return true, if the specified Object is equal to current - * FontRenderContext object. + * FontRenderContext object. */ @Override public boolean equals(Object obj) { @@ -92,11 +102,11 @@ public class FontRenderContext { } /** - * Gets the transform which is used for scaling typographical points - * to pixels in this FontRenderContext. + * Gets the transform which is used for scaling typographical points to + * pixels in this FontRenderContext. * - * @return the AffineTransform which is used for scaling typographical - * points to pixels in this FontRenderContext. + * @return the AffineTransform which is used for scaling typographical + * points to pixels in this FontRenderContext. */ public AffineTransform getTransform() { if (transform != null){ @@ -106,13 +116,13 @@ public class FontRenderContext { } /** - * Compares the specified FontRenderContext object with current + * Compares the specified FontRenderContext object with current * FontRenderContext. * - * @param frc the FontRenderContext object to be compared. - * - * @return true, if the specified FontRenderContext object is - * equal to current FontRenderContext. + * @param frc + * the FontRenderContext object to be compared. + * @return true, if the specified FontRenderContext object is equal to + * current FontRenderContext. */ public boolean equals(FontRenderContext frc) { if (this == frc){ @@ -132,11 +142,11 @@ public class FontRenderContext { } /** - * Returns true if the text fractional metrics are used in - * this FontRenderContext. + * Returns true if the text fractional metrics are used in this + * FontRenderContext. * - * @return true, if the text fractional metrics are used in - * this FontRenderContext, false otherwise. + * @return true, if the text fractional metrics are used in this + * FontRenderContext, false otherwise. */ public boolean usesFractionalMetrics() { return this.fFractionalMetrics; @@ -146,7 +156,7 @@ public class FontRenderContext { * Returns true if anti-aliasing is used in this FontRenderContext. * * @return true, if is anti-aliasing is used in this FontRenderContext, - * false otherwise. + * false otherwise. */ public boolean isAntiAliased() { return this.fAntiAliased; diff --git a/awt/java/awt/font/GlyphJustificationInfo.java b/awt/java/awt/font/GlyphJustificationInfo.java index 4c3e02ea7dec0..b03de0aa15e4d 100644 --- a/awt/java/awt/font/GlyphJustificationInfo.java +++ b/awt/java/awt/font/GlyphJustificationInfo.java @@ -18,124 +18,134 @@ * @author Ilya S. Okomin * @version $Revision$ */ + package java.awt.font; import org.apache.harmony.awt.internal.nls.Messages; /** - * The GlyphJustificationInfo class provides information about - * the glyph's justification properties. There are four justification - * properties: weight, priority, absorb, and limit. + * The GlyphJustificationInfo class provides information about the glyph's + * justification properties. There are four justification properties: weight, + * priority, absorb, and limit. *

    - * There are two sets of metrics: growing and shrinking. - * Growing metrics are used when the glyphs are to be spread apart - * to fit a larger width. Shrinking metrics are used when the glyphs - * are to be moved together to fit a smaller width. + * There are two sets of metrics: growing and shrinking. Growing metrics are + * used when the glyphs are to be spread apart to fit a larger width. Shrinking + * metrics are used when the glyphs are to be moved together to fit a smaller + * width. + *

    + * + * @since Android 1.0 */ public final class GlyphJustificationInfo { - /** - * The Constant PRIORITY_KASHIDA indicates the highest - * justification priority. + /** + * The Constant PRIORITY_KASHIDA indicates the highest justification + * priority. */ public static final int PRIORITY_KASHIDA = 0; /** - * The Constant PRIORITY_WHITESPACE indicates the second highest - * justification priority. + * The Constant PRIORITY_WHITESPACE indicates the second highest + * justification priority. */ public static final int PRIORITY_WHITESPACE = 1; - /** - * The Constant PRIORITY_INTERCHAR indicates the second lowest - * justification priority. + /** + * The Constant PRIORITY_INTERCHAR indicates the second lowest justification + * priority. */ public static final int PRIORITY_INTERCHAR = 2; /** - * The Constant PRIORITY_NONE indicates the lowest justification - * priority. + * The Constant PRIORITY_NONE indicates the lowest justification priority. */ public static final int PRIORITY_NONE = 3; - /** - * The grow absorb flag indicates if this glyph absorbs all extra - * space at this and lower priority levels when it grows. + /** + * The grow absorb flag indicates if this glyph absorbs all extra space at + * this and lower priority levels when it grows. */ public final boolean growAbsorb; - /** - * The grow left limit value represents the maximum value by which - * the left side of this glyph grows. + /** + * The grow left limit value represents the maximum value by which the left + * side of this glyph grows. */ public final float growLeftLimit; - /** - * The grow right limit value repesents the maximum value by which - * the right side of this glyph grows. + /** + * The grow right limit value repesents the maximum value by which the right + * side of this glyph grows. */ public final float growRightLimit; - /** - * The grow priority value represents the priority level of this - * glyph as it is growing. + /** + * The grow priority value represents the priority level of this glyph as it + * is growing. */ public final int growPriority; - /** - * The shrink absorb fleg indicates this glyph absorbs all remaining - * shrinkage at this and lower priority levels as it shrinks. + /** + * The shrink absorb fleg indicates this glyph absorbs all remaining + * shrinkage at this and lower priority levels as it shrinks. */ public final boolean shrinkAbsorb; - /** - * The shrink left limit value represents the maximum value by which - * the left side of this glyph shrinks. + /** + * The shrink left limit value represents the maximum value by which the + * left side of this glyph shrinks. */ public final float shrinkLeftLimit; - /** - * The shrink right limit value represents the maximum value by which - * the right side of this glyph shrinks. + /** + * The shrink right limit value represents the maximum value by which the + * right side of this glyph shrinks. */ public final float shrinkRightLimit; /** - * The shrink priority represents the glyth's priority level - * as it is shrinking. + * The shrink priority represents the glyth's priority level as it is + * shrinking. */ public final int shrinkPriority; - /** - * The weight of the glyph. + /** + * The weight of the glyph. */ public final float weight; /** - * Instantiates a new GlyphJustificationInfo object which contains - * glyph's justification properties. + * Instantiates a new GlyphJustificationInfo object which contains glyph's + * justification properties. * - * @param weight the weight of glyph. - * @param growAbsorb indicates if this glyph contais all space - * at this priority and lower priority levels when it grows. - * @param growPriority indicates the priority level of this glyph - * when it grows. - * @param growLeftLimit indicates the maximum value of which the - * left side of this glyph can grow. - * @param growRightLimit the maximum value of which the right side of - * this glyph can grow. - * @param shrinkAbsorb indicates if this glyph contains all remaining - * shrinkage at this and lower priority levels when it shrinks. - * @param shrinkPriority indicates the glyph's priority level when - * it shrinks. - * @param shrinkLeftLimit indicates the maximum value of which - * the left side of this glyph can shrink. - * @param shrinkRightLimit indicates the maximum amount by which - * the right side of this glyph can shrink. + * @param weight + * the weight of glyph. + * @param growAbsorb + * indicates if this glyph contais all space at this priority and + * lower priority levels when it grows. + * @param growPriority + * indicates the priority level of this glyph when it grows. + * @param growLeftLimit + * indicates the maximum value of which the left side of this + * glyph can grow. + * @param growRightLimit + * the maximum value of which the right side of this glyph can + * grow. + * @param shrinkAbsorb + * indicates if this glyph contains all remaining shrinkage at + * this and lower priority levels when it shrinks. + * @param shrinkPriority + * indicates the glyph's priority level when it shrinks. + * @param shrinkLeftLimit + * indicates the maximum value of which the left side of this + * glyph can shrink. + * @param shrinkRightLimit + * indicates the maximum amount by which the right side of this + * glyph can shrink. */ public GlyphJustificationInfo(float weight, boolean growAbsorb, int growPriority, - float growLeftLimit, float growRightLimit, boolean shrinkAbsorb, - int shrinkPriority, float shrinkLeftLimit, float shrinkRightLimit) { + float growLeftLimit, float growRightLimit, boolean shrinkAbsorb, int shrinkPriority, + float shrinkLeftLimit, float shrinkRightLimit) { if (weight < 0) { // awt.19C=weight must be a positive number @@ -156,13 +166,15 @@ public final class GlyphJustificationInfo { this.growRightLimit = growRightLimit; if ((shrinkPriority < 0) || (shrinkPriority > PRIORITY_NONE)) { - // awt.19F=incorrect value for shrinkPriority, more than PRIORITY_NONE or less than PRIORITY_KASHIDA value + // awt.19F=incorrect value for shrinkPriority, more than + // PRIORITY_NONE or less than PRIORITY_KASHIDA value throw new IllegalArgumentException(Messages.getString("awt.19F")); //$NON-NLS-1$ } this.shrinkPriority = shrinkPriority; if ((growPriority < 0) || (growPriority > PRIORITY_NONE)) { - // awt.200=incorrect value for growPriority, more than PRIORITY_NONE or less than PRIORITY_KASHIDA value + // awt.200=incorrect value for growPriority, more than PRIORITY_NONE + // or less than PRIORITY_KASHIDA value throw new IllegalArgumentException(Messages.getString("awt.200")); //$NON-NLS-1$ } this.growPriority = growPriority; diff --git a/awt/java/awt/font/GlyphMetrics.java b/awt/java/awt/font/GlyphMetrics.java index d96ef1815756d..287172231be49 100644 --- a/awt/java/awt/font/GlyphMetrics.java +++ b/awt/java/awt/font/GlyphMetrics.java @@ -18,82 +18,98 @@ * @author Ilya S. Okomin * @version $Revision$ */ + package java.awt.font; import java.awt.geom.Rectangle2D; /** - * The GlyphMetrics class provides information about the size and shape - * of a single glyph. - * Each glyph has information to specify whether its baseline is horizontal - * or vertical as well as information on how it interacts with - * other characters in a text, given as one of the - * following types: STANDARD, LIGATURE, COMBINING, or COMPONENT. + * The GlyphMetrics class provides information about the size and shape of a + * single glyph. Each glyph has information to specify whether its baseline is + * horizontal or vertical as well as information on how it interacts with other + * characters in a text, given as one of the following types: STANDARD, + * LIGATURE, COMBINING, or COMPONENT. + * + * @since Android 1.0 */ public final class GlyphMetrics { // advance width of the glyph character cell - /** The advance x. */ + /** + * The advance x. + */ private float advanceX; - + // advance height of the glyph character cell - /** The advance y. */ + /** + * The advance y. + */ private float advanceY; // flag if the glyph horizontal - /** The horizontal. */ + /** + * The horizontal. + */ private boolean horizontal; - // glyph type code - /** The glyph type. */ + // glyph type code + /** + * The glyph type. + */ private byte glyphType; - + // bounding box for outline of the glyph - /** The bounds. */ + /** + * The bounds. + */ private Rectangle2D.Float bounds; - /** - * The Constant STANDARD indicates a glyph that represents a single - * character. + /** + * The Constant STANDARD indicates a glyph that represents a single + * character. */ public static final byte STANDARD = 0; - /** - * The Constant LIGATURE indicates a glyph that represents multiple - * characters as a ligature. + /** + * The Constant LIGATURE indicates a glyph that represents multiple + * characters as a ligature. */ public static final byte LIGATURE = 1; - /** - * The Constant COMBINING indicates a glyph which has no caret position + /** + * The Constant COMBINING indicates a glyph which has no caret position * between glyphs (for example umlaut). */ public static final byte COMBINING = 2; - /** - * The Constant COMPONENT indicates a glyph with no corresponding character + /** + * The Constant COMPONENT indicates a glyph with no corresponding character * in the backing store. */ public static final byte COMPONENT = 3; - /** - * The Constant WHITESPACE indicates a glyph without visual - * representation. + /** + * The Constant WHITESPACE indicates a glyph without visual representation. */ public static final byte WHITESPACE = 4; /** * Instantiates a new GlyphMetrics object with the specified parameters. * - * @param horizontal specifies if metrics are for a horizontal baseline - * (true value), or a vertical baseline (false value). - * @param advanceX the X component of the glyph's advance. - * @param advanceY the Y component of the glyph's advance. - * @param bounds the glyph's bounds. - * @param glyphType the glyph's type. - */ - public GlyphMetrics(boolean horizontal, float advanceX, float advanceY, - Rectangle2D bounds, byte glyphType) { + * @param horizontal + * specifies if metrics are for a horizontal baseline (true + * value), or a vertical baseline (false value). + * @param advanceX + * the X component of the glyph's advance. + * @param advanceY + * the Y component of the glyph's advance. + * @param bounds + * the glyph's bounds. + * @param glyphType + * the glyph's type. + */ + public GlyphMetrics(boolean horizontal, float advanceX, float advanceY, Rectangle2D bounds, + byte glyphType) { this.horizontal = horizontal; this.advanceX = advanceX; this.advanceY = advanceY; @@ -107,9 +123,12 @@ public final class GlyphMetrics { /** * Instantiates a new horizontal GlyphMetrics with the specified parameters. * - * @param advanceX the X component of the glyph's advance. - * @param bounds the glyph's bounds. - * @param glyphType the glyph's type. + * @param advanceX + * the X component of the glyph's advance. + * @param bounds + * the glyph's bounds. + * @param glyphType + * the glyph's type. */ public GlyphMetrics(float advanceX, Rectangle2D bounds, byte glyphType) { this.advanceX = advanceX; @@ -129,7 +148,7 @@ public final class GlyphMetrics { * @return glyph's bounds. */ public Rectangle2D getBounds2D() { - return (Rectangle2D.Float) this.bounds.clone(); + return (Rectangle2D.Float)this.bounds.clone(); } /** @@ -187,11 +206,11 @@ public final class GlyphMetrics { } /** - * Gets the distance from the right (for horizontal) or - * bottom (for vertical) of the glyph bounds to the advance. + * Gets the distance from the right (for horizontal) or bottom (for + * vertical) of the glyph bounds to the advance. * - * @return the distance from the right (for horizontal) or - * bottom (for vertical) of the glyph bounds to the advance. + * @return the distance from the right (for horizontal) or bottom (for + * vertical) of the glyph bounds to the advance. */ public float getRSB() { if (this.horizontal) { @@ -201,11 +220,11 @@ public final class GlyphMetrics { } /** - * Gets the distance from 0, 0 to the left (for horizontal) - * or top (for vertical) of the glyph bounds. + * Gets the distance from 0, 0 to the left (for horizontal) or top (for + * vertical) of the glyph bounds. * - * @return the distance from 0, 0 to the left (for horizontal) - * or top (for vertical) of the glyph bounds. + * @return the distance from 0, 0 to the left (for horizontal) or top (for + * vertical) of the glyph bounds. */ public float getLSB() { if (this.horizontal) { @@ -245,4 +264,3 @@ public final class GlyphMetrics { } } - diff --git a/awt/java/awt/font/GlyphVector.java b/awt/java/awt/font/GlyphVector.java index b3c9406a9b1b7..a72b774bfad25 100644 --- a/awt/java/awt/font/GlyphVector.java +++ b/awt/java/awt/font/GlyphVector.java @@ -18,6 +18,7 @@ * @author Ilya S. Okomin * @version $Revision$ */ + package java.awt.font; import java.awt.Font; @@ -32,45 +33,47 @@ import java.awt.geom.Point2D; import java.awt.geom.Rectangle2D; /** - * The GlyphVector class contains a collection of glyphs with geometric - * information and each glyph's location. Each GlyphVector can be associated - * with only one Font. GlyphVector contains the following properties for - * each glyph: + * The GlyphVector class contains a collection of glyphs with geometric + * information and each glyph's location. Each GlyphVector can be associated + * with only one Font. GlyphVector contains the following properties for each + * glyph: *
      *
    • the glyph position;
    • *
    • the transform of the glyph;
    • *
    • the metrics of the glyph in the context of the GlyphVector.
    • *
    + * + * @since Android 1.0 */ public abstract class GlyphVector implements Cloneable { - /** - * The Constant FLAG_HAS_TRANSFORMS indicates that this GlyphVector - * has per-glyph transforms. + /** + * The Constant FLAG_HAS_TRANSFORMS indicates that this GlyphVector has + * per-glyph transforms. */ public static final int FLAG_HAS_TRANSFORMS = 1; - /** - * The Constant FLAG_HAS_POSITION_ADJUSTMENTS indicates that - * the GlyphVector has per-glyph position adjustments. + /** + * The Constant FLAG_HAS_POSITION_ADJUSTMENTS indicates that the GlyphVector + * has per-glyph position adjustments. */ public static final int FLAG_HAS_POSITION_ADJUSTMENTS = 2; - /** - * The Constant FLAG_RUN_RTL indicates that this GlyphVector has a - * right to left run direction. + /** + * The Constant FLAG_RUN_RTL indicates that this GlyphVector has a right to + * left run direction. */ public static final int FLAG_RUN_RTL = 4; - /** - * The Constant FLAG_COMPLEX_GLYPHS indicates that this GlyphVector - * has a complex glyph to char mapping. + /** + * The Constant FLAG_COMPLEX_GLYPHS indicates that this GlyphVector has a + * complex glyph to char mapping. */ public static final int FLAG_COMPLEX_GLYPHS = 8; - /** - * The Constant FLAG_MASK indicates a mask for supported flags - * from getLayoutFlags. + /** + * The Constant FLAG_MASK indicates a mask for supported flags from + * getLayoutFlags. */ public static final int FLAG_MASK = 15; // (|) mask of other flags @@ -81,17 +84,19 @@ public abstract class GlyphVector implements Cloneable { } /** - * Gets the pixel bounds of the GlyphVector when rendered - * at the specified location with the specified FontRenderContext. - * - * @param frc the FontRenderContext. - * @param x the X coordinate of the GlyphVector's location. - * @param y the Y coordinate of the GlyphVector's location. - * + * Gets the pixel bounds of the GlyphVector when rendered at the specified + * location with the specified FontRenderContext. + * + * @param frc + * the FontRenderContext. + * @param x + * the X coordinate of the GlyphVector's location. + * @param y + * the Y coordinate of the GlyphVector's location. * @return the pixel bounds */ public Rectangle getPixelBounds(FontRenderContext frc, float x, float y) { - // default implementation - integer Rectangle, that encloses visual + // default implementation - integer Rectangle, that encloses visual // bounds rectangle Rectangle2D visualRect = getVisualBounds(); @@ -104,19 +109,21 @@ public abstract class GlyphVector implements Cloneable { } /** - * Gets the pixel bounds of the glyph with the specified index in - * this GlyphVector which is rendered with the specified - * FontRenderContext at the specified location. - * - * @param index the glyph index in this GlyphVector. - * @param frc the FontRenderContext. - * @param x the X coordinate of the GlyphVector's location. - * @param y the Y coordinate of the GlyphVector's location. - * + * Gets the pixel bounds of the glyph with the specified index in this + * GlyphVector which is rendered with the specified FontRenderContext at the + * specified location. + * + * @param index + * the glyph index in this GlyphVector. + * @param frc + * the FontRenderContext. + * @param x + * the X coordinate of the GlyphVector's location. + * @param y + * the Y coordinate of the GlyphVector's location. * @return a Rectangle bounds. */ - public Rectangle getGlyphPixelBounds(int index, FontRenderContext frc, - float x, float y) { + public Rectangle getGlyphPixelBounds(int index, FontRenderContext frc, float x, float y) { Rectangle2D visualRect = getGlyphVisualBounds(index).getBounds2D(); int minX = (int)Math.floor(visualRect.getMinX() + x); @@ -128,14 +135,14 @@ public abstract class GlyphVector implements Cloneable { } /** - * Gets the visual bounds of the GlyphVector. + * Gets the visual bounds of the GlyphVector. * * @return the visual bounds of the GlyphVector. */ public abstract Rectangle2D getVisualBounds(); /** - * Gets the logical bounds of the GlyphVector. + * Gets the logical bounds of the GlyphVector. * * @return the logical bounds of the GlyphVector. */ @@ -144,36 +151,38 @@ public abstract class GlyphVector implements Cloneable { /** * Sets the position of the specified glyph in this GlyphVector. * - * @param glyphIndex the glyph index in this GlyphVector. - * @param newPos the new position of the glyph at the specified glyphIndex. + * @param glyphIndex + * the glyph index in this GlyphVector. + * @param newPos + * the new position of the glyph at the specified glyphIndex. */ public abstract void setGlyphPosition(int glyphIndex, Point2D newPos); /** * Gets the position of the specified glyph in this GlyphVector. * - * @param glyphIndex the glyph index in this GlyphVector. - * + * @param glyphIndex + * the glyph index in this GlyphVector. * @return the position of the specified glyph in this GlyphVector. */ public abstract Point2D getGlyphPosition(int glyphIndex); /** - * Sets the affine transform to a glyph with the specified index - * in this GlyphVector. + * Sets the affine transform to a glyph with the specified index in this + * GlyphVector. * - * @param glyphIndex the glyth index in this GlyphVector. - * @param trans the AffineTransform to be assigned to the - * specified glyph. + * @param glyphIndex + * the glyth index in this GlyphVector. + * @param trans + * the AffineTransform to be assigned to the specified glyph. */ - public abstract void setGlyphTransform(int glyphIndex, - AffineTransform trans); + public abstract void setGlyphTransform(int glyphIndex, AffineTransform trans); /** * Gets the transform of the specified glyph in this GlyphVector. * - * @param glyphIndex the glyph index in this GlyphVector. - * + * @param glyphIndex + * the glyph index in this GlyphVector. * @return the new transform of the glyph. */ public abstract AffineTransform getGlyphTransform(int glyphIndex); @@ -181,34 +190,32 @@ public abstract class GlyphVector implements Cloneable { /** * Compares this GlyphVector with the specified GlyphVector objects. * - * @param glyphVector the GlyphVector object to be compared. - * + * @param glyphVector + * the GlyphVector object to be compared. * @return true, if this GlyphVector is equal to the specified GlyphVector - * object, false otherwise. + * object, false otherwise. */ public abstract boolean equals(GlyphVector glyphVector); /** - * Gets the metrics of the glyph with the specified index - * in this GlyphVector. - * - * @param glyphIndex index in this GlyphVector. + * Gets the metrics of the glyph with the specified index in this + * GlyphVector. * - * @return the metrics of the glyph with the specified index - * in this GlyphVector. + * @param glyphIndex + * index in this GlyphVector. + * @return the metrics of the glyph with the specified index in this + * GlyphVector. */ public abstract GlyphMetrics getGlyphMetrics(int glyphIndex); /** - * Gets the justification information of the glyph - * whose index is specified. + * Gets the justification information of the glyph whose index is specified. * - * @param glyphIndex the glyph index. - * - * @return the GlyphJustificationInfo for the specified glyph. + * @param glyphIndex + * the glyph index. + * @return the GlyphJustificationInfo for the specified glyph. */ - public abstract GlyphJustificationInfo getGlyphJustificationInfo( - int glyphIndex); + public abstract GlyphJustificationInfo getGlyphJustificationInfo(int glyphIndex); /** * Gets the FontRenderContext of this GlyphVector. @@ -218,18 +225,20 @@ public abstract class GlyphVector implements Cloneable { public abstract FontRenderContext getFontRenderContext(); /** - * Gets a Shape object which defines the visual representation - * of the specified glyph in this GlyphVector, translated a - * distance of x in the X direction and y in the Y direction. - * - * @param glyphIndex the glyth index in this GlyphVector. - * @param x the distance in the X direction to translate the - * shape object before returning it. - * @param y the distance in the Y direction to translate the - * shape object before returning it. - * - * @return a Shape object which represents the visual representation - * of the specified glyph in this GlyphVector - glyph outline. + * Gets a Shape object which defines the visual representation of the + * specified glyph in this GlyphVector, translated a distance of x in the X + * direction and y in the Y direction. + * + * @param glyphIndex + * the glyth index in this GlyphVector. + * @param x + * the distance in the X direction to translate the shape object + * before returning it. + * @param y + * the distance in the Y direction to translate the shape object + * before returning it. + * @return a Shape object which represents the visual representation of the + * specified glyph in this GlyphVector - glyph outline. */ public Shape getGlyphOutline(int glyphIndex, float x, float y) { Shape initialShape = getGlyphOutline(glyphIndex); @@ -240,43 +249,42 @@ public abstract class GlyphVector implements Cloneable { /** * Gets the visual bounds of the specified glyph in the GlyphVector. * - * @param glyphIndex the glyph index in this GlyphVector. - * - * @return the glyph visual bounds of the glyph with the specified - * index in the GlyphVector. + * @param glyphIndex + * the glyph index in this GlyphVector. + * @return the glyph visual bounds of the glyph with the specified index in + * the GlyphVector. */ public abstract Shape getGlyphVisualBounds(int glyphIndex); /** - * Gets a Shape object which defines the visual representation - * of the specified glyph in this GlyphVector. - * - * @param glyphIndex the glyth index in this GlyphVector. + * Gets a Shape object which defines the visual representation of the + * specified glyph in this GlyphVector. * - * @return a Shape object which represents the visual representation - * of the specified glyph in this GlyphVector - glyph outline. + * @param glyphIndex + * the glyth index in this GlyphVector. + * @return a Shape object which represents the visual representation of the + * specified glyph in this GlyphVector - glyph outline. */ public abstract Shape getGlyphOutline(int glyphIndex); /** - * Gets the logical bounds of the specified glyph in - * the GlyphVector. + * Gets the logical bounds of the specified glyph in the GlyphVector. * - * @param glyphIndex the index in this GlyphVector of the glyph from which - * to retrieve its logical bounds - * - * @return the logical bounds of the specified glyph in - * the GlyphVector. + * @param glyphIndex + * the index in this GlyphVector of the glyph from which to + * retrieve its logical bounds + * @return the logical bounds of the specified glyph in the GlyphVector. */ public abstract Shape getGlyphLogicalBounds(int glyphIndex); /** - * Gets the visual representation of this GlyphVector rendered in - * x, y location as a Shape object. - * - * @param x the x coordinate of the GlyphVector. - * @param y the y coordinate of the GlyphVector. + * Gets the visual representation of this GlyphVector rendered in x, y + * location as a Shape object. * + * @param x + * the x coordinate of the GlyphVector. + * @param y + * the y coordinate of the GlyphVector. * @return the visual representation of this GlyphVector as a Shape object. */ public abstract Shape getOutline(float x, float y); @@ -298,77 +306,79 @@ public abstract class GlyphVector implements Cloneable { /** * Gets an array of the glyph codes of the specified glyphs. * - * @param beginGlyphIndex the index into this GlyphVector at which - * to start retrieving glyph codes. - * @param numEntries the number of glyph codes. - * @param codeReturn the array into which the resulting - * glyphcodes will be written. - * + * @param beginGlyphIndex + * the index into this GlyphVector at which to start retrieving + * glyph codes. + * @param numEntries + * the number of glyph codes. + * @param codeReturn + * the array into which the resulting glyphcodes will be written. * @return the array of the glyph codes. */ - public abstract int[] getGlyphCodes(int beginGlyphIndex, int numEntries, - int[] codeReturn); + public abstract int[] getGlyphCodes(int beginGlyphIndex, int numEntries, int[] codeReturn); /** - * Gets an array of the character indices of - * the specified glyphs. - * - * @param beginGlyphIndex the index of the first glyph to return information for. - * @param numEntries the number of glyph indices to return. - * @param codeReturn the array into which the resulting character - * indices will be written. - * + * Gets an array of the character indices of the specified glyphs. + * + * @param beginGlyphIndex + * the index of the first glyph to return information for. + * @param numEntries + * the number of glyph indices to return. + * @param codeReturn + * the array into which the resulting character indices will be + * written. * @return an array of character indices for the specifies glyphs. */ - public int[] getGlyphCharIndices(int beginGlyphIndex, int numEntries, - int[] codeReturn) { + public int[] getGlyphCharIndices(int beginGlyphIndex, int numEntries, int[] codeReturn) { if (codeReturn == null) { codeReturn = new int[numEntries]; } - for (int i = 0; i < numEntries; i++){ - codeReturn[i] = getGlyphCharIndex(i+beginGlyphIndex); + for (int i = 0; i < numEntries; i++) { + codeReturn[i] = getGlyphCharIndex(i + beginGlyphIndex); } return codeReturn; } /** - * Gets an array of the positions of the specified glyphs in - * this GlyphVector. - * - * @param beginGlyphIndex the index of the first glyph to return information for. - * @param numEntries the number of glyphs to return information for. - * @param positionReturn the array where the result will be stored. - * + * Gets an array of the positions of the specified glyphs in this + * GlyphVector. + * + * @param beginGlyphIndex + * the index of the first glyph to return information for. + * @param numEntries + * the number of glyphs to return information for. + * @param positionReturn + * the array where the result will be stored. * @return an array of glyph positions. */ - public abstract float[] getGlyphPositions(int beginGlyphIndex, - int numEntries, float[] positionReturn); + public abstract float[] getGlyphPositions(int beginGlyphIndex, int numEntries, + float[] positionReturn); /** * Gets the glyph code of the specified glyph. * - * @param glyphIndex the index in this GlyphVector which corresponds - * to the glyph from which to retrieve the glyphcode. - * + * @param glyphIndex + * the index in this GlyphVector which corresponds to the glyph + * from which to retrieve the glyphcode. * @return the glyphcode of the specified glyph. */ public abstract int getGlyphCode(int glyphIndex); /** - * Gets the first logical character's index of the specified glyph. - * - * @param glyphIndex the glyph index. + * Gets the first logical character's index of the specified glyph. * + * @param glyphIndex + * the glyph index. * @return the the first logical character's index. */ - public int getGlyphCharIndex(int glyphIndex){ + public int getGlyphCharIndex(int glyphIndex) { // default implemetation one-to-one return glyphIndex; } /** - * Sets default layout to this GlyphVector. + * Sets default layout to this GlyphVector. */ public abstract void performDefaultLayout(); @@ -380,15 +390,14 @@ public abstract class GlyphVector implements Cloneable { public abstract int getNumGlyphs(); /** - * Gets flags which describe the global state of the GlyphVector. - * The default implementation returns 0. + * Gets flags which describe the global state of the GlyphVector. The + * default implementation returns 0. * * @return the layout flags */ - public int getLayoutFlags(){ + public int getLayoutFlags() { // default implementation - returned value is 0 return 0; } } - diff --git a/awt/java/awt/font/GraphicAttribute.java b/awt/java/awt/font/GraphicAttribute.java index 2f41951c65968..8480e0f6a1b27 100644 --- a/awt/java/awt/font/GraphicAttribute.java +++ b/awt/java/awt/font/GraphicAttribute.java @@ -18,6 +18,7 @@ * @author Ilya S. Okomin * @version $Revision$ */ + package java.awt.font; import java.awt.Graphics2D; @@ -26,49 +27,54 @@ import java.awt.geom.Rectangle2D; import org.apache.harmony.awt.internal.nls.Messages; /** - * The GraphicAttribute abstract class provides an opportunity to - * insert graphical elements in printed text. + * The GraphicAttribute abstract class provides an opportunity to insert + * graphical elements in printed text. + * + * @since Android 1.0 */ public abstract class GraphicAttribute { - /** - * The Constant TOP_ALIGNMENT indicates using the top line to - * calculate placement of graphics. + /** + * The Constant TOP_ALIGNMENT indicates using the top line to calculate + * placement of graphics. */ public static final int TOP_ALIGNMENT = -1; - /** - * The Constant BOTTOM_ALIGNMENT indicates using the bottom line to - * calculate placement of graphics. + /** + * The Constant BOTTOM_ALIGNMENT indicates using the bottom line to + * calculate placement of graphics. */ public static final int BOTTOM_ALIGNMENT = -2; - /** - * The Constant ROMAN_BASELINE indicates the placement of the roman - * baseline with respect to the graphics origin. + /** + * The Constant ROMAN_BASELINE indicates the placement of the roman baseline + * with respect to the graphics origin. */ public static final int ROMAN_BASELINE = 0; - /** - * The Constant CENTER_BASELINE indicates the placement of the center + /** + * The Constant CENTER_BASELINE indicates the placement of the center * baseline with respect to the graphics origin. */ public static final int CENTER_BASELINE = 1; - /** - * The Constant HANGING_BASELINE indicates the placement of the hanging - * baseline with respect to the graphics origin. + /** + * The Constant HANGING_BASELINE indicates the placement of the hanging + * baseline with respect to the graphics origin. */ public static final int HANGING_BASELINE = 2; // the alignment of this GraphicAttribute - /** The alignment. */ + /** + * The alignment. + */ private int alignment; /** * Instantiates a new graphic attribute with the specified alignment. * - * @param align the specified alignment. + * @param align + * the specified alignment. */ protected GraphicAttribute(int align) { if ((align < BOTTOM_ALIGNMENT) || (align > HANGING_BASELINE)) { @@ -81,16 +87,19 @@ public abstract class GraphicAttribute { /** * Draws the GraphicAttribute at the specified location. * - * @param graphics the Graphics. - * @param x the X coordinate of GraphicAttribute location. - * @param y the Y coordinate of GraphicAttribute location. + * @param graphics + * the Graphics. + * @param x + * the X coordinate of GraphicAttribute location. + * @param y + * the Y coordinate of GraphicAttribute location. */ public abstract void draw(Graphics2D graphics, float x, float y); /** - * Gets the GraphicAttribute's advance. It's the distance from the point - * at which the graphic is rendered and the point where the next character - * or graphic is rendered. + * Gets the GraphicAttribute's advance. It's the distance from the point at + * which the graphic is rendered and the point where the next character or + * graphic is rendered. * * @return the GraphicAttribute's advance. */ @@ -139,58 +148,32 @@ public abstract class GraphicAttribute { * @return the GlyphJustificationInfo of this GraphicAttribute. */ public GlyphJustificationInfo getJustificationInfo() { - - /* Default implementation. - * Since documentation doesn't describe default values, - * they were calculated based on 1.5 release - * behavior and can be obtained using next test sample: - * - * // Create GraphicAttribute class implementation - * public class MyGraphicAttribute extends GraphicAttribute { - * protected MyGraphicAttribute(int align) { - * super(align); - * } - * - * public float getDescent() { - * return 0; - * } - * - * public float getAdvance() { - * return 1; - * } - * - * public void draw(Graphics2D g2, float x, float y) { - * } - * - * public float getAscent() { - * return 0; - * } - * } - * - * MyGraphicAttribute myGA = gat.new MyGraphicAttribute(0); - * // print justification parameters - * System.out.println(myGA.getJustificationInfo().growAbsorb); - * System.out.println(myGA.getJustificationInfo().shrinkAbsorb); - * System.out.println(myGA.getJustificationInfo().growLeftLimit); - * System.out.println(myGA.getJustificationInfo().growPriority); - * System.out.println(myGA.getJustificationInfo().growRightLimit); - * System.out.println(myGA.getJustificationInfo().shrinkLeftLimit); - * System.out.println(myGA.getJustificationInfo().shrinkPriority); - * System.out.println(myGA.getJustificationInfo().shrinkRightLimit); - * System.out.println(myGA.getJustificationInfo().weight); + + /* + * Default implementation. Since documentation doesn't describe default + * values, they were calculated based on 1.5 release behavior and can be + * obtained using next test sample: // Create GraphicAttribute class + * implementation public class MyGraphicAttribute extends + * GraphicAttribute { protected MyGraphicAttribute(int align) { + * super(align); } public float getDescent() { return 0; } public float + * getAdvance() { return 1; } public void draw(Graphics2D g2, float x, + * float y) { } public float getAscent() { return 0; } } + * MyGraphicAttribute myGA = gat.new MyGraphicAttribute(0); // print + * justification parameters + * System.out.println(myGA.getJustificationInfo().growAbsorb); + * System.out.println(myGA.getJustificationInfo().shrinkAbsorb); + * System.out.println(myGA.getJustificationInfo().growLeftLimit); + * System.out.println(myGA.getJustificationInfo().growPriority); + * System.out.println(myGA.getJustificationInfo().growRightLimit); + * System.out.println(myGA.getJustificationInfo().shrinkLeftLimit); + * System.out.println(myGA.getJustificationInfo().shrinkPriority); + * System.out.println(myGA.getJustificationInfo().shrinkRightLimit); + * System.out.println(myGA.getJustificationInfo().weight); */ float advance = getAdvance(); - return new GlyphJustificationInfo( - advance, - false, - GlyphJustificationInfo.PRIORITY_INTERCHAR, - advance / 3, - advance / 3, - false, - GlyphJustificationInfo.PRIORITY_WHITESPACE, - 0, - 0); + return new GlyphJustificationInfo(advance, false, + GlyphJustificationInfo.PRIORITY_INTERCHAR, advance / 3, advance / 3, false, + GlyphJustificationInfo.PRIORITY_WHITESPACE, 0, 0); } } - diff --git a/awt/java/awt/font/ImageGraphicAttribute.java b/awt/java/awt/font/ImageGraphicAttribute.java index 41f90b8e81822..d6d4758d355e9 100644 --- a/awt/java/awt/font/ImageGraphicAttribute.java +++ b/awt/java/awt/font/ImageGraphicAttribute.java @@ -18,6 +18,7 @@ * @author Ilya S. Okomin * @version $Revision$ */ + package java.awt.font; import java.awt.Graphics2D; @@ -27,44 +28,57 @@ import java.awt.geom.Rectangle2D; import org.apache.harmony.misc.HashCode; /** - * The ImageGraphicAttribute class provides an opportunity to insert - * images to a text. + * The ImageGraphicAttribute class provides an opportunity to insert images to a + * text. + * + * @since Android 1.0 */ public final class ImageGraphicAttribute extends GraphicAttribute { // Image object rendered by this ImageGraphicAttribute - /** The image. */ + /** + * The image. + */ private Image fImage; // X coordinate of the origin point - /** The origin x. */ + /** + * The origin x. + */ private float fOriginX; // Y coordinate of the origin point - /** The origin y. */ + /** + * The origin y. + */ private float fOriginY; // the width of the image object - /** The img width. */ + /** + * The img width. + */ private float fImgWidth; // the height of the image object - /** The img height. */ + /** + * The img height. + */ private float fImgHeight; /** * Instantiates a new ImageGraphicAttribute with the specified image, * alignment and origins. * - * @param image the Image to be rendered by ImageGraphicAttribute. - * @param alignment the alignment of the ImageGraphicAttribute. - * @param originX the origin X coordinate in the image of - * ImageGraphicAttribute. - * @param originY the origin Y coordinate in the image of - * ImageGraphicAttribute. + * @param image + * the Image to be rendered by ImageGraphicAttribute. + * @param alignment + * the alignment of the ImageGraphicAttribute. + * @param originX + * the origin X coordinate in the image of ImageGraphicAttribute. + * @param originY + * the origin Y coordinate in the image of ImageGraphicAttribute. */ - public ImageGraphicAttribute(Image image, int alignment, float originX, - float originY) { + public ImageGraphicAttribute(Image image, int alignment, float originX, float originY) { super(alignment); this.fImage = image; @@ -80,8 +94,10 @@ public final class ImageGraphicAttribute extends GraphicAttribute { * Instantiates a new ImageGraphicAttribute with the specified image and * alignment. * - * @param image the Image to be rendered by ImageGraphicAttribute. - * @param alignment the alignment of the ImageGraphicAttribute. + * @param image + * the Image to be rendered by ImageGraphicAttribute. + * @param alignment + * the alignment of the ImageGraphicAttribute. */ public ImageGraphicAttribute(Image image, int alignment) { this(image, alignment, 0, 0); @@ -105,10 +121,10 @@ public final class ImageGraphicAttribute extends GraphicAttribute { * Compares the specified ImageGraphicAttribute object with this * ImageGraphicAttribute object. * - * @param iga the ImageGraphicAttribute object to be compared. - * + * @param iga + * the ImageGraphicAttribute object to be compared. * @return true, if the specified ImageGraphicAttribute object is equal to - * this ImageGraphicAttribute object, false otherwise. + * this ImageGraphicAttribute object, false otherwise. */ public boolean equals(ImageGraphicAttribute iga) { if (iga == null) { @@ -119,26 +135,23 @@ public final class ImageGraphicAttribute extends GraphicAttribute { return true; } - return (fOriginX == iga.fOriginX && - fOriginY == iga.fOriginY && - getAlignment() == iga.getAlignment() && - fImage.equals(iga.fImage)); + return (fOriginX == iga.fOriginX && fOriginY == iga.fOriginY + && getAlignment() == iga.getAlignment() && fImage.equals(iga.fImage)); } /** * Compares the specified Object with this ImageGraphicAttribute object. - * - * @param obj the Object to be compared. * + * @param obj + * the Object to be compared. * @return true, if the specified Object is equal to this - * ImageGraphicAttribute object, false otherwise. + * ImageGraphicAttribute object, false otherwise. */ @Override public boolean equals(Object obj) { try { - return equals((ImageGraphicAttribute) obj); - } - catch(ClassCastException e) { + return equals((ImageGraphicAttribute)obj); + } catch (ClassCastException e) { return false; } @@ -149,9 +162,6 @@ public final class ImageGraphicAttribute extends GraphicAttribute { g2.drawImage(fImage, (int)(x - fOriginX), (int)(y - fOriginY), null); } - /** - * @see java.awt.font.GraphicAttribute#getAdvance() - */ @Override public float getAdvance() { return Math.max(0, fImgWidth - fOriginX); @@ -167,13 +177,9 @@ public final class ImageGraphicAttribute extends GraphicAttribute { return new Rectangle2D.Float(-fOriginX, -fOriginY, fImgWidth, fImgHeight); } - /** - * @see java.awt.font.GraphicAttribute#getDescent() - */ @Override public float getDescent() { return Math.max(0, fImgHeight - fOriginY); } } - diff --git a/awt/java/awt/font/LineBreakMeasurer.java b/awt/java/awt/font/LineBreakMeasurer.java index efce615944cfa..4800093f63782 100644 --- a/awt/java/awt/font/LineBreakMeasurer.java +++ b/awt/java/awt/font/LineBreakMeasurer.java @@ -21,64 +21,69 @@ package java.awt.font; -import java.text.AttributedCharacterIterator; -//???AWT: import java.text.BreakIterator; +import java.text.AttributedCharacterIterator; //???AWT: import java.text.BreakIterator; import org.apache.harmony.awt.internal.nls.Messages; /** - * The class LineBreakMeasurer provides methods to measure the graphical - * representation of a text in order to determine where to add line - * breaks so the resulting line of text fits its wrapping width. - * The wrapping width defines the visual width of the paragraph. + * The class LineBreakMeasurer provides methods to measure the graphical + * representation of a text in order to determine where to add line breaks so + * the resulting line of text fits its wrapping width. The wrapping width + * defines the visual width of the paragraph. + * + * @since Android 1.0 */ public final class LineBreakMeasurer { - - /** The tm. */ + + /** + * The tm. + */ private TextMeasurer tm = null; - //???AWT private BreakIterator bi = null; - /** The position. */ + + // ???AWT private BreakIterator bi = null; + /** + * The position. + */ private int position = 0; - - /** The maxpos. */ + + /** + * The maxpos. + */ int maxpos = 0; /** * Instantiates a new LineBreakMeasurer object for the specified text. * - * @param text the AttributedCharacterIterator object which contains - * text with at least one character. - * @param frc the FontRenderContext represented information - * about graphic device. + * @param text + * the AttributedCharacterIterator object which contains text + * with at least one character. + * @param frc + * the FontRenderContext represented information about graphic + * device. */ public LineBreakMeasurer(AttributedCharacterIterator text, FontRenderContext frc) { - //???AWT: this(text, BreakIterator.getLineInstance(), frc); + // ???AWT: this(text, BreakIterator.getLineInstance(), frc); } - /* ???AWT - public LineBreakMeasurer( - AttributedCharacterIterator text, - BreakIterator bi, - FontRenderContext frc - ) { - tm = new TextMeasurer(text, frc); - this.bi = bi; - this.bi.setText(text); - position = text.getBeginIndex(); - maxpos = tm.aci.getEndIndex(); - } - */ + /* + * ???AWT public LineBreakMeasurer( AttributedCharacterIterator text, + * BreakIterator bi, FontRenderContext frc ) { tm = new TextMeasurer(text, + * frc); this.bi = bi; this.bi.setText(text); position = + * text.getBeginIndex(); maxpos = tm.aci.getEndIndex(); } + */ /** - * Deletes a character from the specified position of the text, - * updates this LineBreakMeasurer object. + * Deletes a character from the specified position of the text, updates this + * LineBreakMeasurer object. * - * @param newText the new text. - * @param pos the posion of the character which is deleted. + * @param newText + * the new text. + * @param pos + * the position of the character which is deleted. */ public void deleteChar(AttributedCharacterIterator newText, int pos) { tm.deleteChar(newText, pos); - //???AWT: bi.setText(newText); + // ???AWT: bi.setText(newText); position = newText.getBeginIndex(); @@ -88,22 +93,24 @@ public final class LineBreakMeasurer { /** * Gets current position of this LineBreakMeasurer. * - * @return current position of this LineBreakMeasurer + * @return the current position of this LineBreakMeasurer */ public int getPosition() { return position; } /** - * Insertes a character at the specified position in the text, - * updates this LineBreakMeasurer object. + * Inserts a character at the specified position in the text, updates this + * LineBreakMeasurer object. * - * @param newText the new text. - * @param pos the posion of the character which is inserted. + * @param newText + * the new text. + * @param pos + * the position of the character which is inserted. */ public void insertChar(AttributedCharacterIterator newText, int pos) { tm.insertChar(newText, pos); -// ???AWT: bi.setText(newText); + // ???AWT: bi.setText(newText); position = newText.getBeginIndex(); @@ -111,21 +118,23 @@ public final class LineBreakMeasurer { } /** - * Returns the next line of text, updates current position in this + * Returns the next line of text, updates current position in this * LineBreakMeasurer. * - * @param wrappingWidth the maximum visible line width. - * @param offsetLimit the limit point withing the text indicating - * that no further text should be included on the line; the paragraph break. - * @param requireNextWord if true, null is returned (the entire word at the current - * position does not fit within the wrapping width); - * if false, a valid layout is returned that includes at least the - * character at the current position. - * - * @return the next TextLayout which begins at the current position and - * represents the next line of text with width wrappingWidth, null is - * returned if the entire word at the current position does not fit within - * the wrapping width. + * @param wrappingWidth + * the maximum visible line width. + * @param offsetLimit + * the limit point within the text indicating that no further + * text should be included on the line; the paragraph break. + * @param requireNextWord + * if true, null is returned (the entire word at the current + * position does not fit within the wrapping width); if false, a + * valid layout is returned that includes at least the character + * at the current position. + * @return the next TextLayout which begins at the current position and + * represents the next line of text with width wrappingWidth, null + * is returned if the entire word at the current position does not + * fit within the wrapping width. */ public TextLayout nextLayout(float wrappingWidth, int offsetLimit, boolean requireNextWord) { if (position == maxpos) { @@ -145,8 +154,8 @@ public final class LineBreakMeasurer { /** * Returns the next line of text. * - * @param wrappingWidth the maximum visible line width. - * + * @param wrappingWidth + * the maximum visible line width. * @return the next line of text. */ public TextLayout nextLayout(float wrappingWidth) { @@ -156,8 +165,8 @@ public final class LineBreakMeasurer { /** * Returns the end position of the next line of text. * - * @param wrappingWidth the maximum visible line width. - * + * @param wrappingWidth + * the maximum visible line width. * @return the end position of the next line of text. */ public int nextOffset(float wrappingWidth) { @@ -167,22 +176,22 @@ public final class LineBreakMeasurer { /** * Returns the end position of the next line of text. * - * @param wrappingWidth the maximum visible line width. - * @param offsetLimit the limit point withing the text indicating - * that no further text should be included on the line; the paragraph break. - * @param requireNextWord if true, the current position is returned - * if the entire next word does not fit within wrappingWidth; - * if false, the offset returned is at least one greater than the current - * position. - * + * @param wrappingWidth + * the maximum visible line width. + * @param offsetLimit + * the limit point withing the text indicating that no further + * text should be included on the line; the paragraph break. + * @param requireNextWord + * if true, the current position is returned if the entire next + * word does not fit within wrappingWidth; if false, the offset + * returned is at least one greater than the current position. * @return the end position of the next line of text. - * - * @throws IllegalArgumentException if the offsetLimit is less than - * the current position. + * @throws IllegalArgumentException + * if the offsetLimit is less than the current position. */ public int nextOffset(float wrappingWidth, int offsetLimit, boolean requireNextWord) { if (offsetLimit <= position) { - // awt.203=Offset limit should be greater than current position. + // awt.203=Offset limit should be greater than current position. throw new IllegalArgumentException(Messages.getString("awt.203")); //$NON-NLS-1$ } @@ -193,22 +202,20 @@ public final class LineBreakMeasurer { int breakPos = tm.getLineBreakIndex(position, wrappingWidth); int correctedPos = breakPos; - // This check is required because bi.preceding(maxpos) throws an exception - /* ???AWT - if (breakPos == maxpos) { - correctedPos = maxpos; - } else if (Character.isWhitespace(bi.getText().setIndex(breakPos))) { - correctedPos = bi.following(breakPos); - } else { - correctedPos = bi.preceding(breakPos); - } - */ - + // This check is required because bi.preceding(maxpos) throws an + // exception + /* + * ???AWT if (breakPos == maxpos) { correctedPos = maxpos; } else if + * (Character.isWhitespace(bi.getText().setIndex(breakPos))) { + * correctedPos = bi.following(breakPos); } else { correctedPos = + * bi.preceding(breakPos); } + */ + if (position >= correctedPos) { if (requireNextWord) { correctedPos = position; } else { - correctedPos = Math.max(position+1, breakPos); + correctedPos = Math.max(position + 1, breakPos); } } @@ -218,7 +225,8 @@ public final class LineBreakMeasurer { /** * Sets the new position of this LineBreakMeasurer. * - * @param pos the new position of this LineBreakMeasurer. + * @param pos + * the new position of this LineBreakMeasurer. */ public void setPosition(int pos) { if (tm.aci.getBeginIndex() > pos || maxpos < pos) { @@ -228,4 +236,3 @@ public final class LineBreakMeasurer { position = pos; } } - diff --git a/awt/java/awt/font/LineMetrics.java b/awt/java/awt/font/LineMetrics.java index 28571871046db..4b03e5db2b0e2 100644 --- a/awt/java/awt/font/LineMetrics.java +++ b/awt/java/awt/font/LineMetrics.java @@ -18,22 +18,24 @@ * @author Ilya S. Okomin * @version $Revision$ */ + package java.awt.font; /** - * The LineMetrics class provides information such as concerning how the text - * is positioned with respect to the base line, such as ascent, descent, - * and leading. + * The LineMetrics class provides information such as concerning how the text is + * positioned with respect to the base line, such as ascent, descent, and + * leading. * + * @since Android 1.0 */ public abstract class LineMetrics { /** - * Gets the baseline offsets of the text according to the - * the baseline of this text. + * Gets the baseline offsets of the text according to the the baseline of + * this text. * - * @return the baseline offsets of the text according to the - * the baseline of this text. + * @return the baseline offsets of the text according to the the baseline of + * this text. */ public abstract float[] getBaselineOffsets(); @@ -45,11 +47,11 @@ public abstract class LineMetrics { public abstract int getNumChars(); /** - * Gets the baseline index, returns one of the following - * index: ROMAN_BASELINE, CENTER_BASELINE, HANGING_BASELINE. + * Gets the baseline index, returns one of the following index: + * ROMAN_BASELINE, CENTER_BASELINE, HANGING_BASELINE. * - * @return the baseline index: ROMAN_BASELINE, CENTER_BASELINE - * or HANGING_BASELINE. + * @return the baseline index: ROMAN_BASELINE, CENTER_BASELINE or + * HANGING_BASELINE. */ public abstract int getBaselineIndex(); @@ -89,11 +91,11 @@ public abstract class LineMetrics { public abstract float getLeading(); /** - * Gets the height of the text as a sum of the ascent, the descent - * and the leading. + * Gets the height of the text as a sum of the ascent, the descent and the + * leading. * - * @return the height of the text as a sum of the ascent, the descent - * and the leading. + * @return the height of the text as a sum of the ascent, the descent and + * the leading. */ public abstract float getHeight(); @@ -112,4 +114,3 @@ public abstract class LineMetrics { public abstract float getAscent(); } - diff --git a/awt/java/awt/font/MultipleMaster.java b/awt/java/awt/font/MultipleMaster.java index 773bfcfbf3946..d264f24833f44 100644 --- a/awt/java/awt/font/MultipleMaster.java +++ b/awt/java/awt/font/MultipleMaster.java @@ -18,38 +18,44 @@ * @author Ilya S. Okomin * @version $Revision$ */ + package java.awt.font; import java.awt.Font; /** - * The MultipleMaster interface provides methods to manipulate MultipleMaster + * The MultipleMaster interface provides methods to manipulate MultipleMaster * type fonts and retrieve graphical and design data from them. + * + * @since Android 1.0 */ public interface MultipleMaster { /** - * Derives a new multiple master font based on the specified - * parameters. - * - * @param glyphWidths float array which represents width of each glyph - * in font space. - * @param avgStemWidth the average stem width in font space. - * @param typicalCapHeight the typical upper case char height. - * @param typicalXHeight the typical lower case char height. - * @param italicAngle the slope angle for italics. + * Derives a new multiple master font based on the specified parameters. * + * @param glyphWidths + * float array which represents width of each glyph in font + * space. + * @param avgStemWidth + * the average stem width in font space. + * @param typicalCapHeight + * the typical upper case char height. + * @param typicalXHeight + * the typical lower case char height. + * @param italicAngle + * the slope angle for italics. * @return a MultipleMaster font. */ - public Font deriveMMFont(float[] glyphWidths, float avgStemWidth, - float typicalCapHeight, float typicalXHeight, float italicAngle); + public Font deriveMMFont(float[] glyphWidths, float avgStemWidth, float typicalCapHeight, + float typicalXHeight, float italicAngle); /** - * Derives a new multiple master font based on the design axis values - * contained in the specified array. - * - * @param axes an float array which contains axis values. + * Derives a new multiple master font based on the design axis values + * contained in the specified array. * + * @param axes + * an float array which contains axis values. * @return a MultipleMaster font. */ public Font deriveMMFont(float[] axes); @@ -62,25 +68,24 @@ public interface MultipleMaster { public float[] getDesignAxisDefaults(); /** - * Gets the array of design axis names. + * Gets the array of design axis names. * - * @return the array of design axis names. + * @return the array of design axis names. */ public String[] getDesignAxisNames(); /** - * Gets the array of design axis ranges. + * Gets the array of design axis ranges. * * @return the array of design axis ranges. */ public float[] getDesignAxisRanges(); /** - * Gets the number of multiple master design controls. + * Gets the number of multiple master design controls. * * @return the number of multiple master design controls. */ public int getNumDesignAxes(); } - diff --git a/awt/java/awt/font/OpenType.java b/awt/java/awt/font/OpenType.java index 53cb6c0d550eb..db66911c49c1e 100644 --- a/awt/java/awt/font/OpenType.java +++ b/awt/java/awt/font/OpenType.java @@ -18,318 +18,323 @@ * @author Ilya S. Okomin * @version $Revision$ */ + package java.awt.font; /** - * The OpenType interface provides constants and methods for getting - * instance data for fonts of type OpenType and TrueType. For more information, - * see the OpenType specification. + * The OpenType interface provides constants and methods for getting instance + * data for fonts of type OpenType and TrueType. For more information, see the + * + * OpenType specification. + * + * @since Android 1.0 */ public interface OpenType { - /** - * The Constant TAG_ACNT indicates corresponding table tag - * in the Open Type Specification. + /** + * The Constant TAG_ACNT indicates corresponding table tag in the Open Type + * Specification. */ public static final int TAG_ACNT = 1633906292; - /** - * The Constant TAG_AVAR indicates corresponding table tag - * in the Open Type Specification. + /** + * The Constant TAG_AVAR indicates corresponding table tag in the Open Type + * Specification. */ public static final int TAG_AVAR = 1635148146; - /** - * The Constant TAG_BASE indicates corresponding table tag - * in the Open Type Specification. + /** + * The Constant TAG_BASE indicates corresponding table tag in the Open Type + * Specification. */ public static final int TAG_BASE = 1111577413; - /** - * The Constant TAG_BDAT indicates corresponding table tag - * in the Open Type Specification. + /** + * The Constant TAG_BDAT indicates corresponding table tag in the Open Type + * Specification. */ public static final int TAG_BDAT = 1650745716; - /** - * The Constant TAG_BLOC indicates corresponding table tag - * in the Open Type Specification. + /** + * The Constant TAG_BLOC indicates corresponding table tag in the Open Type + * Specification. */ public static final int TAG_BLOC = 1651273571; - /** - * The Constant TAG_BSLN indicates corresponding table tag - * in the Open Type Specification. + /** + * The Constant TAG_BSLN indicates corresponding table tag in the Open Type + * Specification. */ public static final int TAG_BSLN = 1651731566; - /** - * The Constant TAG_CFF indicates corresponding table tag - * in the Open Type Specification. + /** + * The Constant TAG_CFF indicates corresponding table tag in the Open Type + * Specification. */ public static final int TAG_CFF = 1128678944; - /** - * The Constant TAG_CMAP indicates corresponding table tag - * in the Open Type Specification. + /** + * The Constant TAG_CMAP indicates corresponding table tag in the Open Type + * Specification. */ public static final int TAG_CMAP = 1668112752; - /** - * The Constant TAG_CVAR indicates corresponding table tag - * in the Open Type Specification. + /** + * The Constant TAG_CVAR indicates corresponding table tag in the Open Type + * Specification. */ public static final int TAG_CVAR = 1668702578; - /** - * The Constant TAG_CVT indicates corresponding table tag - * in the Open Type Specification. + /** + * The Constant TAG_CVT indicates corresponding table tag in the Open Type + * Specification. */ public static final int TAG_CVT = 1668707360; - /** - * The Constant TAG_DSIG indicates corresponding table tag - * in the Open Type Specification. + /** + * The Constant TAG_DSIG indicates corresponding table tag in the Open Type + * Specification. */ public static final int TAG_DSIG = 1146308935; - /** - * The Constant TAG_EBDT indicates corresponding table tag - * in the Open Type Specification. + /** + * The Constant TAG_EBDT indicates corresponding table tag in the Open Type + * Specification. */ public static final int TAG_EBDT = 1161970772; - /** - * The Constant TAG_EBLC indicates corresponding table tag - * in the Open Type Specification. + /** + * The Constant TAG_EBLC indicates corresponding table tag in the Open Type + * Specification. */ public static final int TAG_EBLC = 1161972803; - /** - * The Constant TAG_EBSC indicates corresponding table tag - * in the Open Type Specification. + /** + * The Constant TAG_EBSC indicates corresponding table tag in the Open Type + * Specification. */ public static final int TAG_EBSC = 1161974595; - /** - * The Constant TAG_FDSC indicates corresponding table tag - * in the Open Type Specification. + /** + * The Constant TAG_FDSC indicates corresponding table tag in the Open Type + * Specification. */ public static final int TAG_FDSC = 1717859171; - /** - * The Constant TAG_FEAT indicates corresponding table tag - * in the Open Type Specification. + /** + * The Constant TAG_FEAT indicates corresponding table tag in the Open Type + * Specification. */ public static final int TAG_FEAT = 1717920116; - /** - * The Constant TAG_FMTX indicates corresponding table tag - * in the Open Type Specification. + /** + * The Constant TAG_FMTX indicates corresponding table tag in the Open Type + * Specification. */ public static final int TAG_FMTX = 1718449272; - /** - * The Constant TAG_FPGM indicates corresponding table tag - * in the Open Type Specification. + /** + * The Constant TAG_FPGM indicates corresponding table tag in the Open Type + * Specification. */ public static final int TAG_FPGM = 1718642541; - /** - * The Constant TAG_FVAR indicates corresponding table tag - * in the Open Type Specification. + /** + * The Constant TAG_FVAR indicates corresponding table tag in the Open Type + * Specification. */ public static final int TAG_FVAR = 1719034226; - /** - * The Constant TAG_GASP indicates corresponding table tag - * in the Open Type Specification. + /** + * The Constant TAG_GASP indicates corresponding table tag in the Open Type + * Specification. */ public static final int TAG_GASP = 1734439792; - /** - * The Constant TAG_GDEF indicates corresponding table tag - * in the Open Type Specification. + /** + * The Constant TAG_GDEF indicates corresponding table tag in the Open Type + * Specification. */ public static final int TAG_GDEF = 1195656518; - /** - * The Constant TAG_GLYF indicates corresponding table tag - * in the Open Type Specification. + /** + * The Constant TAG_GLYF indicates corresponding table tag in the Open Type + * Specification. */ public static final int TAG_GLYF = 1735162214; - /** - * The Constant TAG_GPOS indicates corresponding table tag - * in the Open Type Specification. + /** + * The Constant TAG_GPOS indicates corresponding table tag in the Open Type + * Specification. */ public static final int TAG_GPOS = 1196445523; - /** - * The Constant TAG_GSUB indicates corresponding table tag - * in the Open Type Specification. + /** + * The Constant TAG_GSUB indicates corresponding table tag in the Open Type + * Specification. */ public static final int TAG_GSUB = 1196643650; - /** - * The Constant TAG_GVAR indicates corresponding table tag - * in the Open Type Specification. + /** + * The Constant TAG_GVAR indicates corresponding table tag in the Open Type + * Specification. */ public static final int TAG_GVAR = 1735811442; - /** - * The Constant TAG_HDMX indicates corresponding table tag - * in the Open Type Specification. + /** + * The Constant TAG_HDMX indicates corresponding table tag in the Open Type + * Specification. */ public static final int TAG_HDMX = 1751412088; - /** - * The Constant TAG_HEAD indicates corresponding table tag - * in the Open Type Specification. + /** + * The Constant TAG_HEAD indicates corresponding table tag in the Open Type + * Specification. */ public static final int TAG_HEAD = 1751474532; - /** - * The Constant TAG_HHEA indicates corresponding table tag - * in the Open Type Specification. + /** + * The Constant TAG_HHEA indicates corresponding table tag in the Open Type + * Specification. */ public static final int TAG_HHEA = 1751672161; - /** - * The Constant TAG_HMTX indicates corresponding table tag - * in the Open Type Specification. + /** + * The Constant TAG_HMTX indicates corresponding table tag in the Open Type + * Specification. */ public static final int TAG_HMTX = 1752003704; - /** - * The Constant TAG_JSTF indicates corresponding table tag - * in the Open Type Specification. + /** + * The Constant TAG_JSTF indicates corresponding table tag in the Open Type + * Specification. */ public static final int TAG_JSTF = 1246975046; - /** - * The Constant TAG_JUST indicates corresponding table tag - * in the Open Type Specification. + /** + * The Constant TAG_JUST indicates corresponding table tag in the Open Type + * Specification. */ public static final int TAG_JUST = 1786082164; - /** - * The Constant TAG_KERN indicates corresponding table tag - * in the Open Type Specification. + /** + * The Constant TAG_KERN indicates corresponding table tag in the Open Type + * Specification. */ public static final int TAG_KERN = 1801810542; - /** - * The Constant TAG_LCAR indicates corresponding table tag - * in the Open Type Specification. + /** + * The Constant TAG_LCAR indicates corresponding table tag in the Open Type + * Specification. */ public static final int TAG_LCAR = 1818452338; - /** - * The Constant TAG_LOCA indicates corresponding table tag - * in the Open Type Specification. + /** + * The Constant TAG_LOCA indicates corresponding table tag in the Open Type + * Specification. */ public static final int TAG_LOCA = 1819239265; - /** - * The Constant TAG_LTSH indicates corresponding table tag - * in the Open Type Specification. + /** + * The Constant TAG_LTSH indicates corresponding table tag in the Open Type + * Specification. */ public static final int TAG_LTSH = 1280594760; - /** - * The Constant TAG_MAXP indicates corresponding table tag - * in the Open Type Specification. + /** + * The Constant TAG_MAXP indicates corresponding table tag in the Open Type + * Specification. */ public static final int TAG_MAXP = 1835104368; - /** - * The Constant TAG_MMFX indicates corresponding table tag - * in the Open Type Specification. + /** + * The Constant TAG_MMFX indicates corresponding table tag in the Open Type + * Specification. */ public static final int TAG_MMFX = 1296909912; - /** - * The Constant TAG_MMSD indicates corresponding table tag - * in the Open Type Specification. + /** + * The Constant TAG_MMSD indicates corresponding table tag in the Open Type + * Specification. */ public static final int TAG_MMSD = 1296913220; - /** - * The Constant TAG_MORT indicates corresponding table tag - * in the Open Type Specification. + /** + * The Constant TAG_MORT indicates corresponding table tag in the Open Type + * Specification. */ public static final int TAG_MORT = 1836020340; - /** - * The Constant TAG_NAME indicates corresponding table tag - * in the Open Type Specification. + /** + * The Constant TAG_NAME indicates corresponding table tag in the Open Type + * Specification. */ public static final int TAG_NAME = 1851878757; - /** - * The Constant TAG_OPBD indicates corresponding table tag - * in the Open Type Specification. + /** + * The Constant TAG_OPBD indicates corresponding table tag in the Open Type + * Specification. */ public static final int TAG_OPBD = 1836020340; - /** - * The Constant TAG_OS2 indicates corresponding table tag - * in the Open Type Specification. + /** + * The Constant TAG_OS2 indicates corresponding table tag in the Open Type + * Specification. */ public static final int TAG_OS2 = 1330851634; - /** - * The Constant TAG_PCLT indicates corresponding table tag - * in the Open Type Specification. + /** + * The Constant TAG_PCLT indicates corresponding table tag in the Open Type + * Specification. */ public static final int TAG_PCLT = 1346587732; - /** - * The Constant TAG_POST indicates corresponding table tag - * in the Open Type Specification. + /** + * The Constant TAG_POST indicates corresponding table tag in the Open Type + * Specification. */ public static final int TAG_POST = 1886352244; - /** - * The Constant TAG_PREP indicates corresponding table tag - * in the Open Type Specification. + /** + * The Constant TAG_PREP indicates corresponding table tag in the Open Type + * Specification. */ public static final int TAG_PREP = 1886545264; - /** - * The Constant TAG_PROP indicates corresponding table tag - * in the Open Type Specification. + /** + * The Constant TAG_PROP indicates corresponding table tag in the Open Type + * Specification. */ public static final int TAG_PROP = 1886547824; - /** - * The Constant TAG_TRAK indicates corresponding table tag - * in the Open Type Specification. + /** + * The Constant TAG_TRAK indicates corresponding table tag in the Open Type + * Specification. */ public static final int TAG_TRAK = 1953653099; - /** - * The Constant TAG_TYP1 indicates corresponding table tag - * in the Open Type Specification. + /** + * The Constant TAG_TYP1 indicates corresponding table tag in the Open Type + * Specification. */ public static final int TAG_TYP1 = 1954115633; - /** - * The Constant TAG_VDMX indicates corresponding table tag - * in the Open Type Specification. + /** + * The Constant TAG_VDMX indicates corresponding table tag in the Open Type + * Specification. */ public static final int TAG_VDMX = 1447316824; - /** - * The Constant TAG_VHEA indicates corresponding table tag - * in the Open Type Specification. + /** + * The Constant TAG_VHEA indicates corresponding table tag in the Open Type + * Specification. */ public static final int TAG_VHEA = 1986553185; - /** - * The Constant TAG_VMTX indicates corresponding table tag - * in the Open Type Specification. + /** + * The Constant TAG_VMTX indicates corresponding table tag in the Open Type + * Specification. */ public static final int TAG_VMTX = 1986884728; @@ -341,70 +346,73 @@ public interface OpenType { public int getVersion(); /** - * Gets the table for a specified tag. - * Sfnt tables include cmap, name and head items. - * - * @param sfntTag the sfnt tag. + * Gets the table for a specified tag. Sfnt tables include cmap, name and + * head items. * - * @return a byte array contains the font data corresponding - * to the specified tag. + * @param sfntTag + * the sfnt tag. + * @return a byte array contains the font data corresponding to the + * specified tag. */ public byte[] getFontTable(int sfntTag); /** - * Gets the table for a specified tag. - * Sfnt tables include cmap, name and head items. - * - * @param sfntTag the sfnt tag. - * @param offset the offset of the returned table. - * @param count the number of returned table. + * Gets the table for a specified tag. Sfnt tables include cmap, name and + * head items. * - * @return the table corresponding to sfntTag and containing - * the bytes starting at offset byte and including count bytes. + * @param sfntTag + * the sfnt tag. + * @param offset + * the offset of the returned table. + * @param count + * the number of returned table. + * @return the table corresponding to sfntTag and containing the bytes + * starting at offset byte and including count bytes. */ public byte[] getFontTable(int sfntTag, int offset, int count); /** - * Gets the table for a specified tag. - * Sfnt tables include cmap, name and head items. - * - * @param strSfntTag the str sfnt tag as a String. + * Gets the table for a specified tag. Sfnt tables include cmap, name and + * head items. * - * @return a byte array contains the font data corresponding - * to the specified tag. + * @param strSfntTag + * the str sfnt tag as a String. + * @return a byte array contains the font data corresponding to the + * specified tag. */ public byte[] getFontTable(String strSfntTag); /** - * Gets the table for a specified tag. - * Sfnt tables include cmap, name and head items. - * - * @param strSfntTag the sfnt tag as a String. - * @param offset the offset of the returned table. - * @param count the number of returned table. + * Gets the table for a specified tag. Sfnt tables include cmap, name and + * head items. * - * @return the table corresponding to sfntTag and containing - * the bytes starting at offset byte and including count bytes. + * @param strSfntTag + * the sfnt tag as a String. + * @param offset + * the offset of the returned table. + * @param count + * the number of returned table. + * @return the table corresponding to sfntTag and containing the bytes + * starting at offset byte and including count bytes. */ public byte[] getFontTable(String strSfntTag, int offset, int count); /** - * Gets the table size for a specified tag. - * - * @param strSfntTag the sfnt tag as a String. + * Gets the table size for a specified tag. * + * @param strSfntTag + * the sfnt tag as a String. * @return the table size for a specified tag. */ public int getFontTableSize(String strSfntTag); /** - * Gets the table size for a specified tag. - * - * @param sfntTag the sfnt tag. + * Gets the table size for a specified tag. * + * @param sfntTag + * the sfnt tag. * @return the table size for a specified tag. */ public int getFontTableSize(int sfntTag); } - diff --git a/awt/java/awt/font/ShapeGraphicAttribute.java b/awt/java/awt/font/ShapeGraphicAttribute.java index 45199fd3f39bc..182bffddc2e19 100644 --- a/awt/java/awt/font/ShapeGraphicAttribute.java +++ b/awt/java/awt/font/ShapeGraphicAttribute.java @@ -18,6 +18,7 @@ * @author Ilya S. Okomin * @version $Revision$ */ + package java.awt.font; import java.awt.BasicStroke; @@ -29,61 +30,75 @@ import java.awt.geom.Rectangle2D; import org.apache.harmony.misc.HashCode; - /** - * The ShapeGraphicAttribute class provides an opportunity to insert - * shapes to a text. + * The ShapeGraphicAttribute class provides an opportunity to insert shapes to a + * text. + * + * @since Android 1.0 */ public final class ShapeGraphicAttribute extends GraphicAttribute { // shape to render - /** The shape. */ + /** + * The shape. + */ private Shape fShape; - + // flag, if the shape should be stroked (true) or filled (false) - /** The stroke. */ + /** + * The stroke. + */ private boolean fStroke; // bounds of the shape - /** The bounds. */ + /** + * The bounds. + */ private Rectangle2D fBounds; - + // X coordinate of the origin point - /** The origin x. */ + /** + * The origin x. + */ private float fOriginX; - + // Y coordinate of the origin point - /** The origin y. */ + /** + * The origin y. + */ private float fOriginY; // width of the shape - /** The shape width. */ + /** + * The shape width. + */ private float fShapeWidth; - + // height of the shape - /** The shape height. */ + /** + * The shape height. + */ private float fShapeHeight; - /** - * The Constant STROKE indicates whether the Shape is stroked - * or not. + /** + * The Constant STROKE indicates whether the Shape is stroked or not. */ public static final boolean STROKE = true; - /** - * The Constant FILL indicates whether the Shape is filled - * or not. */ + /** + * The Constant FILL indicates whether the Shape is filled or not. + */ public static final boolean FILL = false; /** - * Instantiates a new ShapeGraphicAttribute object for the specified - * Shape. + * Instantiates a new ShapeGraphicAttribute object for the specified Shape. * - * @param shape the shape to be rendered by this - * ShapeGraphicAttribute. - * @param alignment the alignment of this ShapeGraphicAttribute. - * @param stroke true if the Shape is stroked, - * false if the Shape is filled. + * @param shape + * the shape to be rendered by this ShapeGraphicAttribute. + * @param alignment + * the alignment of this ShapeGraphicAttribute. + * @param stroke + * true if the Shape is stroked, false if the Shape is filled. */ public ShapeGraphicAttribute(Shape shape, int alignment, boolean stroke) { super(alignment); @@ -91,7 +106,7 @@ public final class ShapeGraphicAttribute extends GraphicAttribute { this.fShape = shape; this.fStroke = stroke; - this.fBounds = fShape.getBounds2D(); + this.fBounds = fShape.getBounds2D(); this.fOriginX = (float)fBounds.getMinX(); this.fOriginY = (float)fBounds.getMinY(); @@ -118,10 +133,10 @@ public final class ShapeGraphicAttribute extends GraphicAttribute { * Compares this ShapeGraphicAttribute object to the specified * ShapeGraphicAttribute object. * - * @param sga the ShapeGraphicAttribute object to be compared. - * - * @return true, if this ShapeGraphicAttribute object is equal - * to the specified ShapeGraphicAttribute object, false otherwise. + * @param sga + * the ShapeGraphicAttribute object to be compared. + * @return true, if this ShapeGraphicAttribute object is equal to the + * specified ShapeGraphicAttribute object, false otherwise. */ public boolean equals(ShapeGraphicAttribute sga) { if (sga == null) { @@ -132,27 +147,24 @@ public final class ShapeGraphicAttribute extends GraphicAttribute { return true; } - return ( fStroke == sga.fStroke && - getAlignment() == sga.getAlignment() && - fShape.equals(sga.fShape)); + return (fStroke == sga.fStroke && getAlignment() == sga.getAlignment() && fShape + .equals(sga.fShape)); } /** - * Compares this ShapeGraphicAttribute object to the specified - * Object. + * Compares this ShapeGraphicAttribute object to the specified Object. * - * @param obj the Object to be compared. - * - * @return true, if this ShapeGraphicAttribute object is equal - * to the specified Object, false otherwise. + * @param obj + * the Object to be compared. + * @return true, if this ShapeGraphicAttribute object is equal to the + * specified Object, false otherwise. */ @Override public boolean equals(Object obj) { try { - return equals((ShapeGraphicAttribute) obj); - } - catch(ClassCastException e) { + return equals((ShapeGraphicAttribute)obj); + } catch (ClassCastException e) { return false; } } @@ -160,7 +172,7 @@ public final class ShapeGraphicAttribute extends GraphicAttribute { @Override public void draw(Graphics2D g2, float x, float y) { AffineTransform at = AffineTransform.getTranslateInstance(x, y); - if (fStroke == STROKE){ + if (fStroke == STROKE) { Stroke oldStroke = g2.getStroke(); g2.setStroke(new BasicStroke()); g2.draw(at.createTransformedShape(fShape)); @@ -192,4 +204,3 @@ public final class ShapeGraphicAttribute extends GraphicAttribute { } } - diff --git a/awt/java/awt/font/TextHitInfo.java b/awt/java/awt/font/TextHitInfo.java index 17bbf717cef1c..6460ebacee79a 100644 --- a/awt/java/awt/font/TextHitInfo.java +++ b/awt/java/awt/font/TextHitInfo.java @@ -23,29 +23,36 @@ package java.awt.font; import org.apache.harmony.misc.HashCode; - /** - * The TextHitInfo class provides information about a caret position - * in a text model for insertion or deletion of a character in a text. - * The TextHitInfo defines two biases of the character: leading or trailing. - * Leading position means the left edge of the specified character - * (TextHitInfo.leading(2) method for "text" returns the left side of "x"). - * Trailing position means the right edge of the specified character - * (TextHitInfo.trailing(2) method for "text" returns the right side of "x"). + * The TextHitInfo class provides information about a caret position in a text + * model for insertion or deletion of a character in a text. The TextHitInfo + * defines two biases of the character: leading or trailing. Leading position + * means the left edge of the specified character (TextHitInfo.leading(2) method + * for "text" returns the left side of "x"). Trailing position means the right + * edge of the specified character (TextHitInfo.trailing(2) method for "text" + * returns the right side of "x"). + * + * @since Android 1.0 */ public final class TextHitInfo { - - /** The char idx. */ + + /** + * The char idx. + */ private int charIdx; // Represents character index in the line - - /** The is trailing. */ + + /** + * The is trailing. + */ private boolean isTrailing; /** * Instantiates a new text hit info. * - * @param idx the idx - * @param isTrailing the is trailing + * @param idx + * the idx. + * @param isTrailing + * the is trailing. */ private TextHitInfo(int idx, boolean isTrailing) { charIdx = idx; @@ -53,90 +60,82 @@ public final class TextHitInfo { } /** - * To string. + * Returns the textual string representation of this TextHitInfo instance. * - * @return the string + * @return the string representation. */ @Override public String toString() { - return new String( - "TextHitInfo[" + charIdx + ", " + //$NON-NLS-1$ //$NON-NLS-2$ - (isTrailing?"Trailing":"Leading") + "]" //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + return new String("TextHitInfo[" + charIdx + ", " + //$NON-NLS-1$ //$NON-NLS-2$ + (isTrailing ? "Trailing" : "Leading") + "]" //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ ); } /** * Compares this TextHitInfo object with the specified object. * - * @param obj the Object to be compared. - * - * @return true, if the specified object is a TextHitInfo object - * with the same data values as this TextHitInfo, false otherwise. + * @param obj + * the Object to be compared. + * @return true, if the specified object is a TextHitInfo object with the + * same data values as this TextHitInfo, false otherwise. */ @Override public boolean equals(Object obj) { if (obj instanceof TextHitInfo) { - return equals((TextHitInfo) obj); + return equals((TextHitInfo)obj); } return false; } /** - * Compares this TextHitInfo object with the specified TextHitInfo - * object. - * - * @param thi the TextHitInfo object to be compared. + * Compares this TextHitInfo object with the specified TextHitInfo object. * + * @param thi + * the TextHitInfo object to be compared. * @return true, if this TextHitInfo object has the same data values as the - * specified TextHitInfo object, false otherwise. + * specified TextHitInfo object, false otherwise. */ public boolean equals(TextHitInfo thi) { - return - thi != null && - thi.charIdx == charIdx && - thi.isTrailing == isTrailing; + return thi != null && thi.charIdx == charIdx && thi.isTrailing == isTrailing; } /** - * Gets a TextHitInfo object with its character index - * at the specified offset from the character index of - * this TextHitInfo. + * Gets a TextHitInfo object with its character index at the specified + * offset from the character index of this TextHitInfo. * - * @param offset the offset. - * - * @return the TextHitInfo. + * @param offset + * the offset. + * @return the TextHitInfo. */ public TextHitInfo getOffsetHit(int offset) { return new TextHitInfo(charIdx + offset, isTrailing); } /** - * Gets a TextHitInfo associated with the other side of - * the insertion point. - * + * Gets a TextHitInfo associated with the other side of the insertion point. + * * @return the other hit. */ public TextHitInfo getOtherHit() { - return isTrailing ? - new TextHitInfo(charIdx+1, false) : - new TextHitInfo(charIdx-1, true); + return isTrailing ? new TextHitInfo(charIdx + 1, false) + : new TextHitInfo(charIdx - 1, true); } /** - * Returns true if the leading edge of the character is hit, - * false if the trailing edge of the character is hit. + * Returns true if the leading edge of the character is hit, false if the + * trailing edge of the character is hit. * - * @return true if the leading edge of the character is hit, - * false if the trailing edge of the character is hit. + * @return true if the leading edge of the character is hit, false if the + * trailing edge of the character is hit. */ public boolean isLeadingEdge() { return !isTrailing; } /** - * Hash code. + * Returns the hash code value of this TextHitInfo instance. * - * @return the int + * @return the hash code value. */ @Override public int hashCode() { @@ -146,11 +145,11 @@ public final class TextHitInfo { /** * Gets the insertion index. * - * @return the insertion index: character index if the leading edge - * is hit, or character index + 1 if the trailing edge is hit. + * @return the insertion index: character index if the leading edge is hit, + * or character index + 1 if the trailing edge is hit. */ public int getInsertionIndex() { - return isTrailing ? charIdx+1 : charIdx; + return isTrailing ? charIdx + 1 : charIdx; } /** @@ -163,52 +162,52 @@ public final class TextHitInfo { } /** - * Returns a TextHitInfo associated with the trailing edge of - * the character at the specified char index. + * Returns a TextHitInfo associated with the trailing edge of the character + * at the specified char index. * - * @param charIndex the char index. - * - * @return the TextHitInfo associated with the trailing edge of - * the character at the specified char index. + * @param charIndex + * the char index. + * @return the TextHitInfo associated with the trailing edge of the + * character at the specified char index. */ public static TextHitInfo trailing(int charIndex) { return new TextHitInfo(charIndex, true); } /** - * Returns a TextHitInfo object associated with the leading edge - * of the character at the specified char index. - * - * @param charIndex the char index. + * Returns a TextHitInfo object associated with the leading edge of the + * character at the specified char index. * - * @return the TextHitInfo object associated with the leading edge - * of the character at the specified char index. + * @param charIndex + * the char index. + * @return the TextHitInfo object associated with the leading edge of the + * character at the specified char index. */ public static TextHitInfo leading(int charIndex) { return new TextHitInfo(charIndex, false); } /** - * Returns a (trailing) TextHitInfo object associated with the character + * Returns a (trailing) TextHitInfo object associated with the character * before the specified offset. * - * @param offset the offset. - * - * @return the TextHitInfo object associated with the character - * before the specified offset. + * @param offset + * the offset. + * @return the TextHitInfo object associated with the character before the + * specified offset. */ public static TextHitInfo beforeOffset(int offset) { - return new TextHitInfo(offset-1, true); + return new TextHitInfo(offset - 1, true); } /** - * Returns a (leading) TextHitInfo object associated with the character + * Returns a (leading) TextHitInfo object associated with the character * after the specified offset. * - * @param offset the offset. - * - * @return the TextHitInfo object associated with the character - * after the specified offset. + * @param offset + * the offset. + * @return the TextHitInfo object associated with the character after the + * specified offset. */ public static TextHitInfo afterOffset(int offset) { return new TextHitInfo(offset, false); diff --git a/awt/java/awt/font/TextLayout.java b/awt/java/awt/font/TextLayout.java index e80afd091e0e9..cc6f0ba3af61d 100644 --- a/awt/java/awt/font/TextLayout.java +++ b/awt/java/awt/font/TextLayout.java @@ -39,18 +39,19 @@ import org.apache.harmony.awt.internal.nls.Messages; /** * The TextLayout class defines the graphical representation of character data. - * This class provides method for obtaining information about cursor - * positioning and movement, split cursors for text with different directions, - * logical and visual highlighting, multiple baselines, hits, justification, - * ascent, descent, and advance, and rendering. A TextLayout object can be - * rendered using Graphics context. + * This class provides method for obtaining information about cursor positioning + * and movement, split cursors for text with different directions, logical and + * visual highlighting, multiple baselines, hits, justification, ascent, + * descent, and advance, and rendering. A TextLayout object can be rendered + * using Graphics context. + * + * @since Android 1.0 */ public final class TextLayout implements Cloneable { /** - * The CaretPolicy class provides a policy for obtaining the - * caret location. The single getStrongCaret method specifies - * the policy. + * The CaretPolicy class provides a policy for obtaining the caret location. + * The single getStrongCaret method specifies the policy. */ public static class CaretPolicy { @@ -62,14 +63,15 @@ public final class TextLayout implements Cloneable { } /** - * Returns whichever of the two specified TextHitInfo objects - * has the stronger caret (higher character level) in the - * specified TextLayout. - * - * @param hit1 the first TextHitInfo of the specified TextLayout. - * @param hit2 the second TextHitInfo of the specified TextLayout. - * @param layout the TextLayout. + * Returns whichever of the two specified TextHitInfo objects has the + * stronger caret (higher character level) in the specified TextLayout. * + * @param hit1 + * the first TextHitInfo of the specified TextLayout. + * @param hit2 + * the second TextHitInfo of the specified TextLayout. + * @param layout + * the TextLayout. * @return the TextHitInfo with the stronger caret. */ public TextHitInfo getStrongCaret(TextHitInfo hit1, TextHitInfo hit2, TextLayout layout) { @@ -87,50 +89,64 @@ public final class TextLayout implements Cloneable { } - /** + /** * The Constant DEFAULT_CARET_POLICY indicates the default caret policy. */ public static final TextLayout.CaretPolicy DEFAULT_CARET_POLICY = new CaretPolicy(); - /** The breaker. */ + /** + * The breaker. + */ private TextRunBreaker breaker; - - /** The metrics valid. */ + + /** + * The metrics valid. + */ private boolean metricsValid = false; - - /** The tmc. */ + + /** + * The tmc. + */ private TextMetricsCalculator tmc; - - /** The metrics. */ + + /** + * The metrics. + */ private BasicMetrics metrics; - - /** The caret manager. */ + + /** + * The caret manager. + */ private CaretManager caretManager; - - /** The justification width. */ + + /** + * The justification width. + */ float justificationWidth = -1; /** - * Instantiates a new TextLayout object from the specified string - * and Font. + * Instantiates a new TextLayout object from the specified string and Font. * - * @param string the string to be displayed. - * @param font the font of the text. - * @param frc the FontRenderContext object for obtaining - * information about a graphics device. + * @param string + * the string to be displayed. + * @param font + * the font of the text. + * @param frc + * the FontRenderContext object for obtaining information about a + * graphics device. */ public TextLayout(String string, Font font, FontRenderContext frc) { - if (string == null){ + if (string == null) { // awt.01='{0}' parameter is null throw new IllegalArgumentException(Messages.getString("awt.01", "string")); //$NON-NLS-1$ //$NON-NLS-2$ } - - if (font == null){ + + if (font == null) { // awt.01='{0}' parameter is null throw new IllegalArgumentException(Messages.getString("awt.01", "font")); //$NON-NLS-1$ //$NON-NLS-2$ } - if (string.length() == 0){ + if (string.length() == 0) { // awt.02='{0}' parameter has zero length throw new IllegalArgumentException(Messages.getString("awt.02", "string")); //$NON-NLS-1$ //$NON-NLS-2$ } @@ -142,35 +158,35 @@ public final class TextLayout implements Cloneable { } /** - * Instantiates a new TextLayout from the specified text and - * a map of attributes. + * Instantiates a new TextLayout from the specified text and a map of + * attributes. * - * @param string the string to be displayed. - * @param attributes the attributes to be used for obtaining the text - * style. - * @param frc the FontRenderContext object for obtaining - * information about a graphics device. + * @param string + * the string to be displayed. + * @param attributes + * the attributes to be used for obtaining the text style. + * @param frc + * the FontRenderContext object for obtaining information about a + * graphics device. */ - public TextLayout( - String string, + public TextLayout(String string, Map attributes, - FontRenderContext frc ) { - if (string == null){ + FontRenderContext frc) { + if (string == null) { // awt.01='{0}' parameter is null throw new IllegalArgumentException(Messages.getString("awt.01", "string")); //$NON-NLS-1$ //$NON-NLS-2$ } - - if (attributes == null){ + + if (attributes == null) { // awt.01='{0}' parameter is null throw new IllegalArgumentException(Messages.getString("awt.01", "attributes")); //$NON-NLS-1$ //$NON-NLS-2$ } - - if (string.length() == 0){ + + if (string.length() == 0) { // awt.02='{0}' parameter has zero length throw new IllegalArgumentException(Messages.getString("awt.02", "string")); //$NON-NLS-1$ //$NON-NLS-2$ } - - + AttributedString as = new AttributedString(string); as.addAttributes(attributes, 0, string.length()); this.breaker = new TextRunBreaker(as.getIterator(), frc); @@ -180,17 +196,19 @@ public final class TextLayout implements Cloneable { /** * Instantiates a new TextLayout from the AttributedCharacterIterator. * - * @param text the AttributedCharacterIterator. - * @param frc the FontRenderContext object for obtaining - * information about a graphics device. + * @param text + * the AttributedCharacterIterator. + * @param frc + * the FontRenderContext object for obtaining information about a + * graphics device. */ public TextLayout(AttributedCharacterIterator text, FontRenderContext frc) { - if (text == null){ + if (text == null) { // awt.03='{0}' iterator parameter is null throw new IllegalArgumentException(Messages.getString("awt.03", "text")); //$NON-NLS-1$ //$NON-NLS-2$ } - - if (text.getBeginIndex() == text.getEndIndex()){ + + if (text.getBeginIndex() == text.getEndIndex()) { // awt.04='{0}' iterator parameter has zero length throw new IllegalArgumentException(Messages.getString("awt.04", "text")); //$NON-NLS-1$ //$NON-NLS-2$ } @@ -202,7 +220,8 @@ public final class TextLayout implements Cloneable { /** * Instantiates a new text layout. * - * @param breaker the breaker + * @param breaker + * the breaker. */ TextLayout(TextRunBreaker breaker) { this.breaker = breaker; @@ -226,7 +245,7 @@ public final class TextLayout implements Cloneable { */ @Override protected Object clone() { - TextLayout res = new TextLayout((TextRunBreaker) breaker.clone()); + TextLayout res = new TextLayout((TextRunBreaker)breaker.clone()); if (justificationWidth >= 0) { res.handleJustify(justificationWidth); @@ -238,10 +257,10 @@ public final class TextLayout implements Cloneable { /** * Compares this TextLayout object to the specified TextLayout object. * - * @param layout the TextLayout object to be compared. - * - * @return true, if this TextLayout object is equal to - * the specified TextLayout object, false otherwise. + * @param layout + * the TextLayout object to be compared. + * @return true, if this TextLayout object is equal to the specified + * TextLayout object, false otherwise. */ public boolean equals(TextLayout layout) { if (layout == null) { @@ -253,14 +272,14 @@ public final class TextLayout implements Cloneable { /** * Compares this TextLayout object to the specified Object. * - * @param obj the Object to be compared. - * - * @return true, if this TextLayout object is equal to - * the specified Object, false otherwise. + * @param obj + * the Object to be compared. + * @return true, if this TextLayout object is equal to the specified Object, + * false otherwise. */ @Override public boolean equals(Object obj) { - return obj instanceof TextLayout ? equals((TextLayout) obj) : false; + return obj instanceof TextLayout ? equals((TextLayout)obj) : false; } /** @@ -274,16 +293,19 @@ public final class TextLayout implements Cloneable { } /** - * Draws this TextLayout at the specified location with the - * specified Graphics2D context. + * Draws this TextLayout at the specified location with the specified + * Graphics2D context. * - * @param g2d the Graphics2D object which renders this TextLayout. - * @param x the X coordinate of the TextLayout origin. - * @param y the Y coordinate of the TextLayout origin. + * @param g2d + * the Graphics2D object which renders this TextLayout. + * @param x + * the X coordinate of the TextLayout origin. + * @param y + * the Y coordinate of the TextLayout origin. */ public void draw(Graphics2D g2d, float x, float y) { updateMetrics(); - breaker.drawSegments(g2d, x ,y); + breaker.drawSegments(g2d, x, y); } /** @@ -325,15 +347,15 @@ public final class TextLayout implements Cloneable { */ public byte getBaseline() { updateMetrics(); - return (byte) metrics.getBaseLineIndex(); + return (byte)metrics.getBaseLineIndex(); } /** - * Gets the float array of offsets for the baselines which - * are used in this TextLayout. + * Gets the float array of offsets for the baselines which are used in this + * TextLayout. * - * @return the float array of offsets for the baselines which - * are used in this TextLayout. + * @return the float array of offsets for the baselines which are used in + * this TextLayout. */ public float[] getBaselineOffsets() { updateMetrics(); @@ -341,14 +363,15 @@ public final class TextLayout implements Cloneable { } /** - * Gets the black box bounds of the characters in the specified area. - * The black box bounds is an Shape which contains all - * bounding boxes of all the glyphs of the characters - * between firstEndpoint and secondEndpoint parameters values. - * - * @param firstEndpoint the first point of the area. - * @param secondEndpoint the second point of the area. + * Gets the black box bounds of the characters in the specified area. The + * black box bounds is an Shape which contains all bounding boxes of all the + * glyphs of the characters between firstEndpoint and secondEndpoint + * parameters values. * + * @param firstEndpoint + * the first point of the area. + * @param secondEndpoint + * the second point of the area. * @return the Shape which contains black box bounds. */ public Shape getBlackBoxBounds(int firstEndpoint, int secondEndpoint) { @@ -372,8 +395,8 @@ public final class TextLayout implements Cloneable { /** * Gets information about the caret of the specified TextHitInfo. * - * @param hitInfo the TextHitInfo. - * + * @param hitInfo + * the TextHitInfo. * @return the information about the caret of the specified TextHitInfo. */ public float[] getCaretInfo(TextHitInfo hitInfo) { @@ -382,12 +405,13 @@ public final class TextLayout implements Cloneable { } /** - * Gets information about the caret of the specified TextHitInfo - * of a character in this TextLayout. - * - * @param hitInfo the TextHitInfo of a character in this TextLayout. - * @param bounds the bounds to which the caret info is constructed. + * Gets information about the caret of the specified TextHitInfo of a + * character in this TextLayout. * + * @param hitInfo + * the TextHitInfo of a character in this TextLayout. + * @param bounds + * the bounds to which the caret info is constructed. * @return the caret of the specified TextHitInfo. */ public float[] getCaretInfo(TextHitInfo hitInfo, Rectangle2D bounds) { @@ -396,12 +420,13 @@ public final class TextLayout implements Cloneable { } /** - * Gets a Shape which represents the caret of the specified TextHitInfo - * in the bounds of this TextLayout. - * - * @param hitInfo the TextHitInfo. - * @param bounds the bounds to which the caret info is constructed. + * Gets a Shape which represents the caret of the specified TextHitInfo in + * the bounds of this TextLayout. * + * @param hitInfo + * the TextHitInfo. + * @param bounds + * the bounds to which the caret info is constructed. * @return the Shape which represents the caret. */ public Shape getCaretShape(TextHitInfo hitInfo, Rectangle2D bounds) { @@ -410,11 +435,11 @@ public final class TextLayout implements Cloneable { } /** - * Gets a Shape which represents the caret of the specified TextHitInfo - * in the bounds of this TextLayout. - * - * @param hitInfo the TextHitInfo. + * Gets a Shape which represents the caret of the specified TextHitInfo in + * the bounds of this TextLayout. * + * @param hitInfo + * the TextHitInfo. * @return the Shape which represents the caret. */ public Shape getCaretShape(TextHitInfo hitInfo) { @@ -423,45 +448,47 @@ public final class TextLayout implements Cloneable { } /** - * Gets two Shapes for the strong and weak carets with - * default caret policy and null bounds: the first element - * is the strong caret, the second is the weak caret or null. + * Gets two Shapes for the strong and weak carets with default caret policy + * and null bounds: the first element is the strong caret, the second is the + * weak caret or null. * - * @param offset an offset in the TextLayout. - * - * @return an array of two Shapes corresponded to the strong - * and weak carets. + * @param offset + * an offset in the TextLayout. + * @return an array of two Shapes corresponded to the strong and weak + * carets. */ public Shape[] getCaretShapes(int offset) { return getCaretShapes(offset, null, TextLayout.DEFAULT_CARET_POLICY); } /** - * Gets two Shapes for the strong and weak carets with - * the default caret policy: the first element is the strong - * caret, the second is the weak caret or null. - * - * @param offset an offset in the TextLayout. - * @param bounds the bounds to which to extend the carets. + * Gets two Shapes for the strong and weak carets with the default caret + * policy: the first element is the strong caret, the second is the weak + * caret or null. * - * @return an array of two Shapes corresponded to the strong - * and weak carets. + * @param offset + * an offset in the TextLayout. + * @param bounds + * the bounds to which to extend the carets. + * @return an array of two Shapes corresponded to the strong and weak + * carets. */ public Shape[] getCaretShapes(int offset, Rectangle2D bounds) { return getCaretShapes(offset, bounds, TextLayout.DEFAULT_CARET_POLICY); } /** - * Gets two Shapes for the strong and weak carets: the first - * element is the strong caret, the second is the weak caret - * or null. - * - * @param offset an offset in the TextLayout. - * @param bounds the bounds to which to extend the carets. - * @param policy the specified CaretPolicy. + * Gets two Shapes for the strong and weak carets: the first element is the + * strong caret, the second is the weak caret or null. * - * @return an array of two Shapes corresponded to the strong - * and weak carets. + * @param offset + * an offset in the TextLayout. + * @param bounds + * the bounds to which to extend the carets. + * @param policy + * the specified CaretPolicy. + * @return an array of two Shapes corresponded to the strong and weak + * carets. */ public Shape[] getCaretShapes(int offset, Rectangle2D bounds, TextLayout.CaretPolicy policy) { if (offset < 0 || offset > breaker.getCharCount()) { @@ -483,15 +510,15 @@ public final class TextLayout implements Cloneable { } /** - * Gets the level of the character with the specified index. - * - * @param index the specified index of the character. + * Gets the level of the character with the specified index. * + * @param index + * the specified index of the character. * @return the level of the character. */ public byte getCharacterLevel(int index) { if (index == -1 || index == getCharacterCount()) { - return (byte) breaker.getBaseLevel(); + return (byte)breaker.getBaseLevel(); } return breaker.getLevel(index); } @@ -507,16 +534,15 @@ public final class TextLayout implements Cloneable { } /** - * Gets the TextLayout wich is justified with the specified - * width related to this TextLayout. - * - * @param justificationWidth the width which is used - * for justification. + * Gets the TextLayout wich is justified with the specified width related to + * this TextLayout. * + * @param justificationWidth + * the width which is used for justification. * @return a TextLayout justified to the specified width. - * - * @throws Error the error occures if this TextLayout has been - * already justified. + * @throws Error + * the error occures if this TextLayout has been already + * justified. */ public TextLayout getJustifiedLayout(float justificationWidth) throws Error { float justification = breaker.getJustification(); @@ -528,7 +554,7 @@ public final class TextLayout implements Cloneable { return this; } - TextLayout justifiedLayout = new TextLayout((TextRunBreaker) breaker.clone()); + TextLayout justifiedLayout = new TextLayout((TextRunBreaker)breaker.clone()); justifiedLayout.handleJustify(justificationWidth); return justifiedLayout; } @@ -544,15 +570,15 @@ public final class TextLayout implements Cloneable { } /** - * Gets a Shape representing the logical selection betweeen - * the specified endpoints and extended to the natural - * bounds of this TextLayout. - * - * @param firstEndpoint the first selected endpoint within the area of characters - * @param secondEndpoint the second selected endpoint within the area of characters + * Gets a Shape representing the logical selection betweeen the specified + * endpoints and extended to the natural bounds of this TextLayout. * - * @return a Shape represented the logical selection betweeen - * the specified endpoints. + * @param firstEndpoint + * the first selected endpoint within the area of characters + * @param secondEndpoint + * the second selected endpoint within the area of characters + * @return a Shape represented the logical selection betweeen the specified + * endpoints. */ public Shape getLogicalHighlightShape(int firstEndpoint, int secondEndpoint) { updateMetrics(); @@ -560,22 +586,19 @@ public final class TextLayout implements Cloneable { } /** - * Gets a Shape representing the logical selection betweeen - * the specified endpoints and extended to the specified - * bounds of this TextLayout. + * Gets a Shape representing the logical selection betweeen the specified + * endpoints and extended to the specified bounds of this TextLayout. * - * @param firstEndpoint the first selected endpoint within the area of characters - * @param secondEndpoint the second selected endpoint within the area of characters - * @param bounds the specified bounds of this TextLayout. - * - * @return a Shape represented the logical selection betweeen - * the specified endpoints. + * @param firstEndpoint + * the first selected endpoint within the area of characters + * @param secondEndpoint + * the second selected endpoint within the area of characters + * @param bounds + * the specified bounds of this TextLayout. + * @return a Shape represented the logical selection betweeen the specified + * endpoints. */ - public Shape getLogicalHighlightShape( - int firstEndpoint, - int secondEndpoint, - Rectangle2D bounds - ) { + public Shape getLogicalHighlightShape(int firstEndpoint, int secondEndpoint, Rectangle2D bounds) { updateMetrics(); if (firstEndpoint > secondEndpoint) { @@ -583,62 +606,51 @@ public final class TextLayout implements Cloneable { // awt.197=Endpoints are out of range throw new IllegalArgumentException(Messages.getString("awt.197")); //$NON-NLS-1$ } - return caretManager.getLogicalHighlightShape( - secondEndpoint, - firstEndpoint, - bounds, - this - ); + return caretManager.getLogicalHighlightShape(secondEndpoint, firstEndpoint, bounds, + this); } if (firstEndpoint < 0 || secondEndpoint > breaker.getCharCount()) { // awt.197=Endpoints are out of range throw new IllegalArgumentException(Messages.getString("awt.197")); //$NON-NLS-1$ } - return caretManager.getLogicalHighlightShape( - firstEndpoint, - secondEndpoint, - bounds, - this - ); + return caretManager.getLogicalHighlightShape(firstEndpoint, secondEndpoint, bounds, this); } /** - * Gets the logical ranges of text which corresponds to a visual - * selection. - * - * @param hit1 the first endpoint of the visual range. - * @param hit2 the second endpoint of the visual range. + * Gets the logical ranges of text which corresponds to a visual selection. * - * @return the logical ranges of text which corresponds to a visual - * selection. + * @param hit1 + * the first endpoint of the visual range. + * @param hit2 + * the second endpoint of the visual range. + * @return the logical ranges of text which corresponds to a visual + * selection. */ public int[] getLogicalRangesForVisualSelection(TextHitInfo hit1, TextHitInfo hit2) { return caretManager.getLogicalRangesForVisualSelection(hit1, hit2); } /** - * Gets the TextHitInfo for the next caret to the left (or - * up at the end of the line) of the specified offset. - * - * @param offset the offset in this TextLayout. + * Gets the TextHitInfo for the next caret to the left (or up at the end of + * the line) of the specified offset. * - * @return the TextHitInfo for the next caret to the left (or - * up at the end of the line) of the specified hit, or null - * if there is no hit. + * @param offset + * the offset in this TextLayout. + * @return the TextHitInfo for the next caret to the left (or up at the end + * of the line) of the specified hit, or null if there is no hit. */ public TextHitInfo getNextLeftHit(int offset) { return getNextLeftHit(offset, DEFAULT_CARET_POLICY); } /** - * Gets the TextHitInfo for the next caret to the left (or - * up at the end of the line) of the specified hit. + * Gets the TextHitInfo for the next caret to the left (or up at the end of + * the line) of the specified hit. * - * @param hitInfo the initial hit. - * - * @return the TextHitInfo for the next caret to the left (or - * up at the end of the line) of the specified hit, or null - * if there is no hit. + * @param hitInfo + * the initial hit. + * @return the TextHitInfo for the next caret to the left (or up at the end + * of the line) of the specified hit, or null if there is no hit. */ public TextHitInfo getNextLeftHit(TextHitInfo hitInfo) { breaker.createAllSegments(); @@ -646,15 +658,15 @@ public final class TextLayout implements Cloneable { } /** - * Gets the TextHitInfo for the next caret to the left (or - * up at the end of the line) of the specified offset, given the - * specified caret policy. - * - * @param offset the offset in this TextLayout. - * @param policy the policy to be used for obtaining the strong caret. + * Gets the TextHitInfo for the next caret to the left (or up at the end of + * the line) of the specified offset, given the specified caret policy. * - * @return the TextHitInfo for the next caret to the left of the - * specified offset, or null if there is no hit. + * @param offset + * the offset in this TextLayout. + * @param policy + * the policy to be used for obtaining the strong caret. + * @return the TextHitInfo for the next caret to the left of the specified + * offset, or null if there is no hit. */ public TextHitInfo getNextLeftHit(int offset, TextLayout.CaretPolicy policy) { if (offset < 0 || offset > breaker.getCharCount()) { @@ -673,14 +685,14 @@ public final class TextLayout implements Cloneable { } /** - * Gets the TextHitInfo for the next caret to the right (or - * down at the end of the line) of the specified hit. - * - * @param hitInfo the initial hit. + * Gets the TextHitInfo for the next caret to the right (or down at the end + * of the line) of the specified hit. * - * @return the TextHitInfo for the next caret to the right (or - * down at the end of the line) of the specified hit, or null - * if there is no hit. + * @param hitInfo + * the initial hit. + * @return the TextHitInfo for the next caret to the right (or down at the + * end of the line) of the specified hit, or null if there is no + * hit. */ public TextHitInfo getNextRightHit(TextHitInfo hitInfo) { breaker.createAllSegments(); @@ -688,28 +700,28 @@ public final class TextLayout implements Cloneable { } /** - * Gets the TextHitInfo for the next caret to the right (or - * down at the end of the line) of the specified offset. + * Gets the TextHitInfo for the next caret to the right (or down at the end + * of the line) of the specified offset. * - * @param offset the offset in this TextLayout. - * - * @return the TextHitInfo for the next caret to the right of the - * specified offset, or null if there is no hit. + * @param offset + * the offset in this TextLayout. + * @return the TextHitInfo for the next caret to the right of the specified + * offset, or null if there is no hit. */ public TextHitInfo getNextRightHit(int offset) { return getNextRightHit(offset, DEFAULT_CARET_POLICY); } /** - * Gets the TextHitInfo for the next caret to the right (or - * down at the end of the line) of the specified offset, given the - * specified caret policy. - * - * @param offset the offset in this TextLayout. - * @param policy the policy to be used for obtaining the strong caret. + * Gets the TextHitInfo for the next caret to the right (or down at the end + * of the line) of the specified offset, given the specified caret policy. * - * @return the TextHitInfo for the next caret to the right of the - * specified offset, or null if there is no hit. + * @param offset + * the offset in this TextLayout. + * @param policy + * the policy to be used for obtaining the strong caret. + * @return the TextHitInfo for the next caret to the right of the specified + * offset, or null if there is no hit. */ public TextHitInfo getNextRightHit(int offset, TextLayout.CaretPolicy policy) { if (offset < 0 || offset > breaker.getCharCount()) { @@ -730,10 +742,9 @@ public final class TextLayout implements Cloneable { /** * Gets the outline of this TextLayout as a Shape. * - * @param xform the AffineTransform to be used to transform - * the outline before returning it, or null if no transformation - * is desired. - * + * @param xform + * the AffineTransform to be used to transform the outline before + * returning it, or null if no transformation is desired. * @return the outline of this TextLayout as a Shape. */ public Shape getOutline(AffineTransform xform) { @@ -749,8 +760,8 @@ public final class TextLayout implements Cloneable { } /** - * Gets the visible advance of this TextLayout which is defined as - * diffence between leading (advance) and trailing whitespace. + * Gets the visible advance of this TextLayout which is defined as diffence + * between leading (advance) and trailing whitespace. * * @return the visible advance of this TextLayout. */ @@ -764,15 +775,13 @@ public final class TextLayout implements Cloneable { if (lastNonWhitespace < 0) { return 0; - } else if (lastNonWhitespace == getCharacterCount()-1) { + } else if (lastNonWhitespace == getCharacterCount() - 1) { return getAdvance(); } else if (justificationWidth >= 0) { // Layout is justified return justificationWidth; } else { - breaker.pushSegments( - breaker.getACI().getBeginIndex(), - lastNonWhitespace + breaker.getACI().getBeginIndex() + 1 - ); + breaker.pushSegments(breaker.getACI().getBeginIndex(), lastNonWhitespace + + breaker.getACI().getBeginIndex() + 1); breaker.createAllSegments(); @@ -784,14 +793,16 @@ public final class TextLayout implements Cloneable { } /** - * Gets a Shape which corresponds to the highlighted (selected) area - * based on two hit locations within the text and extends to the bounds. - * - * @param hit1 the first text hit location. - * @param hit2 the second text hit location. - * @param bounds the rectangle that the highlighted area should be - * extended or restricted to. + * Gets a Shape which corresponds to the highlighted (selected) area based + * on two hit locations within the text and extends to the bounds. * + * @param hit1 + * the first text hit location. + * @param hit2 + * the second text hit location. + * @param bounds + * the rectangle that the highlighted area should be extended or + * restricted to. * @return a Shape which corresponds to the highlighted (selected) area. */ public Shape getVisualHighlightShape(TextHitInfo hit1, TextHitInfo hit2, Rectangle2D bounds) { @@ -799,12 +810,13 @@ public final class TextLayout implements Cloneable { } /** - * Gets a Shape which corresponds to the highlighted (selected) area - * based on two hit locations within the text. - * - * @param hit1 the first text hit location. - * @param hit2 the second text hit location. + * Gets a Shape which corresponds to the highlighted (selected) area based + * on two hit locations within the text. * + * @param hit1 + * the first text hit location. + * @param hit2 + * the second text hit location. * @return a Shape which corresponds to the highlighted (selected) area. */ public Shape getVisualHighlightShape(TextHitInfo hit1, TextHitInfo hit2) { @@ -813,23 +825,23 @@ public final class TextLayout implements Cloneable { } /** - * Gets the TextHitInfo for a hit on the opposite side of the - * specified hit's caret. - * - * @param hitInfo the specified TextHitInfo. + * Gets the TextHitInfo for a hit on the opposite side of the specified + * hit's caret. * - * @return the TextHitInfo for a hit on the opposite side of the - * specified hit's caret. + * @param hitInfo + * the specified TextHitInfo. + * @return the TextHitInfo for a hit on the opposite side of the specified + * hit's caret. */ public TextHitInfo getVisualOtherHit(TextHitInfo hitInfo) { return caretManager.getVisualOtherHit(hitInfo); } /** - * Justifies the text; this method should be overridden - * by subclasses. + * Justifies the text; this method should be overridden by subclasses. * - * @param justificationWidth the width for justification. + * @param justificationWidth + * the width for justification. */ protected void handleJustify(float justificationWidth) { float justification = breaker.getJustification(); @@ -851,54 +863,54 @@ public final class TextLayout implements Cloneable { } /** - * Returns a TextHitInfo object that gives information on which - * division point (between two characters) is corresponds to a - * hit (such as a mouse click) at the specified coordinates. + * Returns a TextHitInfo object that gives information on which division + * point (between two characters) is corresponds to a hit (such as a mouse + * click) at the specified coordinates. * - * @param x the X coordinate in this TextLayout. - * @param y the Y coordinate in this TextLayout. - * - * TextHitInfo object cooresponding to the given coordinates - * within the text. + * @param x + * the X coordinate in this TextLayout. + * @param y + * the Y coordinate in this TextLayout. TextHitInfo object + * corresponding to the given coordinates within the text. + * @return the information about the character at the specified position. */ public TextHitInfo hitTestChar(float x, float y) { return hitTestChar(x, y, getBounds()); } /** - * Returns a TextHitInfo object that gives information on which - * division point (between two characters) is corresponds to a - * hit (such as a mouse click) at the specified coordinates within - * the specified text rectangle. - * - * @param x the X coordinate in this TextLayout. - * @param y the Y coordinate in this TextLayout. - * @param bounds the bounds of the text area. + * Returns a TextHitInfo object that gives information on which division + * point (between two characters) is corresponds to a hit (such as a mouse + * click) at the specified coordinates within the specified text rectangle. * - * TextHitInfo object cooresponding to the given coordinates - * within the text. + * @param x + * the X coordinate in this TextLayout. + * @param y + * the Y coordinate in this TextLayout. + * @param bounds + * the bounds of the text area. TextHitInfo object corresponding + * to the given coordinates within the text. + * @return the information about the character at the specified position. */ public TextHitInfo hitTestChar(float x, float y, Rectangle2D bounds) { if (x > bounds.getMaxX()) { - return breaker.isLTR() ? - TextHitInfo.trailing(breaker.getCharCount() - 1) : TextHitInfo.leading(0); + return breaker.isLTR() ? TextHitInfo.trailing(breaker.getCharCount() - 1) : TextHitInfo + .leading(0); } if (x < bounds.getMinX()) { - return breaker.isLTR() ? - TextHitInfo.leading(0) : TextHitInfo.trailing(breaker.getCharCount() - 1); + return breaker.isLTR() ? TextHitInfo.leading(0) : TextHitInfo.trailing(breaker + .getCharCount() - 1); } return breaker.hitTest(x, y); } /** - * Returns true if this TextLayout has a "left to right" - * direction. + * Returns true if this TextLayout has a "left to right" direction. * - * @return true if this TextLayout has a "left to right" - * direction, false if this TextLayout has a "right to left" - * direction. + * @return true if this TextLayout has a "left to right" direction, false if + * this TextLayout has a "right to left" direction. */ public boolean isLeftToRight() { return breaker.isLTR(); @@ -913,4 +925,3 @@ public final class TextLayout implements Cloneable { return false; } } - diff --git a/awt/java/awt/font/TextMeasurer.java b/awt/java/awt/font/TextMeasurer.java index 017f3d9c2ea6a..9741f59c40ec2 100644 --- a/awt/java/awt/font/TextMeasurer.java +++ b/awt/java/awt/font/TextMeasurer.java @@ -21,7 +21,6 @@ package java.awt.font; - import java.text.AttributedCharacterIterator; import org.apache.harmony.awt.gl.font.TextMetricsCalculator; @@ -29,26 +28,38 @@ import org.apache.harmony.awt.gl.font.TextRunBreaker; /** * The TextMeasurer class provides utilities for line break operations. + * + * @since Android 1.0 */ public final class TextMeasurer implements Cloneable { - - /** The aci. */ + + /** + * The aci. + */ AttributedCharacterIterator aci; - - /** The frc. */ + + /** + * The frc. + */ FontRenderContext frc; - - /** The breaker. */ + + /** + * The breaker. + */ TextRunBreaker breaker = null; - - /** The tmc. */ + + /** + * The tmc. + */ TextMetricsCalculator tmc = null; /** * Instantiates a new text measurer from the specified text. * - * @param text the source text. - * @param frc the FontRenderContext. + * @param text + * the source text. + * @param frc + * the FontRenderContext. */ public TextMeasurer(AttributedCharacterIterator text, FontRenderContext frc) { this.aci = text; @@ -58,17 +69,19 @@ public final class TextMeasurer implements Cloneable { } /** - * Replaces the current text with the new text, inserting a break - * character at the specified insert position. + * Replaces the current text with the new text, inserting a break character + * at the specified insert position. * - * @param newParagraph the new paragraph text. - * @param insertPos the position in the text where the character is inserted. + * @param newParagraph + * the new paragraph text. + * @param insertPos + * the position in the text where the character is inserted. */ public void insertChar(AttributedCharacterIterator newParagraph, int insertPos) { AttributedCharacterIterator oldAci = aci; aci = newParagraph; - if ((oldAci.getEndIndex() - oldAci.getBeginIndex()) - - (aci.getEndIndex() - aci.getBeginIndex()) != -1) { + if ((oldAci.getEndIndex() - oldAci.getBeginIndex()) + - (aci.getEndIndex() - aci.getBeginIndex()) != -1) { breaker = new TextRunBreaker(aci, this.frc); tmc = new TextMetricsCalculator(breaker); } else { @@ -77,17 +90,19 @@ public final class TextMeasurer implements Cloneable { } /** - * Replaces the current text with the new text and deletes a - * character at the specified position. + * Replaces the current text with the new text and deletes a character at + * the specified position. * - * @param newParagraph the paragraph text after deletion. - * @param deletePos the position in the text where the character is removed. + * @param newParagraph + * the paragraph text after deletion. + * @param deletePos + * the position in the text where the character is removed. */ public void deleteChar(AttributedCharacterIterator newParagraph, int deletePos) { AttributedCharacterIterator oldAci = aci; aci = newParagraph; - if ((oldAci.getEndIndex() - oldAci.getBeginIndex()) - - (aci.getEndIndex() - aci.getBeginIndex()) != 1) { + if ((oldAci.getEndIndex() - oldAci.getBeginIndex()) + - (aci.getEndIndex() - aci.getBeginIndex()) != 1) { breaker = new TextRunBreaker(aci, this.frc); tmc = new TextMetricsCalculator(breaker); } else { @@ -102,39 +117,39 @@ public final class TextMeasurer implements Cloneable { */ @Override protected Object clone() { - return new TextMeasurer((AttributedCharacterIterator) aci.clone(), frc); + return new TextMeasurer((AttributedCharacterIterator)aci.clone(), frc); } /** * Returns a TextLayout of the specified character range. * - * @param start the index of the first character. - * @param limit the index after the last character. - * - * @return a TextLayout for the characters beginning at "start" up - * to "end". + * @param start + * the index of the first character. + * @param limit + * the index after the last character. + * @return a TextLayout for the characters beginning at "start" up to "end". */ public TextLayout getLayout(int start, int limit) { breaker.pushSegments(start - aci.getBeginIndex(), limit - aci.getBeginIndex()); breaker.createAllSegments(); - TextLayout layout = new TextLayout((TextRunBreaker) breaker.clone()); + TextLayout layout = new TextLayout((TextRunBreaker)breaker.clone()); breaker.popSegments(); return layout; } /** - * Returns the graphical width of a line beginning at "start" - * parameter and including characters up to "end" parameter. - * "start" and "end" are absolute indices, not relative to the - * "start" of the paragraph. - * - * @param start the character index at which to start measuring. - * @param end the character index at which to stop measuring. + * Returns the graphical width of a line beginning at "start" parameter and + * including characters up to "end" parameter. "start" and "end" are + * absolute indices, not relative to the "start" of the paragraph. * - * @return the graphical width of a line beginning at "start" - * and including characters up to "end". + * @param start + * the character index at which to start measuring. + * @param end + * the character index at which to stop measuring. + * @return the graphical width of a line beginning at "start" and including + * characters up to "end". */ public float getAdvanceBetween(int start, int end) { breaker.pushSegments(start - aci.getBeginIndex(), end - aci.getBeginIndex()); @@ -147,21 +162,21 @@ public final class TextMeasurer implements Cloneable { } /** - * Returns the index of the first character which is not fit on - * a line beginning at start and possible measuring up to maxAdvance - * in graphical width. - * - * @param start he character index at which to start measuring. - * @param maxAdvance the graphical width in which the line must fit. - * - * @return the index after the last character that is fit on a line - * beginning at start, which is not longer than maxAdvance in graphical + * Returns the index of the first character which is not fit on a line + * beginning at start and possible measuring up to maxAdvance in graphical * width. + * + * @param start + * he character index at which to start measuring. + * @param maxAdvance + * the graphical width in which the line must fit. + * @return the index after the last character that is fit on a line + * beginning at start, which is not longer than maxAdvance in + * graphical width. */ public int getLineBreakIndex(int start, float maxAdvance) { breaker.createAllSegments(); - return breaker.getLineBreakIndex( - start - aci.getBeginIndex(), maxAdvance) + aci.getBeginIndex(); + return breaker.getLineBreakIndex(start - aci.getBeginIndex(), maxAdvance) + + aci.getBeginIndex(); } } - diff --git a/awt/java/awt/font/TransformAttribute.java b/awt/java/awt/font/TransformAttribute.java index 7c9b0bd97a587..ff2caa2511b81 100644 --- a/awt/java/awt/font/TransformAttribute.java +++ b/awt/java/awt/font/TransformAttribute.java @@ -18,6 +18,7 @@ * @author Ilya S. Okomin * @version $Revision$ */ + package java.awt.font; import java.awt.geom.AffineTransform; @@ -28,28 +29,34 @@ import org.apache.harmony.awt.internal.nls.Messages; /** * The TransformAttribute class is a wrapper for the AffineTransform class in * order to use it as attribute. + * + * @since Android 1.0 */ public final class TransformAttribute implements Serializable { - - /** The Constant serialVersionUID. */ + + /** + * The Constant serialVersionUID. + */ private static final long serialVersionUID = 3356247357827709530L; // affine transform of this TransformAttribute instance - /** The transform. */ + /** + * The transform. + */ private AffineTransform fTransform; /** - * Instantiates a new TransformAttribute from the specified - * AffineTransform. + * Instantiates a new TransformAttribute from the specified AffineTransform. * - * @param transform the AffineTransform to be wrapped. + * @param transform + * the AffineTransform to be wrapped. */ public TransformAttribute(AffineTransform transform) { if (transform == null) { // awt.94=transform can not be null throw new IllegalArgumentException(Messages.getString("awt.94")); //$NON-NLS-1$ } - if (!transform.isIdentity()){ + if (!transform.isIdentity()) { this.fTransform = new AffineTransform(transform); } } @@ -60,7 +67,7 @@ public final class TransformAttribute implements Serializable { * @return the initial AffineTransform which is wrapped. */ public AffineTransform getTransform() { - if (fTransform != null){ + if (fTransform != null) { return new AffineTransform(fTransform); } return new AffineTransform(); @@ -69,12 +76,11 @@ public final class TransformAttribute implements Serializable { /** * Checks if this transform is an identity transform. * - * @return true, if this transform is an identity transform, - * false otherwise. + * @return true, if this transform is an identity transform, false + * otherwise. */ public boolean isIdentity() { return (fTransform == null); } } - diff --git a/awt/java/awt/font/package.html b/awt/java/awt/font/package.html new file mode 100644 index 0000000000000..788dcc0a05c5f --- /dev/null +++ b/awt/java/awt/font/package.html @@ -0,0 +1,8 @@ + + +

    + This package contains classes to support the representation of different types of fonts for example TrueType fonts. +

    + @since Android 1.0 + + diff --git a/awt/java/awt/geom/AffineTransform.java b/awt/java/awt/geom/AffineTransform.java index 5fd393430837a..8a6938cf05178 100644 --- a/awt/java/awt/geom/AffineTransform.java +++ b/awt/java/awt/geom/AffineTransform.java @@ -18,6 +18,7 @@ * @author Denis M. Kishenko * @version $Revision$ */ + package java.awt.geom; import java.awt.Shape; @@ -28,76 +29,118 @@ import org.apache.harmony.awt.internal.nls.Messages; import org.apache.harmony.misc.HashCode; /** - * The Class AffineTransform represents a linear transformation - * (rotation, scaling, or shear) followed by a translation that - * acts on a coordinate space. It preserves colinearity of points - * and ratios of distances between collinear points: so if A, B, - * and C are on a line, then after the space has been transformed - * via the affine transform, the images of the three points will - * still be on a line, and the ratio of the distance from A to B - * with the distance from B to C will be the same as the corresponding - * ratio in the image space. + * The Class AffineTransform represents a linear transformation (rotation, + * scaling, or shear) followed by a translation that acts on a coordinate space. + * It preserves collinearity of points and ratios of distances between collinear + * points: so if A, B, and C are on a line, then after the space has been + * transformed via the affine transform, the images of the three points will + * still be on a line, and the ratio of the distance from A to B with the + * distance from B to C will be the same as the corresponding ratio in the image + * space. + * + * @since Android 1.0 */ public class AffineTransform implements Cloneable, Serializable { - /** The Constant serialVersionUID. */ + /** + * The Constant serialVersionUID. + */ private static final long serialVersionUID = 1330973210523860834L; - /** The Constant TYPE_IDENTITY. */ + /** + * The Constant TYPE_IDENTITY. + */ public static final int TYPE_IDENTITY = 0; - - /** The Constant TYPE_TRANSLATION. */ + + /** + * The Constant TYPE_TRANSLATION. + */ public static final int TYPE_TRANSLATION = 1; - - /** The Constant TYPE_UNIFORM_SCALE. */ + + /** + * The Constant TYPE_UNIFORM_SCALE. + */ public static final int TYPE_UNIFORM_SCALE = 2; - - /** The Constant TYPE_GENERAL_SCALE. */ + + /** + * The Constant TYPE_GENERAL_SCALE. + */ public static final int TYPE_GENERAL_SCALE = 4; - - /** The Constant TYPE_QUADRANT_ROTATION. */ + + /** + * The Constant TYPE_QUADRANT_ROTATION. + */ public static final int TYPE_QUADRANT_ROTATION = 8; - - /** The Constant TYPE_GENERAL_ROTATION. */ + + /** + * The Constant TYPE_GENERAL_ROTATION. + */ public static final int TYPE_GENERAL_ROTATION = 16; - - /** The Constant TYPE_GENERAL_TRANSFORM. */ + + /** + * The Constant TYPE_GENERAL_TRANSFORM. + */ public static final int TYPE_GENERAL_TRANSFORM = 32; - - /** The Constant TYPE_FLIP. */ + + /** + * The Constant TYPE_FLIP. + */ public static final int TYPE_FLIP = 64; - - /** The Constant TYPE_MASK_SCALE. */ + + /** + * The Constant TYPE_MASK_SCALE. + */ public static final int TYPE_MASK_SCALE = TYPE_UNIFORM_SCALE | TYPE_GENERAL_SCALE; - - /** The Constant TYPE_MASK_ROTATION. */ + + /** + * The Constant TYPE_MASK_ROTATION. + */ public static final int TYPE_MASK_ROTATION = TYPE_QUADRANT_ROTATION | TYPE_GENERAL_ROTATION; - /** The TYPE_UNKNOWN is an initial type value. */ + /** + * The TYPE_UNKNOWN is an initial type value. + */ static final int TYPE_UNKNOWN = -1; - - /** The min value equivalent to zero. If absolute value less then ZERO it considered as zero. */ + + /** + * The min value equivalent to zero. If absolute value less then ZERO it + * considered as zero. + */ static final double ZERO = 1E-10; - - /** The values of transformation matrix. */ + + /** + * The values of transformation matrix. + */ double m00; - - /** The m10. */ + + /** + * The m10. + */ double m10; - - /** The m01. */ + + /** + * The m01. + */ double m01; - - /** The m11. */ + + /** + * The m11. + */ double m11; - - /** The m02. */ + + /** + * The m02. + */ double m02; - - /** The m12. */ + + /** + * The m12. + */ double m12; - /** The transformation type. */ + /** + * The transformation type. + */ transient int type; /** @@ -111,10 +154,11 @@ public class AffineTransform implements Cloneable, Serializable { } /** - * Instantiates a new affine transform that has the same data as - * the given AffineTransform. + * Instantiates a new affine transform that has the same data as the given + * AffineTransform. * - * @param t the transform to copy. + * @param t + * the transform to copy. */ public AffineTransform(AffineTransform t) { this.type = t.type; @@ -128,15 +172,21 @@ public class AffineTransform implements Cloneable, Serializable { /** * Instantiates a new affine transform by specifying the values of the 2x3 - * transformation matrix as floats. The type is set to the default - * type: TYPE_UNKNOWN - * - * @param m00 the m00 entry in the transformation matrix. - * @param m10 the m10 entry in the transformation matrix. - * @param m01 the m01 entry in the transformation matrix. - * @param m11 the m11 entry in the transformation matrix. - * @param m02 the m02 entry in the transformation matrix. - * @param m12 the m12 entry in the transformation matrix. + * transformation matrix as floats. The type is set to the default type: + * TYPE_UNKNOWN + * + * @param m00 + * the m00 entry in the transformation matrix. + * @param m10 + * the m10 entry in the transformation matrix. + * @param m01 + * the m01 entry in the transformation matrix. + * @param m11 + * the m11 entry in the transformation matrix. + * @param m02 + * the m02 entry in the transformation matrix. + * @param m12 + * the m12 entry in the transformation matrix. */ public AffineTransform(float m00, float m10, float m01, float m11, float m02, float m12) { this.type = TYPE_UNKNOWN; @@ -150,15 +200,21 @@ public class AffineTransform implements Cloneable, Serializable { /** * Instantiates a new affine transform by specifying the values of the 2x3 - * transformation matrix as doubles. The type is set to the default - * type: TYPE_UNKNOWN - * - * @param m00 the m00 entry in the transformation matrix. - * @param m10 the m10 entry in the transformation matrix. - * @param m01 the m01 entry in the transformation matrix. - * @param m11 the m11 entry in the transformation matrix. - * @param m02 the m02 entry in the transformation matrix. - * @param m12 the m12 entry in the transformation matrix. + * transformation matrix as doubles. The type is set to the default type: + * TYPE_UNKNOWN + * + * @param m00 + * the m00 entry in the transformation matrix. + * @param m10 + * the m10 entry in the transformation matrix. + * @param m01 + * the m01 entry in the transformation matrix. + * @param m11 + * the m11 entry in the transformation matrix. + * @param m02 + * the m02 entry in the transformation matrix. + * @param m12 + * the m12 entry in the transformation matrix. */ public AffineTransform(double m00, double m10, double m01, double m11, double m02, double m12) { this.type = TYPE_UNKNOWN; @@ -171,20 +227,20 @@ public class AffineTransform implements Cloneable, Serializable { } /** - * Instantiates a new affine transform by reading the values of the - * transformation matrix from an array of floats. The mapping from the - * array to the matrix starts with matrix[0] giving the - * top-left entry of the matrix and - * proceeds with the usual left-to-right and top-down ordering. + * Instantiates a new affine transform by reading the values of the + * transformation matrix from an array of floats. The mapping from the array + * to the matrix starts with matrix[0] giving the top-left + * entry of the matrix and proceeds with the usual left-to-right and + * top-down ordering. *

    - * If the array has only four entries, then the two entries of the - * last row of the transformation matrix default to zero. - * - * @param matrix the array of four or six floats giving the values - * of the matrix. - * - * @throws ArrayIndexOutOfBoundsException if the size of the array - * is 0, 1, 2, 3, or 5. + * If the array has only four entries, then the two entries of the last row + * of the transformation matrix default to zero. + * + * @param matrix + * the array of four or six floats giving the values of the + * matrix. + * @throws ArrayIndexOutOfBoundsException + * if the size of the array is 0, 1, 2, 3, or 5. */ public AffineTransform(float[] matrix) { this.type = TYPE_UNKNOWN; @@ -199,20 +255,20 @@ public class AffineTransform implements Cloneable, Serializable { } /** - * Instantiates a new affine transform by reading the values of the + * Instantiates a new affine transform by reading the values of the * transformation matrix from an array of doubles. The mapping from the - * array to the matrix starts with matrix[0] giving the - * top-left entry of the matrix and - * proceeds with the usual left-to-right and top-down ordering. + * array to the matrix starts with matrix[0] giving the + * top-left entry of the matrix and proceeds with the usual left-to-right + * and top-down ordering. *

    - * If the array has only four entries, then the two entries of the - * last row of the transformation matrix default to zero. - * - * @param matrix the array of four or six doubles giving the values - * of the matrix. - * - * @throws ArrayIndexOutOfBoundsException if the size of the array - * is 0, 1, 2, 3, or 5. + * If the array has only four entries, then the two entries of the last row + * of the transformation matrix default to zero. + * + * @param matrix + * the array of four or six doubles giving the values of the + * matrix. + * @throws ArrayIndexOutOfBoundsException + * if the size of the array is 0, 1, 2, 3, or 5. */ public AffineTransform(double[] matrix) { this.type = TYPE_UNKNOWN; @@ -226,27 +282,26 @@ public class AffineTransform implements Cloneable, Serializable { } } - /** * Returns type of the affine transformation. *

    - * The type is computed as follows: Label the entries of the - * transformation matrix as three rows (m00, m01), (m10, m11), and - * (m02, m12). Then if the original basis vectors are (1, 0) and (0, 1), - * the new basis vectors after transformation are given by (m00, m01) - * and (m10, m11), and the translation vector is (m02, m12). + * The type is computed as follows: Label the entries of the transformation + * matrix as three rows (m00, m01), (m10, m11), and (m02, m12). Then if the + * original basis vectors are (1, 0) and (0, 1), the new basis vectors after + * transformation are given by (m00, m01) and (m10, m11), and the + * translation vector is (m02, m12). + *

    + * The types are classified as follows:
    TYPE_IDENTITY - no change
    + * TYPE_TRANSLATION - The translation vector isn't zero
    + * TYPE_UNIFORM_SCALE - The new basis vectors have equal length
    + * TYPE_GENERAL_SCALE - The new basis vectors dont' have equal length
    + * TYPE_FLIP - The new basis vector orientation differs from the original + * one
    TYPE_QUADRANT_ROTATION - The new basis is a rotation of the + * original by 90, 180, 270, or 360 degrees
    TYPE_GENERAL_ROTATION - The + * new basis is a rotation of the original by an arbitrary angle
    + * TYPE_GENERAL_TRANSFORM - The transformation can't be inverted.
    *

    - * The types are classified as follows:
    - * TYPE_IDENTITY - no change
    - * TYPE_TRANSLATION - The translation vector isn't zero
    - * TYPE_UNIFORM_SCALE - The new basis vectors have equal length
    - * TYPE_GENERAL_SCALE - The new basis vectors dont' have equal length
    - * TYPE_FLIP - The new basis vector orientation differs from the original one
    - * TYPE_QUADRANT_ROTATION - The new basis is a rotation of the original by 90, 180, 270, or 360 degrees
    - * TYPE_GENERAL_ROTATION - The new basis is a rotation of the original by an arbitrary angle
    - * TYPE_GENERAL_TRANSFORM - The transformation can't be inverted.
    - *

    - * Note that multiple types are possible, thus the types can be combined + * Note that multiple types are possible, thus the types can be combined * using bitwise combinations. * * @return the type of the Affine Transform. @@ -265,11 +320,10 @@ public class AffineTransform implements Cloneable, Serializable { if (m02 != 0.0 || m12 != 0.0) { type |= TYPE_TRANSLATION; - } else - if (m00 == 1.0 && m11 == 1.0 && m01 == 0.0 && m10 == 0.0) { - type = TYPE_IDENTITY; - return type; - } + } else if (m00 == 1.0 && m11 == 1.0 && m01 == 0.0 && m10 == 0.0) { + type = TYPE_IDENTITY; + return type; + } if (m00 * m11 - m01 * m10 < 0.0) { type |= TYPE_FLIP; @@ -279,26 +333,22 @@ public class AffineTransform implements Cloneable, Serializable { double dy = m01 * m01 + m11 * m11; if (dx != dy) { type |= TYPE_GENERAL_SCALE; - } else - if (dx != 1.0) { - type |= TYPE_UNIFORM_SCALE; - } + } else if (dx != 1.0) { + type |= TYPE_UNIFORM_SCALE; + } - if ((m00 == 0.0 && m11 == 0.0) || - (m10 == 0.0 && m01 == 0.0 && (m00 < 0.0 || m11 < 0.0))) - { + if ((m00 == 0.0 && m11 == 0.0) || (m10 == 0.0 && m01 == 0.0 && (m00 < 0.0 || m11 < 0.0))) { type |= TYPE_QUADRANT_ROTATION; - } else - if (m01 != 0.0 || m10 != 0.0) { - type |= TYPE_GENERAL_ROTATION; - } + } else if (m01 != 0.0 || m10 != 0.0) { + type |= TYPE_GENERAL_ROTATION; + } return type; } /** - * Gets the scale x entry of the transformation matrix - * (the upper left matrix entry). + * Gets the scale x entry of the transformation matrix (the upper left + * matrix entry). * * @return the scale x value. */ @@ -307,8 +357,8 @@ public class AffineTransform implements Cloneable, Serializable { } /** - * Gets the scale y entry of the transformation matrix - * (the lower right entry of the linear transformation). + * Gets the scale y entry of the transformation matrix (the lower right + * entry of the linear transformation). * * @return the scale y value. */ @@ -317,8 +367,8 @@ public class AffineTransform implements Cloneable, Serializable { } /** - * Gets the shear x entry of the transformation matrix - * (the upper right entry of the linear transformation). + * Gets the shear x entry of the transformation matrix (the upper right + * entry of the linear transformation). * * @return the shear x value. */ @@ -327,8 +377,8 @@ public class AffineTransform implements Cloneable, Serializable { } /** - * Gets the shear y entry of the transformation matrix - * (the lower left entry of the linear transformation). + * Gets the shear y entry of the transformation matrix (the lower left entry + * of the linear transformation). * * @return the shear y value. */ @@ -364,15 +414,15 @@ public class AffineTransform implements Cloneable, Serializable { } /** - * Writes the values of the transformation matrix into the given - * array of doubles. If the array has length 4, only the linear - * transformation part will be written into it. If it has length - * greater than 4, the translation vector will be included as well. - * - * @param matrix the array to fill with the values of the matrix. - * - * @throws ArrayIndexOutOfBoundsException if the size of the array - * is 0, 1, 2, 3, or 5. + * Writes the values of the transformation matrix into the given array of + * doubles. If the array has length 4, only the linear transformation part + * will be written into it. If it has length greater than 4, the translation + * vector will be included as well. + * + * @param matrix + * the array to fill with the values of the matrix. + * @throws ArrayIndexOutOfBoundsException + * if the size of the array is 0, 1, 2, 3, or 5. */ public void getMatrix(double[] matrix) { matrix[0] = m00; @@ -397,12 +447,18 @@ public class AffineTransform implements Cloneable, Serializable { /** * Sets the transform in terms of a list of double values. * - * @param m00 the m00 coordinate of the transformation matrix. - * @param m10 the m10 coordinate of the transformation matrix. - * @param m01 the m01 coordinate of the transformation matrix. - * @param m11 the m11 coordinate of the transformation matrix. - * @param m02 the m02 coordinate of the transformation matrix. - * @param m12 the m12 coordinate of the transformation matrix. + * @param m00 + * the m00 coordinate of the transformation matrix. + * @param m10 + * the m10 coordinate of the transformation matrix. + * @param m01 + * the m01 coordinate of the transformation matrix. + * @param m11 + * the m11 coordinate of the transformation matrix. + * @param m02 + * the m02 coordinate of the transformation matrix. + * @param m12 + * the m12 coordinate of the transformation matrix. */ public void setTransform(double m00, double m10, double m01, double m11, double m02, double m12) { this.type = TYPE_UNKNOWN; @@ -415,10 +471,11 @@ public class AffineTransform implements Cloneable, Serializable { } /** - * Sets the transform's data to match the data of the transform - * sent as a parameter. + * Sets the transform's data to match the data of the transform sent as a + * parameter. * - * @param t the transform that gives the new values. + * @param t + * the transform that gives the new values. */ public void setTransform(AffineTransform t) { type = t.type; @@ -435,15 +492,16 @@ public class AffineTransform implements Cloneable, Serializable { } /** - * Sets the transformation to a translation alone. - * Sets the linear part of the transformation to identity - * and the translation vector to the values sent as parameters. - * Sets the type to TYPE_IDENTITY - * if the resulting AffineTransformation is the identity - * transformation, otherwise sets it to TYPE_TRANSLATION. - * - * @param mx the distance to translate in the x direction. - * @param my the distance to translate in the y direction. + * Sets the transformation to a translation alone. Sets the linear part of + * the transformation to identity and the translation vector to the values + * sent as parameters. Sets the type to TYPE_IDENTITY if the + * resulting AffineTransformation is the identity transformation, otherwise + * sets it to TYPE_TRANSLATION. + * + * @param mx + * the distance to translate in the x direction. + * @param my + * the distance to translate in the y direction. */ public void setToTranslation(double mx, double my) { m00 = m11 = 1.0; @@ -458,14 +516,15 @@ public class AffineTransform implements Cloneable, Serializable { } /** - * Sets the transformation to being a scale alone, eliminating - * rotation, shear, and translation elements. - * Sets the type to TYPE_IDENTITY - * if the resulting AffineTransformation is the identity - * transformation, otherwise sets it to TYPE_UNKNOWN. - * - * @param scx the scaling factor in the x direction. - * @param scy the scaling factor in the y direction. + * Sets the transformation to being a scale alone, eliminating rotation, + * shear, and translation elements. Sets the type to + * TYPE_IDENTITY if the resulting AffineTransformation is the + * identity transformation, otherwise sets it to TYPE_UNKNOWN. + * + * @param scx + * the scaling factor in the x direction. + * @param scy + * the scaling factor in the y direction. */ public void setToScale(double scx, double scy) { m00 = scx; @@ -479,14 +538,15 @@ public class AffineTransform implements Cloneable, Serializable { } /** - * Sets the transformation to being a shear alone, eliminating - * rotation, scaling, and translation elements. - * Sets the type to TYPE_IDENTITY - * if the resulting AffineTransformation is the identity - * transformation, otherwise sets it to TYPE_UNKNOWN. - * - * @param shx the shearing factor in the x direction. - * @param shy the shearing factor in the y direction. + * Sets the transformation to being a shear alone, eliminating rotation, + * scaling, and translation elements. Sets the type to + * TYPE_IDENTITY if the resulting AffineTransformation is the + * identity transformation, otherwise sets it to TYPE_UNKNOWN. + * + * @param shx + * the shearing factor in the x direction. + * @param shy + * the shearing factor in the y direction. */ public void setToShear(double shx, double shy) { m00 = m11 = 1.0; @@ -501,13 +561,13 @@ public class AffineTransform implements Cloneable, Serializable { } /** - * Sets the transformation to being a rotation alone, eliminating - * shearing, scaling, and translation elements. - * Sets the type to TYPE_IDENTITY - * if the resulting AffineTransformation is the identity - * transformation, otherwise sets it to TYPE_UNKNOWN. + * Sets the transformation to being a rotation alone, eliminating shearing, + * scaling, and translation elements. Sets the type to + * TYPE_IDENTITY if the resulting AffineTransformation is the + * identity transformation, otherwise sets it to TYPE_UNKNOWN. * - * @param angle the angle of rotation in radians. + * @param angle + * the angle of rotation in radians. */ public void setToRotation(double angle) { double sin = Math.sin(angle); @@ -515,11 +575,10 @@ public class AffineTransform implements Cloneable, Serializable { if (Math.abs(cos) < ZERO) { cos = 0.0; sin = sin > 0.0 ? 1.0 : -1.0; - } else - if (Math.abs(sin) < ZERO) { - sin = 0.0; - cos = cos > 0.0 ? 1.0 : -1.0; - } + } else if (Math.abs(sin) < ZERO) { + sin = 0.0; + cos = cos > 0.0 ? 1.0 : -1.0; + } m00 = m11 = cos; m01 = -sin; m10 = sin; @@ -528,13 +587,15 @@ public class AffineTransform implements Cloneable, Serializable { } /** - * Sets the transformation to being a rotation followed by a - * translation. + * Sets the transformation to being a rotation followed by a translation. * Sets the type to TYPE_UNKNOWN. * - * @param angle the angle of rotation in radians. - * @param px the distance to translate in the x direction. - * @param py the distance to translate in the y direction. + * @param angle + * the angle of rotation in radians. + * @param px + * the distance to translate in the x direction. + * @param py + * the distance to translate in the y direction. */ public void setToRotation(double angle, double px, double py) { setToRotation(angle); @@ -544,15 +605,16 @@ public class AffineTransform implements Cloneable, Serializable { } /** - * Creates a new AffineTransformation that is a translation alone - * with the translation vector given by the values sent as parameters. - * The new transformation's type is TYPE_IDENTITY - * if the AffineTransformation is the identity - * transformation, otherwise it's TYPE_TRANSLATION. - * - * @param mx the distance to translate in the x direction. - * @param my the distance to translate in the y direction. - + * Creates a new AffineTransformation that is a translation alone with the + * translation vector given by the values sent as parameters. The new + * transformation's type is TYPE_IDENTITY if the + * AffineTransformation is the identity transformation, otherwise it's + * TYPE_TRANSLATION. + * + * @param mx + * the distance to translate in the x direction. + * @param my + * the distance to translate in the y direction. * @return the new AffineTransformation. */ public static AffineTransform getTranslateInstance(double mx, double my) { @@ -562,14 +624,15 @@ public class AffineTransform implements Cloneable, Serializable { } /** - * Creates a new AffineTransformation that is a scale alone. - * The new transformation's type is TYPE_IDENTITY - * if the AffineTransformation is the identity - * transformation, otherwise it's TYPE_UNKNOWN. - * - * @param scx the scaling factor in the x direction. - * @param scY the scaling factor in the y direction. - * + * Creates a new AffineTransformation that is a scale alone. The new + * transformation's type is TYPE_IDENTITY if the + * AffineTransformation is the identity transformation, otherwise it's + * TYPE_UNKNOWN. + * + * @param scx + * the scaling factor in the x direction. + * @param scY + * the scaling factor in the y direction. * @return the new AffineTransformation. */ public static AffineTransform getScaleInstance(double scx, double scY) { @@ -579,14 +642,15 @@ public class AffineTransform implements Cloneable, Serializable { } /** - * Creates a new AffineTransformation that is a shear alone. - * The new transformation's type is TYPE_IDENTITY - * if the AffineTransformation is the identity - * transformation, otherwise it's TYPE_UNKNOWN. - * - * @param shx the shearing factor in the x direction. - * @param shy the shearing factor in the y direction. - * + * Creates a new AffineTransformation that is a shear alone. The new + * transformation's type is TYPE_IDENTITY if the + * AffineTransformation is the identity transformation, otherwise it's + * TYPE_UNKNOWN. + * + * @param shx + * the shearing factor in the x direction. + * @param shy + * the shearing factor in the y direction. * @return the new AffineTransformation. */ public static AffineTransform getShearInstance(double shx, double shy) { @@ -596,13 +660,13 @@ public class AffineTransform implements Cloneable, Serializable { } /** - * Creates a new AffineTransformation that is a rotation alone. - * The new transformation's type is TYPE_IDENTITY - * if the AffineTransformation is the identity - * transformation, otherwise it's TYPE_UNKNOWN. - * - * @param angle the angle of rotation in radians. + * Creates a new AffineTransformation that is a rotation alone. The new + * transformation's type is TYPE_IDENTITY if the + * AffineTransformation is the identity transformation, otherwise it's + * TYPE_UNKNOWN. * + * @param angle + * the angle of rotation in radians. * @return the new AffineTransformation. */ public static AffineTransform getRotateInstance(double angle) { @@ -612,14 +676,15 @@ public class AffineTransform implements Cloneable, Serializable { } /** - * Creates a new AffineTransformation that is a rotation followed by a - * translation. - * Sets the type to TYPE_UNKNOWN. - * - * @param angle the angle of rotation in radians. - * @param x the distance to translate in the x direction. - * @param y the distance to translate in the y direction. - * + * Creates a new AffineTransformation that is a rotation followed by a + * translation. Sets the type to TYPE_UNKNOWN. + * + * @param angle + * the angle of rotation in radians. + * @param x + * the distance to translate in the x direction. + * @param y + * the distance to translate in the y direction. * @return the new AffineTransformation. */ public static AffineTransform getRotateInstance(double angle, double x, double y) { @@ -631,8 +696,10 @@ public class AffineTransform implements Cloneable, Serializable { /** * Applies a translation to this AffineTransformation. * - * @param mx the distance to translate in the x direction. - * @param my the distance to translate in the y direction. + * @param mx + * the distance to translate in the x direction. + * @param my + * the distance to translate in the y direction. */ public void translate(double mx, double my) { concatenate(AffineTransform.getTranslateInstance(mx, my)); @@ -641,8 +708,10 @@ public class AffineTransform implements Cloneable, Serializable { /** * Applies a scaling transformation to this AffineTransformation. * - * @param scx the scaling factor in the x direction. - * @param scy the scaling factor in the y direction. + * @param scx + * the scaling factor in the x direction. + * @param scy + * the scaling factor in the y direction. */ public void scale(double scx, double scy) { concatenate(AffineTransform.getScaleInstance(scx, scy)); @@ -651,8 +720,10 @@ public class AffineTransform implements Cloneable, Serializable { /** * Applies a shearing transformation to this AffineTransformation. * - * @param shx the shearing factor in the x direction. - * @param shy the shearing factor in the y direction. + * @param shx + * the shearing factor in the x direction. + * @param shy + * the shearing factor in the y direction. */ public void shear(double shx, double shy) { concatenate(AffineTransform.getShearInstance(shx, shy)); @@ -661,19 +732,23 @@ public class AffineTransform implements Cloneable, Serializable { /** * Applies a rotation transformation to this AffineTransformation. * - * @param angle the angle of rotation in radians. + * @param angle + * the angle of rotation in radians. */ public void rotate(double angle) { concatenate(AffineTransform.getRotateInstance(angle)); } /** - * Applies a rotation and translation transformation to this + * Applies a rotation and translation transformation to this * AffineTransformation. * - * @param angle the angle of rotation in radians. - * @param px the distance to translate in the x direction. - * @param py the distance to translate in the y direction. + * @param angle + * the angle of rotation in radians. + * @param px + * the distance to translate in the x direction. + * @param py + * the distance to translate in the y direction. */ public void rotate(double angle, double px, double py) { concatenate(AffineTransform.getRotateInstance(angle, px, py)); @@ -682,36 +757,40 @@ public class AffineTransform implements Cloneable, Serializable { /** * Multiplies the matrix representations of two AffineTransform objects. * - * @param t1 - the AffineTransform object is a multiplicand - * @param t2 - the AffineTransform object is a multiplier - * - * @return an AffineTransform object that is the result of t1 multiplied by the matrix t2. + * @param t1 + * - the AffineTransform object is a multiplicand + * @param t2 + * - the AffineTransform object is a multiplier + * @return an AffineTransform object that is the result of t1 multiplied by + * the matrix t2. */ AffineTransform multiply(AffineTransform t1, AffineTransform t2) { - return new AffineTransform( - t1.m00 * t2.m00 + t1.m10 * t2.m01, // m00 - t1.m00 * t2.m10 + t1.m10 * t2.m11, // m01 - t1.m01 * t2.m00 + t1.m11 * t2.m01, // m10 - t1.m01 * t2.m10 + t1.m11 * t2.m11, // m11 + return new AffineTransform(t1.m00 * t2.m00 + t1.m10 * t2.m01, // m00 + t1.m00 * t2.m10 + t1.m10 * t2.m11, // m01 + t1.m01 * t2.m00 + t1.m11 * t2.m01, // m10 + t1.m01 * t2.m10 + t1.m11 * t2.m11, // m11 t1.m02 * t2.m00 + t1.m12 * t2.m01 + t2.m02, // m02 t1.m02 * t2.m10 + t1.m12 * t2.m11 + t2.m12);// m12 } /** - * Applies the given AffineTransform to this AffineTransform - * via matrix multiplication. + * Applies the given AffineTransform to this AffineTransform via matrix + * multiplication. * - * @param t the AffineTransform to apply to this AffineTransform. + * @param t + * the AffineTransform to apply to this AffineTransform. */ public void concatenate(AffineTransform t) { setTransform(multiply(t, this)); } /** - * Changes the current AffineTransform the one obtained by - * taking the transform t and applying this AffineTransform to it. + * Changes the current AffineTransform the one obtained by taking the + * transform t and applying this AffineTransform to it. * - * @param t the AffineTransform that this AffineTransform is multiplied by. + * @param t + * the AffineTransform that this AffineTransform is multiplied + * by. */ public void preConcatenate(AffineTransform t) { setTransform(multiply(this, t)); @@ -721,9 +800,9 @@ public class AffineTransform implements Cloneable, Serializable { * Creates an AffineTransform that is the inverse of this transform. * * @return the affine transform that is the inverse of this AffineTransform. - * - * @throws NoninvertibleTransformException if this AffineTransform cannot be - * inverted (the determinant of the linear transformation part is zero). + * @throws NoninvertibleTransformException + * if this AffineTransform cannot be inverted (the determinant + * of the linear transformation part is zero). */ public AffineTransform createInverse() throws NoninvertibleTransformException { double det = getDeterminant(); @@ -731,25 +810,26 @@ public class AffineTransform implements Cloneable, Serializable { // awt.204=Determinant is zero throw new NoninvertibleTransformException(Messages.getString("awt.204")); //$NON-NLS-1$ } - return new AffineTransform( - m11 / det, // m00 + return new AffineTransform(m11 / det, // m00 -m10 / det, // m10 -m01 / det, // m01 - m00 / det, // m11 + m00 / det, // m11 (m01 * m12 - m11 * m02) / det, // m02 - (m10 * m02 - m00 * m12) / det // m12 + (m10 * m02 - m00 * m12) / det // m12 ); } /** * Apply the current AffineTransform to the point. * - * @param src the original point. - * @param dst Point2D object to be filled with the destination - * coordinates (where the original point is sent by this AffineTransform). May be null. - * - * @return the point in the AffineTransform's image space where the - * original point is sent. + * @param src + * the original point. + * @param dst + * Point2D object to be filled with the destination coordinates + * (where the original point is sent by this AffineTransform). + * May be null. + * @return the point in the AffineTransform's image space where the original + * point is sent. */ public Point2D transform(Point2D src, Point2D dst) { if (dst == null) { @@ -770,25 +850,29 @@ public class AffineTransform implements Cloneable, Serializable { /** * Applies this AffineTransform to an array of points. * - * @param src the array of points to be transformed. - * @param srcOff the offset in the source point array of the first point - * to be transformed. - * @param dst the point array where the images of the points (after - * applying the AffineTransformation) should be placed. - * @param dstOff the offset in the destination array where the new - * values should be written. - * @param length the number of points to transform. - * - * @throws ArrayIndexOutOfBoundsException if - * srcOff + length > src.length or - * dstOff + length > dst.length. + * @param src + * the array of points to be transformed. + * @param srcOff + * the offset in the source point array of the first point to be + * transformed. + * @param dst + * the point array where the images of the points (after applying + * the AffineTransformation) should be placed. + * @param dstOff + * the offset in the destination array where the new values + * should be written. + * @param length + * the number of points to transform. + * @throws ArrayIndexOutOfBoundsException + * if srcOff + length > src.length or + * dstOff + length > dst.length. */ public void transform(Point2D[] src, int srcOff, Point2D[] dst, int dstOff, int length) { while (--length >= 0) { - Point2D srcPoint = src[srcOff++]; + Point2D srcPoint = src[srcOff++]; double x = srcPoint.getX(); double y = srcPoint.getY(); - Point2D dstPoint = dst[dstOff]; + Point2D dstPoint = dst[dstOff]; if (dstPoint == null) { if (srcPoint instanceof Point2D.Double) { dstPoint = new Point2D.Double(); @@ -800,27 +884,31 @@ public class AffineTransform implements Cloneable, Serializable { dst[dstOff++] = dstPoint; } } - + /** - * Applies this AffineTransform to a set of points given - * as an array of double values where every two values in the array - * give the coordinates of a point; the even-indexed values giving the - * x coordinates and the odd-indexed values giving the y coordinates. - * - * @param src the array of points to be transformed. - * @param srcOff the offset in the source point array of the first point - * to be transformed. - * @param dst the point array where the images of the points (after - * applying the AffineTransformation) should be placed. - * @param dstOff the offset in the destination array where the new - * values should be written. - * @param length the number of points to transform. - * - * @throws ArrayIndexOutOfBoundsException if - * srcOff + length*2 > src.length or - * dstOff + length*2 > dst.length. + * Applies this AffineTransform to a set of points given as an array of + * double values where every two values in the array give the coordinates of + * a point; the even-indexed values giving the x coordinates and the + * odd-indexed values giving the y coordinates. + * + * @param src + * the array of points to be transformed. + * @param srcOff + * the offset in the source point array of the first point to be + * transformed. + * @param dst + * the point array where the images of the points (after applying + * the AffineTransformation) should be placed. + * @param dstOff + * the offset in the destination array where the new values + * should be written. + * @param length + * the number of points to transform. + * @throws ArrayIndexOutOfBoundsException + * if srcOff + length*2 > src.length or + * dstOff + length*2 > dst.length. */ - public void transform(double[] src, int srcOff, double[] dst, int dstOff, int length) { + public void transform(double[] src, int srcOff, double[] dst, int dstOff, int length) { int step = 2; if (src == dst && srcOff < dstOff && dstOff < srcOff + length * 2) { srcOff = srcOff + length * 2 - 2; @@ -838,23 +926,27 @@ public class AffineTransform implements Cloneable, Serializable { } /** - * Applies this AffineTransform to a set of points given - * as an array of float values where every two values in the array - * give the coordinates of a point; the even-indexed values giving the - * x coordinates and the odd-indexed values giving the y coordinates. - * - * @param src the array of points to be transformed. - * @param srcOff the offset in the source point array of the first point - * to be transformed. - * @param dst the point array where the images of the points (after - * applying the AffineTransformation) should be placed. - * @param dstOff the offset in the destination array where the new - * values should be written. - * @param length the number of points to transform. - * - * @throws ArrayIndexOutOfBoundsException if - * srcOff + length*2 > src.length or - * dstOff + length*2 > dst.length. + * Applies this AffineTransform to a set of points given as an array of + * float values where every two values in the array give the coordinates of + * a point; the even-indexed values giving the x coordinates and the + * odd-indexed values giving the y coordinates. + * + * @param src + * the array of points to be transformed. + * @param srcOff + * the offset in the source point array of the first point to be + * transformed. + * @param dst + * the point array where the images of the points (after applying + * the AffineTransformation) should be placed. + * @param dstOff + * the offset in the destination array where the new values + * should be written. + * @param length + * the number of points to transform. + * @throws ArrayIndexOutOfBoundsException + * if srcOff + length*2 > src.length or + * dstOff + length*2 > dst.length. */ public void transform(float[] src, int srcOff, float[] dst, int dstOff, int length) { int step = 2; @@ -872,26 +964,30 @@ public class AffineTransform implements Cloneable, Serializable { dstOff += step; } } - + /** - * Applies this AffineTransform to a set of points given - * as an array of float values where every two values in the array - * give the coordinates of a point; the even-indexed values giving the - * x coordinates and the odd-indexed values giving the y coordinates. - * The destination coordinates are given as values of type double. - * - * @param src the array of points to be transformed. - * @param srcOff the offset in the source point array of the first point - * to be transformed. - * @param dst the point array where the images of the points (after - * applying the AffineTransformation) should be placed. - * @param dstOff the offset in the destination array where the new - * values should be written. - * @param length the number of points to transform. - * - * @throws ArrayIndexOutOfBoundsException if - * srcOff + length*2 > src.length or - * dstOff + length*2 > dst.length. + * Applies this AffineTransform to a set of points given as an array of + * float values where every two values in the array give the coordinates of + * a point; the even-indexed values giving the x coordinates and the + * odd-indexed values giving the y coordinates. The destination coordinates + * are given as values of type double. + * + * @param src + * the array of points to be transformed. + * @param srcOff + * the offset in the source point array of the first point to be + * transformed. + * @param dst + * the point array where the images of the points (after applying + * the AffineTransformation) should be placed. + * @param dstOff + * the offset in the destination array where the new values + * should be written. + * @param length + * the number of points to transform. + * @throws ArrayIndexOutOfBoundsException + * if srcOff + length*2 > src.length or + * dstOff + length*2 > dst.length. */ public void transform(float[] src, int srcOff, double[] dst, int dstOff, int length) { while (--length >= 0) { @@ -903,24 +999,28 @@ public class AffineTransform implements Cloneable, Serializable { } /** - * Applies this AffineTransform to a set of points given - * as an array of double values where every two values in the array - * give the coordinates of a point; the even-indexed values giving the - * x coordinates and the odd-indexed values giving the y coordinates. - * The destination coordinates are given as values of type float. - * - * @param src the array of points to be transformed. - * @param srcOff the offset in the source point array of the first point - * to be transformed. - * @param dst the point array where the images of the points (after - * applying the AffineTransformation) should be placed. - * @param dstOff the offset in the destination array where the new - * values should be written. - * @param length the number of points to transform. - * - * @throws ArrayIndexOutOfBoundsException if - * srcOff + length*2 > src.length or - * dstOff + length*2 > dst.length. + * Applies this AffineTransform to a set of points given as an array of + * double values where every two values in the array give the coordinates of + * a point; the even-indexed values giving the x coordinates and the + * odd-indexed values giving the y coordinates. The destination coordinates + * are given as values of type float. + * + * @param src + * the array of points to be transformed. + * @param srcOff + * the offset in the source point array of the first point to be + * transformed. + * @param dst + * the point array where the images of the points (after applying + * the AffineTransformation) should be placed. + * @param dstOff + * the offset in the destination array where the new values + * should be written. + * @param length + * the number of points to transform. + * @throws ArrayIndexOutOfBoundsException + * if srcOff + length*2 > src.length or + * dstOff + length*2 > dst.length. */ public void transform(double[] src, int srcOff, float[] dst, int dstOff, int length) { while (--length >= 0) { @@ -932,15 +1032,16 @@ public class AffineTransform implements Cloneable, Serializable { } /** - * Transforms the point according to the linear transformation - * part of this AffineTransformation (without applying the translation). - * - * @param src the original point. - * @param dst the point object where the result of the delta transform - * is written. - * - * @return the result of applying the delta transform (linear part - * only) to the original point. + * Transforms the point according to the linear transformation part of this + * AffineTransformation (without applying the translation). + * + * @param src + * the original point. + * @param dst + * the point object where the result of the delta transform is + * written. + * @return the result of applying the delta transform (linear part only) to + * the original point. */ // TODO: is this right? if dst is null, we check what it's an // instance of? Shouldn't it be src instanceof Point2D.Double? @@ -961,24 +1062,28 @@ public class AffineTransform implements Cloneable, Serializable { } /** - * Applies the linear transformation part of this AffineTransform - * (ignoring the translation part) to a set of points given - * as an array of double values where every two values in the array - * give the coordinates of a point; the even-indexed values giving the - * x coordinates and the odd-indexed values giving the y coordinates. - * - * @param src the array of points to be transformed. - * @param srcOff the offset in the source point array of the first point - * to be transformed. - * @param dst the point array where the images of the points (after - * applying the delta transformation) should be placed. - * @param dstOff the offset in the destination array where the new - * values should be written. - * @param length the number of points to transform. - * - * @throws ArrayIndexOutOfBoundsException if - * srcOff + length*2 > src.length or - * dstOff + length*2 > dst.length. + * Applies the linear transformation part of this AffineTransform (ignoring + * the translation part) to a set of points given as an array of double + * values where every two values in the array give the coordinates of a + * point; the even-indexed values giving the x coordinates and the + * odd-indexed values giving the y coordinates. + * + * @param src + * the array of points to be transformed. + * @param srcOff + * the offset in the source point array of the first point to be + * transformed. + * @param dst + * the point array where the images of the points (after applying + * the delta transformation) should be placed. + * @param dstOff + * the offset in the destination array where the new values + * should be written. + * @param length + * the number of points to transform. + * @throws ArrayIndexOutOfBoundsException + * if srcOff + length*2 > src.length or + * dstOff + length*2 > dst.length. */ public void deltaTransform(double[] src, int srcOff, double[] dst, int dstOff, int length) { while (--length >= 0) { @@ -990,19 +1095,21 @@ public class AffineTransform implements Cloneable, Serializable { } /** - * Transforms the point according to the inverse of this AffineTransformation. - * - * @param src the original point. - * @param dst the point object where the result of the inverse transform - * is written (may be null). - * - * @return the result of applying the inverse transform. - * Inverse transform. + * Transforms the point according to the inverse of this + * AffineTransformation. * - * @throws NoninvertibleTransformException if this AffineTransform cannot be - * inverted (the determinant of the linear transformation part is zero). + * @param src + * the original point. + * @param dst + * the point object where the result of the inverse transform is + * written (may be null). + * @return the result of applying the inverse transform. Inverse transform. + * @throws NoninvertibleTransformException + * if this AffineTransform cannot be inverted (the determinant + * of the linear transformation part is zero). */ - public Point2D inverseTransform(Point2D src, Point2D dst) throws NoninvertibleTransformException { + public Point2D inverseTransform(Point2D src, Point2D dst) + throws NoninvertibleTransformException { double det = getDeterminant(); if (Math.abs(det) < ZERO) { // awt.204=Determinant is zero @@ -1025,29 +1132,33 @@ public class AffineTransform implements Cloneable, Serializable { } /** - * Applies the inverse of this AffineTransform to a set of points given - * as an array of double values where every two values in the array - * give the coordinates of a point; the even-indexed values giving the - * x coordinates and the odd-indexed values giving the y coordinates. - * - * @param src the array of points to be transformed. - * @param srcOff the offset in the source point array of the first point - * to be transformed. - * @param dst the point array where the images of the points (after - * applying the inverse of the AffineTransformation) should be placed. - * @param dstOff the offset in the destination array where the new - * values should be written. - * @param length the number of points to transform. - * - * @throws ArrayIndexOutOfBoundsException if - * srcOff + length*2 > src.length or - * dstOff + length*2 > dst.length. - * @throws NoninvertibleTransformException if this AffineTransform cannot be - * inverted (the determinant of the linear transformation part is zero). + * Applies the inverse of this AffineTransform to a set of points given as + * an array of double values where every two values in the array give the + * coordinates of a point; the even-indexed values giving the x coordinates + * and the odd-indexed values giving the y coordinates. + * + * @param src + * the array of points to be transformed. + * @param srcOff + * the offset in the source point array of the first point to be + * transformed. + * @param dst + * the point array where the images of the points (after applying + * the inverse of the AffineTransformation) should be placed. + * @param dstOff + * the offset in the destination array where the new values + * should be written. + * @param length + * the number of points to transform. + * @throws ArrayIndexOutOfBoundsException + * if srcOff + length*2 > src.length or + * dstOff + length*2 > dst.length. + * @throws NoninvertibleTransformException + * if this AffineTransform cannot be inverted (the determinant + * of the linear transformation part is zero). */ public void inverseTransform(double[] src, int srcOff, double[] dst, int dstOff, int length) - throws NoninvertibleTransformException - { + throws NoninvertibleTransformException { double det = getDeterminant(); if (Math.abs(det) < ZERO) { // awt.204=Determinant is zero @@ -1063,13 +1174,13 @@ public class AffineTransform implements Cloneable, Serializable { } /** - * Creates a new shape whose data is given by applying this - * AffineTransform to the specified shape. - * - * @param src the original shape whose data is to be transformed. + * Creates a new shape whose data is given by applying this AffineTransform + * to the specified shape. * - * @return the new shape found by applying this AffineTransform to - * the original shape. + * @param src + * the original shape whose data is to be transformed. + * @return the new shape found by applying this AffineTransform to the + * original shape. */ public Shape createTransformedShape(Shape src) { if (src == null) { @@ -1086,9 +1197,7 @@ public class AffineTransform implements Cloneable, Serializable { @Override public String toString() { - return - getClass().getName() + - "[[" + m00 + ", " + m01 + ", " + m02 + "], [" //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ + return getClass().getName() + "[[" + m00 + ", " + m01 + ", " + m02 + "], [" //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ + m10 + ", " + m11 + ", " + m12 + "]]"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ } @@ -1120,39 +1229,39 @@ public class AffineTransform implements Cloneable, Serializable { } if (obj instanceof AffineTransform) { AffineTransform t = (AffineTransform)obj; - return - m00 == t.m00 && m01 == t.m01 && - m02 == t.m02 && m10 == t.m10 && - m11 == t.m11 && m12 == t.m12; + return m00 == t.m00 && m01 == t.m01 && m02 == t.m02 && m10 == t.m10 && m11 == t.m11 + && m12 == t.m12; } return false; } - /** * Writes the AffineTrassform object to the output steam. * - * @param stream - the output stream - * - * @throws IOException - if there are I/O errors while writing to the output strem + * @param stream + * - the output stream. + * @throws IOException + * - if there are I/O errors while writing to the output stream. */ private void writeObject(java.io.ObjectOutputStream stream) throws IOException { stream.defaultWriteObject(); } - /** * Read the AffineTransform object from the input stream. * - * @param stream - the input steam - * - * @throws IOException - if there are I/O errors while reading from the input strem - * @throws ClassNotFoundException - if class could not be found + * @param stream + * - the input stream. + * @throws IOException + * - if there are I/O errors while reading from the input + * stream. + * @throws ClassNotFoundException + * - if class could not be found. */ - private void readObject(java.io.ObjectInputStream stream) throws IOException, ClassNotFoundException { + private void readObject(java.io.ObjectInputStream stream) throws IOException, + ClassNotFoundException { stream.defaultReadObject(); type = TYPE_UNKNOWN; } } - diff --git a/awt/java/awt/geom/Arc2D.java b/awt/java/awt/geom/Arc2D.java index bc1e95c643e6f..56f5cd392d228 100644 --- a/awt/java/awt/geom/Arc2D.java +++ b/awt/java/awt/geom/Arc2D.java @@ -18,6 +18,7 @@ * @author Denis M. Kishenko * @version $Revision$ */ + package java.awt.geom; import java.util.NoSuchElementException; @@ -25,59 +26,77 @@ import java.util.NoSuchElementException; import org.apache.harmony.awt.internal.nls.Messages; /** - * The Class Arc2D represents a segment of a curve inscribed - * in a rectangle. The curve is defined by a start angle and an - * extent angle (the end angle minus the start angle) as - * a pie wedge whose point is in the center of the rectangle. - * The Arc2D as a shape may be either OPEN (including nothing - * but the curved arc segment itself), CHORD (the curved arc - * segment closed by a connecting segment from the end to the - * beginning of the arc, or PIE (the segments from the end - * of the arc to the center of the rectangle and from the - * center of the rectangle back to the arc's start point are - * included). + * The Class Arc2D represents a segment of a curve inscribed in a rectangle. The + * curve is defined by a start angle and an extent angle (the end angle minus + * the start angle) as a pie wedge whose point is in the center of the + * rectangle. The Arc2D as a shape may be either OPEN (including nothing but the + * curved arc segment itself), CHORD (the curved arc segment closed by a + * connecting segment from the end to the beginning of the arc, or PIE (the + * segments from the end of the arc to the center of the rectangle and from the + * center of the rectangle back to the arc's start point are included). + * + * @since Android 1.0 */ public abstract class Arc2D extends RectangularShape { - /** The arc type OPEN indicates that the shape includes only the - * curved arc segment. */ + /** + * The arc type OPEN indicates that the shape includes only the curved arc + * segment. + */ public final static int OPEN = 0; - - /** The arc type CHORD indicates that as a shape the connecting - * segment from the end point of the curved arc to the beginning - * point is included. */ + + /** + * The arc type CHORD indicates that as a shape the connecting segment from + * the end point of the curved arc to the beginning point is included. + */ public final static int CHORD = 1; - - /** The arc type PIE indicates that as a shape the two segments - * from the arc's endpoint to the center of the rectangle and from - * the center of the rectangle to the arc's endpoint are included. */ + + /** + * The arc type PIE indicates that as a shape the two segments from the + * arc's endpoint to the center of the rectangle and from the center of the + * rectangle to the arc's endpoint are included. + */ public final static int PIE = 2; /** - * The Class Float is a subclass of Arc2D in which all of the - * data values are given as floats. + * The Class Float is a subclass of Arc2D in which all of the data values + * are given as floats. + * * @see Arc2D.Double + * @since Android 1.0 */ public static class Float extends Arc2D { - /** The x coordinate of the upper left corner of the rectangle that - * contains the arc. */ + /** + * The x coordinate of the upper left corner of the rectangle that + * contains the arc. + */ public float x; - - /** The y coordinate of the upper left corner of the rectangle that - * contains the arc. */ + + /** + * The y coordinate of the upper left corner of the rectangle that + * contains the arc. + */ public float y; - - /** The width of the rectangle that contains the arc. */ + + /** + * The width of the rectangle that contains the arc. + */ public float width; - - /** The height of the rectangle that contains the arc. */ + + /** + * The height of the rectangle that contains the arc. + */ public float height; - - /** The start angle of the arc in degrees. */ + + /** + * The start angle of the arc in degrees. + */ public float start; - - /** The width angle of the arc in degrees. */ + + /** + * The width angle of the arc in degrees. + */ public float extent; /** @@ -90,8 +109,9 @@ public abstract class Arc2D extends RectangularShape { /** * Instantiates a new Arc2D of the specified type with float values. * - * @param type the type of the new Arc2D, either {@link Arc2D#OPEN}, - * {@link Arc2D#CHORD}, or {@link Arc2D#PIE}. + * @param type + * the type of the new Arc2D, either {@link Arc2D#OPEN}, + * {@link Arc2D#CHORD}, or {@link Arc2D#PIE}. */ public Float(int type) { super(type); @@ -100,20 +120,26 @@ public abstract class Arc2D extends RectangularShape { /** * Instantiates a Arc2D with the specified float-valued data. * - * @param x the x coordinate of the upper left corner of the rectangle that - * contains the arc. - * @param y the y coordinate of the upper left corner of the rectangle that - * contains the arc. - * @param width the width of the rectangle that - * contains the arc. - * @param height the height of the rectangle that - * contains the arc. - * @param start the start angle of the arc in degrees. - * @param extent the width angle of the arc in degrees. - * @param type the type of the new Arc2D, either {@link Arc2D#OPEN}, - * {@link Arc2D#CHORD}, or {@link Arc2D#PIE}. + * @param x + * the x coordinate of the upper left corner of the rectangle + * that contains the arc. + * @param y + * the y coordinate of the upper left corner of the rectangle + * that contains the arc. + * @param width + * the width of the rectangle that contains the arc. + * @param height + * the height of the rectangle that contains the arc. + * @param start + * the start angle of the arc in degrees. + * @param extent + * the width angle of the arc in degrees. + * @param type + * the type of the new Arc2D, either {@link Arc2D#OPEN}, + * {@link Arc2D#CHORD}, or {@link Arc2D#PIE}. */ - public Float(float x, float y, float width, float height, float start, float extent, int type) { + public Float(float x, float y, float width, float height, float start, float extent, + int type) { super(type); this.x = x; this.y = y; @@ -124,14 +150,18 @@ public abstract class Arc2D extends RectangularShape { } /** - * Instantiates a new Angle2D with the specified float-valued data - * and the bounding rectangle given by the parameter bounds. + * Instantiates a new Angle2D with the specified float-valued data and + * the bounding rectangle given by the parameter bounds. * - * @param bounds the bounding rectangle of the Angle2D. - * @param start the start angle of the arc in degrees. - * @param extent the width angle of the arc in degrees. - * @param type the type of the new Arc2D, either {@link Arc2D#OPEN}, - * {@link Arc2D#CHORD}, or {@link Arc2D#PIE}. + * @param bounds + * the bounding rectangle of the Angle2D. + * @param start + * the start angle of the arc in degrees. + * @param extent + * the width angle of the arc in degrees. + * @param type + * the type of the new Arc2D, either {@link Arc2D#OPEN}, + * {@link Arc2D#CHORD}, or {@link Arc2D#PIE}. */ public Float(Rectangle2D bounds, float start, float extent, int type) { super(type); @@ -148,8 +178,8 @@ public abstract class Arc2D extends RectangularShape { return x; } - @Override - public double getY() { + @Override + public double getY() { return y; } @@ -179,9 +209,8 @@ public abstract class Arc2D extends RectangularShape { } @Override - public void setArc(double x, double y, double width, double height, - double start, double extent, int type) - { + public void setArc(double x, double y, double width, double height, double start, + double extent, int type) { this.setArcType(type); this.x = (float)x; this.y = (float)y; @@ -209,30 +238,44 @@ public abstract class Arc2D extends RectangularShape { } /** - * The Class Double is a subclass of Arc2D in which all of the - * data values are given as doubles. + * The Class Double is a subclass of Arc2D in which all of the data values + * are given as doubles. + * * @see Arc2D.Float + * @since Android 1.0 */ public static class Double extends Arc2D { - /** The x coordinate of the upper left corner of the rectangle that - * contains the arc. */ + /** + * The x coordinate of the upper left corner of the rectangle that + * contains the arc. + */ public double x; - - /** The y coordinate of the upper left corner of the rectangle that - * contains the arc. */ + + /** + * The y coordinate of the upper left corner of the rectangle that + * contains the arc. + */ public double y; - - /** The width of the rectangle that contains the arc. */ + + /** + * The width of the rectangle that contains the arc. + */ public double width; - - /** The height of the rectangle that contains the arc. */ + + /** + * The height of the rectangle that contains the arc. + */ public double height; - - /** The start angle of the arc in degrees. */ + + /** + * The start angle of the arc in degrees. + */ public double start; - - /** The width angle of the arc in degrees. */ + + /** + * The width angle of the arc in degrees. + */ public double extent; /** @@ -245,8 +288,9 @@ public abstract class Arc2D extends RectangularShape { /** * Instantiates a new Arc2D of the specified type with double values. * - * @param type the type of the new Arc2D, either {@link Arc2D#OPEN}, - * {@link Arc2D#CHORD}, or {@link Arc2D#PIE}. + * @param type + * the type of the new Arc2D, either {@link Arc2D#OPEN}, + * {@link Arc2D#CHORD}, or {@link Arc2D#PIE}. */ public Double(int type) { super(type); @@ -255,22 +299,26 @@ public abstract class Arc2D extends RectangularShape { /** * Instantiates a Arc2D with the specified double-valued data. * - * @param x the x coordinate of the upper left corner of the rectangle that - * contains the arc. - * @param y the y coordinate of the upper left corner of the rectangle that - * contains the arc. - * @param width the width of the rectangle that - * contains the arc. - * @param height the height of the rectangle that - * contains the arc. - * @param start the start angle of the arc in degrees. - * @param extent the width angle of the arc in degrees. - * @param type the type of the new Arc2D, either {@link Arc2D#OPEN}, - * {@link Arc2D#CHORD}, or {@link Arc2D#PIE}. + * @param x + * the x coordinate of the upper left corner of the rectangle + * that contains the arc. + * @param y + * the y coordinate of the upper left corner of the rectangle + * that contains the arc. + * @param width + * the width of the rectangle that contains the arc. + * @param height + * the height of the rectangle that contains the arc. + * @param start + * the start angle of the arc in degrees. + * @param extent + * the width angle of the arc in degrees. + * @param type + * the type of the new Arc2D, either {@link Arc2D#OPEN}, + * {@link Arc2D#CHORD}, or {@link Arc2D#PIE}. */ - public Double(double x, double y, double width, double height, - double start, double extent, int type) - { + public Double(double x, double y, double width, double height, double start, double extent, + int type) { super(type); this.x = x; this.y = y; @@ -281,14 +329,18 @@ public abstract class Arc2D extends RectangularShape { } /** - * Instantiates a new Angle2D with the specified float-valued data - * and the bounding rectangle given by the parameter bounds. + * Instantiates a new Angle2D with the specified float-valued data and + * the bounding rectangle given by the parameter bounds. * - * @param bounds the bounding rectangle of the Angle2D. - * @param start the start angle of the arc in degrees. - * @param extent the width angle of the arc in degrees. - * @param type the type of the new Arc2D, either {@link Arc2D#OPEN}, - * {@link Arc2D#CHORD}, or {@link Arc2D#PIE}. + * @param bounds + * the bounding rectangle of the Angle2D. + * @param start + * the start angle of the arc in degrees. + * @param extent + * the width angle of the arc in degrees. + * @param type + * the type of the new Arc2D, either {@link Arc2D#OPEN}, + * {@link Arc2D#CHORD}, or {@link Arc2D#PIE}. */ public Double(Rectangle2D bounds, double start, double extent, int type) { super(type); @@ -336,9 +388,8 @@ public abstract class Arc2D extends RectangularShape { } @Override - public void setArc(double x, double y, double width, double height, - double start, double extent, int type) - { + public void setArc(double x, double y, double width, double height, double start, + double extent, int type) { this.setArcType(type); this.x = x; this.y = y; @@ -366,73 +417,116 @@ public abstract class Arc2D extends RectangularShape { } /** - * The Class Iterator is the subclass of PathIterator that is used to + * The Class Iterator is the subclass of PathIterator that is used to * traverse the boundary of a shape of type Arc2D. */ class Iterator implements PathIterator { - /** The x coordinate of the center of the arc's bounding rectangle. */ + /** + * The x coordinate of the center of the arc's bounding rectangle. + */ double x; - /** The y coordinate of the center of the arc's bounding rectangle. */ + /** + * The y coordinate of the center of the arc's bounding rectangle. + */ double y; - /** Half of the width of the arc's bounding rectangle (the radius in the case of a circular arc). */ + /** + * Half of the width of the arc's bounding rectangle (the radius in the + * case of a circular arc). + */ double width; - - /** Half of the height of the arc's bounding rectangle (the radius in the case of a circular arc). */ + + /** + * Half of the height of the arc's bounding rectangle (the radius in the + * case of a circular arc). + */ double height; - - /** The start angle of the arc in degrees. */ + + /** + * The start angle of the arc in degrees. + */ double angle; - - /** The angle extent in degrees. */ + + /** + * The angle extent in degrees. + */ double extent; - - /** The closure type of the arc. */ + + /** + * The closure type of the arc. + */ int type; - - /** The path iterator transformation. */ + + /** + * The path iterator transformation. + */ AffineTransform t; - - /** The current segment index. */ + + /** + * The current segment index. + */ int index; - - /** The number of arc segments the source arc subdivided to be approximated by Bezier curves. Depends on extent value. */ + + /** + * The number of arc segments the source arc subdivided to be + * approximated by Bezier curves. Depends on extent value. + */ int arcCount; - - /** The number of line segments. Depends on closure type. */ + + /** + * The number of line segments. Depends on closure type. + */ int lineCount; - - /** The step to calculate next arc subdivision point. */ + + /** + * The step to calculate next arc subdivision point. + */ double step; - - /** The temporary value of cosinus of the current angle. */ + + /** + * The temporary value of cosinus of the current angle. + */ double cos; - /** The temporary value of sinus of the current angle. */ + /** + * The temporary value of sinus of the current angle. + */ double sin; - + /** The coefficient to calculate control points of Bezier curves. */ double k; - - /** The temporary value of x coordinate of the Bezier curve control vector. */ + + /** + * The temporary value of x coordinate of the Bezier curve control + * vector. + */ double kx; - /** The temporary value of y coordinate of the Bezier curve control vector. */ + /** + * The temporary value of y coordinate of the Bezier curve control + * vector. + */ double ky; - - /** The x coordinate of the first path point (MOVE_TO). */ + + /** + * The x coordinate of the first path point (MOVE_TO). + */ double mx; - - /** The y coordinate of the first path point (MOVE_TO). */ + + /** + * The y coordinate of the first path point (MOVE_TO). + */ double my; /** * Constructs a new Arc2D.Iterator for given line and transformation * - * @param a - the source Arc2D object - * @param t the AffineTransformation. + * @param a + * the source Arc2D object. + * @param t + * the AffineTransformation. */ Iterator(Arc2D a, AffineTransform t) { if (width < 0 || height < 0) { @@ -462,8 +556,7 @@ public abstract class Arc2D extends RectangularShape { } else { arcCount = (int)Math.rint(Math.abs(extent) / 90.0); step = Math.toRadians(extent / arcCount); - k = 4.0 / 3.0 * (1.0 - Math.cos(step / 2.0)) - / Math.sin(step / 2.0); + k = 4.0 / 3.0 * (1.0 - Math.cos(step / 2.0)) / Math.sin(step / 2.0); } lineCount = 0; @@ -578,13 +671,16 @@ public abstract class Arc2D extends RectangularShape { } - /** The closure type of the arc. */ + /** + * The closure type of the arc. + */ private int type; /** * Instantiates a new arc2D. * - * @param type the closure type. + * @param type + * the closure type. */ protected Arc2D(int type) { setArcType(type); @@ -595,11 +691,16 @@ public abstract class Arc2D extends RectangularShape { * object with values either of type float or of type double depending on * whether this Arc2D instance is of type Float or Double. * - * @param x the x coordinate of the upper left corner of the bounding rectangle. - * @param y the y coordinate of the upper left corner of the bounding rectangle. - * @param width the width of the bounding rectangle. - * @param height the height of the bounding rectangle. - * + * @param x + * the x coordinate of the upper left corner of the bounding + * rectangle. + * @param y + * the y coordinate of the upper left corner of the bounding + * rectangle. + * @param width + * the width of the bounding rectangle. + * @param height + * the height of the bounding rectangle. * @return the corresponding Rectangle2D object. */ protected abstract Rectangle2D makeBounds(double x, double y, double width, double height); @@ -621,39 +722,46 @@ public abstract class Arc2D extends RectangularShape { /** * Sets the start angle. * - * @param start the new start angle. + * @param start + * the new start angle. */ public abstract void setAngleStart(double start); /** * Sets the width angle. * - * @param extent the new width angle. + * @param extent + * the new width angle. */ public abstract void setAngleExtent(double extent); /** * Sets the data values that define the arc. * - * @param x the x coordinate of the upper left corner of the rectangle that - * contains the arc. - * @param y the y coordinate of the upper left corner of the rectangle that - * contains the arc. - * @param width the width of the rectangle that - * contains the arc. - * @param height the height of the rectangle that - * contains the arc. - * @param start the start angle of the arc in degrees. - * @param extent the width angle of the arc in degrees. - * @param type the type of the new Arc2D, either {@link Arc2D#OPEN}, - * {@link Arc2D#CHORD}, or {@link Arc2D#PIE}. + * @param x + * the x coordinate of the upper left corner of the rectangle + * that contains the arc. + * @param y + * the y coordinate of the upper left corner of the rectangle + * that contains the arc. + * @param width + * the width of the rectangle that contains the arc. + * @param height + * the height of the rectangle that contains the arc. + * @param start + * the start angle of the arc in degrees. + * @param extent + * the width angle of the arc in degrees. + * @param type + * the type of the new Arc2D, either {@link Arc2D#OPEN}, + * {@link Arc2D#CHORD}, or {@link Arc2D#PIE}. */ - public abstract void setArc(double x, double y, double width, - double height, double start, double extent, int type); + public abstract void setArc(double x, double y, double width, double height, double start, + double extent, int type); /** - * Gets the arc type, either {@link Arc2D#OPEN}, - * {@link Arc2D#CHORD}, or {@link Arc2D#PIE}. + * Gets the arc type, either {@link Arc2D#OPEN}, {@link Arc2D#CHORD}, or + * {@link Arc2D#PIE}. * * @return the arc type. */ @@ -662,10 +770,11 @@ public abstract class Arc2D extends RectangularShape { } /** - * Sets the arc type, either {@link Arc2D#OPEN}, - * {@link Arc2D#CHORD}, or {@link Arc2D#PIE}. + * Sets the arc type, either {@link Arc2D#OPEN}, {@link Arc2D#CHORD}, or + * {@link Arc2D#PIE}. * - * @param type the new arc type. + * @param type + * the new arc type. */ public void setArcType(int type) { if (type != OPEN && type != CHORD && type != PIE) { @@ -682,9 +791,8 @@ public abstract class Arc2D extends RectangularShape { */ public Point2D getStartPoint() { double a = Math.toRadians(getAngleStart()); - return new Point2D.Double( - getX() + (1.0 + Math.cos(a)) * getWidth() / 2.0, - getY() + (1.0 - Math.sin(a)) * getHeight() / 2.0); + return new Point2D.Double(getX() + (1.0 + Math.cos(a)) * getWidth() / 2.0, getY() + + (1.0 - Math.sin(a)) * getHeight() / 2.0); } /** @@ -694,9 +802,8 @@ public abstract class Arc2D extends RectangularShape { */ public Point2D getEndPoint() { double a = Math.toRadians(getAngleStart() + getAngleExtent()); - return new Point2D.Double( - getX() + (1.0 + Math.cos(a)) * getWidth() / 2.0, - getY() + (1.0 - Math.sin(a)) * getHeight() / 2.0); + return new Point2D.Double(getX() + (1.0 + Math.cos(a)) * getWidth() / 2.0, getY() + + (1.0 - Math.sin(a)) * getHeight() / 2.0); } public Rectangle2D getBounds2D() { @@ -712,8 +819,8 @@ public abstract class Arc2D extends RectangularShape { Point2D p2 = getEndPoint(); double bx1 = containsAngle(180.0) ? rx1 : Math.min(p1.getX(), p2.getX()); - double by1 = containsAngle(90.0) ? ry1 : Math.min(p1.getY(), p2.getY()); - double bx2 = containsAngle(0.0) ? rx2 : Math.max(p1.getX(), p2.getX()); + double by1 = containsAngle(90.0) ? ry1 : Math.min(p1.getY(), p2.getY()); + double bx2 = containsAngle(0.0) ? rx2 : Math.max(p1.getX(), p2.getX()); double by2 = containsAngle(270.0) ? ry2 : Math.max(p1.getY(), p2.getY()); if (type == PIE) { @@ -735,12 +842,17 @@ public abstract class Arc2D extends RectangularShape { /** * Sets the data that defines the arc. * - * @param point the upper left corner of the bounding rectangle. - * @param size the size of the bounding rectangle. - * @param start the start angle of the arc in degrees. - * @param extent the angle witdth of the arc in degrees. - * @param type the closure type, either {@link Arc2D#OPEN}, - * {@link Arc2D#CHORD}, or {@link Arc2D#PIE}. + * @param point + * the upper left corner of the bounding rectangle. + * @param size + * the size of the bounding rectangle. + * @param start + * the start angle of the arc in degrees. + * @param extent + * the angle width of the arc in degrees. + * @param type + * the closure type, either {@link Arc2D#OPEN}, + * {@link Arc2D#CHORD}, or {@link Arc2D#PIE}. */ public void setArc(Point2D point, Dimension2D size, double start, double extent, int type) { setArc(point.getX(), point.getY(), size.getWidth(), size.getHeight(), start, extent, type); @@ -749,11 +861,15 @@ public abstract class Arc2D extends RectangularShape { /** * Sets the data that defines the arc. * - * @param rect the arc's bounding rectangle. - * @param start the start angle of the arc in degrees. - * @param extent the angle witdth of the arc in degrees. - * @param type the closure type, either {@link Arc2D#OPEN}, - * {@link Arc2D#CHORD}, or {@link Arc2D#PIE}. + * @param rect + * the arc's bounding rectangle. + * @param start + * the start angle of the arc in degrees. + * @param extent + * the angle width of the arc in degrees. + * @param type + * the closure type, either {@link Arc2D#OPEN}, + * {@link Arc2D#CHORD}, or {@link Arc2D#PIE}. */ public void setArc(Rectangle2D rect, double start, double extent, int type) { setArc(rect.getX(), rect.getY(), rect.getWidth(), rect.getHeight(), start, extent, type); @@ -762,47 +878,60 @@ public abstract class Arc2D extends RectangularShape { /** * Sets the data that defines the arc by copying it from another Arc2D. * - * @param arc the arc whose data is copied into this arc. + * @param arc + * the arc whose data is copied into this arc. */ public void setArc(Arc2D arc) { - setArc(arc.getX(), arc.getY(), arc.getWidth(), arc.getHeight(), arc - .getAngleStart(), arc.getAngleExtent(), arc.getArcType()); + setArc(arc.getX(), arc.getY(), arc.getWidth(), arc.getHeight(), arc.getAngleStart(), arc + .getAngleExtent(), arc.getArcType()); } /** * Sets the data for a circular arc by giving its center and radius. * - * @param x the x coordinate of the center of the circle. - * @param y the y coordinate of the center of the circle. - * @param radius the radius of the circle. - * @param start the start angle of the arc in degrees. - * @param extent the angle witdth of the arc in degrees. - * @param type the closure type, either {@link Arc2D#OPEN}, - * {@link Arc2D#CHORD}, or {@link Arc2D#PIE}. + * @param x + * the x coordinate of the center of the circle. + * @param y + * the y coordinate of the center of the circle. + * @param radius + * the radius of the circle. + * @param start + * the start angle of the arc in degrees. + * @param extent + * the angle width of the arc in degrees. + * @param type + * the closure type, either {@link Arc2D#OPEN}, + * {@link Arc2D#CHORD}, or {@link Arc2D#PIE}. */ - public void setArcByCenter(double x, double y, double radius, double start, double extent, int type) { + public void setArcByCenter(double x, double y, double radius, double start, double extent, + int type) { setArc(x - radius, y - radius, radius * 2.0, radius * 2.0, start, extent, type); } /** - * Sets the arc data for a circular arc based on two tangent lines - * and the radius. The two tangent lines are the lines from p1 - * to p2 and from p2 to p3, which determine a unique circle - * with the given radius. The start and end points of the arc - * are the points where the circle touches the two lines, and - * the arc itself is the shorter of the two circle segments - * determined by the two points (in other words, it is the - * piece of the circle that is closer to the lines' intersection - * point p2 and forms a concave shape with the segments from p1 to p2 - * and from p2 to p3). + * Sets the arc data for a circular arc based on two tangent lines and the + * radius. The two tangent lines are the lines from p1 to p2 and from p2 to + * p3, which determine a unique circle with the given radius. The start and + * end points of the arc are the points where the circle touches the two + * lines, and the arc itself is the shorter of the two circle segments + * determined by the two points (in other words, it is the piece of the + * circle that is closer to the lines' intersection point p2 and forms a + * concave shape with the segments from p1 to p2 and from p2 to p3). * - * @param p1 a point which determines one of the two tanget lines (with p2). - * @param p2 the point of intersection of the two tangent lines. - * @param p3 a point which determines one of the two tanget lines (with p2). - * @param radius the radius of the circular arc. + * @param p1 + * a point which determines one of the two tangent lines (with + * p2). + * @param p2 + * the point of intersection of the two tangent lines. + * @param p3 + * a point which determines one of the two tangent lines (with + * p2). + * @param radius + * the radius of the circular arc. */ public void setArcByTangent(Point2D p1, Point2D p2, Point2D p3, double radius) { - // Used simple geometric calculations of arc center, radius and angles by tangents + // Used simple geometric calculations of arc center, radius and angles + // by tangents double a1 = -Math.atan2(p1.getY() - p2.getY(), p1.getX() - p2.getX()); double a2 = -Math.atan2(p3.getY() - p2.getY(), p3.getX() - p2.getX()); double am = (a1 + a2) / 2.0; @@ -821,10 +950,11 @@ public abstract class Arc2D extends RectangularShape { } /** - * Sets a new start angle to be the angle given by the the vector - * from the current center point to the specified point. + * Sets a new start angle to be the angle given by the the vector from the + * current center point to the specified point. * - * @param point the point that determines the new start angle. + * @param point + * the point that determines the new start angle. */ public void setAngleStart(Point2D point) { double angle = Math.atan2(point.getY() - getCenterY(), point.getX() - getCenterX()); @@ -832,20 +962,23 @@ public abstract class Arc2D extends RectangularShape { } /** - * Sets the angles in terms of vectors from the current arc center - * to the points (x1, y1) and (x2, y2). The start angle is given - * by the vector from the current center to the point (x1, y1) and - * the end angle is given by the vector from the center to the point - * (x2, y2). + * Sets the angles in terms of vectors from the current arc center to the + * points (x1, y1) and (x2, y2). The start angle is given by the vector from + * the current center to the point (x1, y1) and the end angle is given by + * the vector from the center to the point (x2, y2). * - * @param x1 the x coordinate of the point whose vector from the center - * point determines the new start angle of the arc. - * @param y1 the y coordinate of the point whose vector from the center - * point determines the new start angle of the arc. - * @param x2 the x coordinate of the point whose vector from the center - * point determines the new end angle of the arc. - * @param y2 the y coordinate of the point whose vector from the center - * point determines the new end angle of the arc. + * @param x1 + * the x coordinate of the point whose vector from the center + * point determines the new start angle of the arc. + * @param y1 + * the y coordinate of the point whose vector from the center + * point determines the new start angle of the arc. + * @param x2 + * the x coordinate of the point whose vector from the center + * point determines the new end angle of the arc. + * @param y2 + * the y coordinate of the point whose vector from the center + * point determines the new end angle of the arc. */ public void setAngles(double x1, double y1, double x2, double y2) { double cx = getCenterX(); @@ -861,29 +994,30 @@ public abstract class Arc2D extends RectangularShape { } /** - * Sets the angles in terms of vectors from the current arc center - * to the points p1 and p2. The start angle is given - * by the vector from the current center to the point p1 and - * the end angle is given by the vector from the center to the point - * p2. + * Sets the angles in terms of vectors from the current arc center to the + * points p1 and p2. The start angle is given by the vector from the current + * center to the point p1 and the end angle is given by the vector from the + * center to the point p2. * - * @param p1 the point whose vector from the center - * point determines the new start angle of the arc. - * @param p2 the point whose vector from the center - * point determines the new end angle of the arc. + * @param p1 + * the point whose vector from the center point determines the + * new start angle of the arc. + * @param p2 + * the point whose vector from the center point determines the + * new end angle of the arc. */ public void setAngles(Point2D p1, Point2D p2) { setAngles(p1.getX(), p1.getY(), p2.getX(), p2.getY()); } /** - * Normalizes the angle by removing extra winding (past 360 degrees) - * and placing it in the positive degree range. + * Normalizes the angle by removing extra winding (past 360 degrees) and + * placing it in the positive degree range. * - * @param angle - the source angle in degrees - * - * @return an angle between 0 and 360 degrees which corresponds - * to the same direction vector as the source angle. + * @param angle + * the source angle in degrees. + * @return an angle between 0 and 360 degrees which corresponds to the same + * direction vector as the source angle. */ double getNormAngle(double angle) { double n = Math.floor(angle / 360.0); @@ -893,10 +1027,10 @@ public abstract class Arc2D extends RectangularShape { /** * Determines whether the given angle is contained in the span of the arc. * - * @param angle the angle to test in degrees. - * - * @return true, if the given angle is between the start angle and - * the end angle of the arc. + * @param angle + * the angle to test in degrees. + * @return true, if the given angle is between the start angle and the end + * angle of the arc. */ public boolean containsAngle(double angle) { double extent = getAngleExtent(); @@ -912,8 +1046,7 @@ public abstract class Arc2D extends RectangularShape { if (a2 < 0.0) { return angle >= a2 + 360.0 || angle <= a1; } - return extent > 0.0 ? a1 <= angle && angle <= a2 : a2 <= angle - && angle <= a1; + return extent > 0.0 ? a1 <= angle && angle <= a2 : a2 <= angle && angle <= a1; } public boolean contains(double px, double py) { @@ -931,8 +1064,7 @@ public abstract class Arc2D extends RectangularShape { return true; } - boolean containsAngle = containsAngle(Math.toDegrees(-Math - .atan2(ny, nx))); + boolean containsAngle = containsAngle(Math.toDegrees(-Math.atan2(ny, nx))); if (type == PIE) { return containsAngle; } @@ -943,14 +1075,13 @@ public abstract class Arc2D extends RectangularShape { Line2D l = new Line2D.Double(getStartPoint(), getEndPoint()); int ccw1 = l.relativeCCW(px, py); int ccw2 = l.relativeCCW(getCenterX(), getCenterY()); - return ccw1 == 0 || ccw2 == 0 - || ((ccw1 + ccw2) == 0 ^ absExtent > 180.0); + return ccw1 == 0 || ccw2 == 0 || ((ccw1 + ccw2) == 0 ^ absExtent > 180.0); } public boolean contains(double rx, double ry, double rw, double rh) { - if (!(contains(rx, ry) && contains(rx + rw, ry) - && contains(rx + rw, ry + rh) && contains(rx, ry + rh))) { + if (!(contains(rx, ry) && contains(rx + rw, ry) && contains(rx + rw, ry + rh) && contains( + rx, ry + rh))) { return false; } @@ -1003,9 +1134,8 @@ public abstract class Arc2D extends RectangularShape { } if (type == PIE) { - if (r.intersectsLine(p1.getX(), p1.getY(), cx, cy) || - r.intersectsLine(p2.getX(), p2.getY(), cx, cy)) - { + if (r.intersectsLine(p1.getX(), p1.getY(), cx, cy) + || r.intersectsLine(p2.getX(), p2.getY(), cx, cy)) { return true; } } else { @@ -1025,4 +1155,3 @@ public abstract class Arc2D extends RectangularShape { } } - diff --git a/awt/java/awt/geom/Area.java b/awt/java/awt/geom/Area.java index bc27d4e248688..e6619e349c703 100644 --- a/awt/java/awt/geom/Area.java +++ b/awt/java/awt/geom/Area.java @@ -18,6 +18,7 @@ * @author Denis M. Kishenko * @version $Revision$ */ + package java.awt.geom; import java.awt.Rectangle; @@ -27,13 +28,18 @@ import java.awt.geom.Rectangle2D; import java.util.NoSuchElementException; import org.apache.harmony.awt.internal.nls.Messages; +import org.apache.harmony.luni.util.NotImplementedException; /** * The Class Area provides a minimal implementation for a generic shape. + * + * @since Android 1.0 */ public class Area implements Shape, Cloneable { - /** The source Shape object. */ + /** + * The source Shape object. + */ Shape s; /** @@ -80,7 +86,8 @@ public class Area implements Shape, Cloneable { /** * Instantiates a new area with data given by the specified shape. * - * @param s the shape that gives the data for this Area + * @param s + * the shape that gives the data for this Area. */ public Area(Shape s) { if (s == null) { @@ -114,11 +121,11 @@ public class Area implements Shape, Cloneable { /** * Tests whether the object is equal to this Area. * - * @param obj the object to compare - * - * @return true, if successful - * - * @throws NotImplementedException if this method is not implemented + * @param obj + * the object to compare. + * @return true, if successful. + * @throws NotImplementedException + * if this method is not implemented. */ public boolean equals(Area obj) throws org.apache.harmony.luni.util.NotImplementedException { throw new RuntimeException("Not implemented"); //$NON-NLS-1$ @@ -140,7 +147,7 @@ public class Area implements Shape, Cloneable { } public Rectangle2D getBounds2D() { - return s == null ? new Rectangle2D.Double(): s.getBounds2D(); + return s == null ? new Rectangle2D.Double() : s.getBounds2D(); } public PathIterator getPathIterator(AffineTransform t) { @@ -154,32 +161,34 @@ public class Area implements Shape, Cloneable { /** * Adds the specified area to this area. * - * @param area the area to add to this area - * - * @throws NotImplementedException if this method is not implemented + * @param area + * the area to add to this area. + * @throws NotImplementedException + * if this method is not implemented. */ public void add(Area area) throws org.apache.harmony.luni.util.NotImplementedException { throw new RuntimeException("Not implemented"); //$NON-NLS-1$ } /** - * Performs an exclusive or operation between this shape and the - * specified shape. + * Performs an exclusive or operation between this shape and the specified + * shape. * - * @param area the area to XOR against this area - * - * @throws NotImplementedException if this method is not implemented + * @param area + * the area to XOR against this area. + * @throws NotImplementedException + * if this method is not implemented. */ public void exclusiveOr(Area area) throws org.apache.harmony.luni.util.NotImplementedException { throw new RuntimeException("Not implemented"); //$NON-NLS-1$ } /** - * Extracts a Rectangle2D from the source shape if the underlying shape - * data describes a rectangle. + * Extracts a Rectangle2D from the source shape if the underlying shape data + * describes a rectangle. * - * @return a Rectangle2D object if the source shape is rectangle, - * or null if shape is empty or not rectangle. + * @return a Rectangle2D object if the source shape is rectangle, or null if + * shape is empty or not rectangle. */ Rectangle2D extractRectangle() { if (s == null) { @@ -189,7 +198,7 @@ public class Area implements Shape, Cloneable { int count = 0; PathIterator p = s.getPathIterator(null); float[] coords = new float[6]; - while(!p.isDone()) { + while (!p.isDone()) { int type = p.currentSegment(coords); if (count > 12 || type == PathIterator.SEG_QUADTO || type == PathIterator.SEG_CUBICTO) { return null; @@ -198,21 +207,22 @@ public class Area implements Shape, Cloneable { points[count++] = coords[1]; p.next(); } - if (points[0] == points[6] && points[6] == points[8] && points[2] == points[4] && - points[1] == points[3] && points[3] == points[9] && points[5] == points[7]) - { - return new Rectangle2D.Float(points[0], points[1], points[2] - points[0], points[7] - points[1]); + if (points[0] == points[6] && points[6] == points[8] && points[2] == points[4] + && points[1] == points[3] && points[3] == points[9] && points[5] == points[7]) { + return new Rectangle2D.Float(points[0], points[1], points[2] - points[0], points[7] + - points[1]); } return null; } - + /** - * Reduces the size of this Area by intersecting it with the - * specified Area if they are both rectangles. + * Reduces the size of this Area by intersecting it with the specified Area + * if they are both rectangles. * - * @see java.awt.geom.Rectangle2D#intersect(Rectangle2D, Rectangle2D, Rectangle2D) - * - * @param area the area + * @see java.awt.geom.Rectangle2D#intersect(Rectangle2D, Rectangle2D, + * Rectangle2D) + * @param area + * the area. */ public void intersect(Area area) { Rectangle2D src1 = extractRectangle(); @@ -225,9 +235,10 @@ public class Area implements Shape, Cloneable { /** * Subtract the specified area from this area. * - * @param area the area to subtract - * - * @throws NotImplementedException if this method is not implemented + * @param area + * the area to subtract. + * @throws NotImplementedException + * if this method is not implemented. */ public void subtract(Area area) throws org.apache.harmony.luni.util.NotImplementedException { throw new RuntimeException("Not implemented"); //$NON-NLS-1$ @@ -236,9 +247,9 @@ public class Area implements Shape, Cloneable { /** * Checks if this Area is empty. * - * @return true, if this Area is empty - * - * @throws NotImplementedException if this method is not implemented + * @return true, if this Area is empty. + * @throws NotImplementedException + * if this method is not implemented. */ public boolean isEmpty() throws org.apache.harmony.luni.util.NotImplementedException { throw new RuntimeException("Not implemented"); //$NON-NLS-1$ @@ -247,9 +258,9 @@ public class Area implements Shape, Cloneable { /** * Checks if this Area is polygonal. * - * @return true, if this Area is polygonal - * - * @throws NotImplementedException if this method is not implemented + * @return true, if this Area is polygonal. + * @throws NotImplementedException + * if this method is not implemented. */ public boolean isPolygonal() throws org.apache.harmony.luni.util.NotImplementedException { throw new RuntimeException("Not implemented"); //$NON-NLS-1$ @@ -258,9 +269,9 @@ public class Area implements Shape, Cloneable { /** * Checks if this Area is rectangular. * - * @return true, if this Area is rectangular - * - * @throws NotImplementedException if this method is not implemented + * @return true, if this Area is rectangular. + * @throws NotImplementedException + * if this method is not implemented. */ public boolean isRectangular() throws org.apache.harmony.luni.util.NotImplementedException { throw new RuntimeException("Not implemented"); //$NON-NLS-1$ @@ -269,9 +280,9 @@ public class Area implements Shape, Cloneable { /** * Checks if this Area is singular. * - * @return true, if this Area is singular - * - * @throws NotImplementedException if this method is not implemented + * @return true, if this Area is singular. + * @throws NotImplementedException + * if this method is not implemented. */ public boolean isSingular() throws org.apache.harmony.luni.util.NotImplementedException { throw new RuntimeException("Not implemented"); //$NON-NLS-1$ @@ -280,30 +291,32 @@ public class Area implements Shape, Cloneable { /** * Resets the data of this Area. * - * @throws NotImplementedException if this method is not implemented + * @throws NotImplementedException + * if this method is not implemented. */ public void reset() throws org.apache.harmony.luni.util.NotImplementedException { throw new RuntimeException("Not implemented"); //$NON-NLS-1$ } /** - * Transforms the data of this Area according to the specified + * Transforms the data of this Area according to the specified * AffineTransform. * - * @param t the transform to use to transform the data + * @param t + * the transform to use to transform the data. */ public void transform(AffineTransform t) { s = t.createTransformedShape(s); } /** - * Creates a new Area that is the result of transforming the data - * of this Area according to the specified AffineTransform. - * - * @param t the transform to use to transform the data + * Creates a new Area that is the result of transforming the data of this + * Area according to the specified AffineTransform. * - * @return the new Area that is the result of transforming the data - * of this Area according to the specified AffineTransform. + * @param t + * the transform to use to transform the data. + * @return the new Area that is the result of transforming the data of this + * Area according to the specified AffineTransform. */ public Area createTransformedArea(AffineTransform t) { return s == null ? new Area() : new Area(t.createTransformedShape(s)); diff --git a/awt/java/awt/geom/CubicCurve2D.java b/awt/java/awt/geom/CubicCurve2D.java index 3e440c8b6cd50..1ddedf39a403c 100644 --- a/awt/java/awt/geom/CubicCurve2D.java +++ b/awt/java/awt/geom/CubicCurve2D.java @@ -18,6 +18,7 @@ * @author Denis M. Kishenko * @version $Revision$ */ + package java.awt.geom; import java.awt.Rectangle; @@ -28,49 +29,69 @@ import org.apache.harmony.awt.gl.Crossing; import org.apache.harmony.awt.internal.nls.Messages; /** - * The Class CubicCurve2D is a Shape that represents a segment of a - * quadratic (Bezier) curve. The curved segment is determined by four points: - * a start point, an end point, and two control points. - * The control points give information about the tangent and next - * derivative at the endpoints according to the standard theory of - * Bezier curves. For more information on Bezier curves, - * see this article. + * The Class CubicCurve2D is a Shape that represents a segment of a quadratic + * (Bezier) curve. The curved segment is determined by four points: a start + * point, an end point, and two control points. The control points give + * information about the tangent and next derivative at the endpoints according + * to the standard theory of Bezier curves. For more information on Bezier + * curves, see this + * article. + * + * @since Android 1.0 */ public abstract class CubicCurve2D implements Shape, Cloneable { /** - * The Class Float is the subclass of CubicCurve2D that has all - * of its data values stored with float-level precision. + * The Class Float is the subclass of CubicCurve2D that has all of its data + * values stored with float-level precision. + * + * @since Android 1.0 */ public static class Float extends CubicCurve2D { - /** The x coordinate of the starting point. */ + /** + * The x coordinate of the starting point. + */ public float x1; - - /** The y coordinate of the starting point. */ + + /** + * The y coordinate of the starting point. + */ public float y1; - - /** The x coordinate of the first control point. */ + + /** + * The x coordinate of the first control point. + */ public float ctrlx1; - - /** The y coordinate of the first control point. */ + + /** + * The y coordinate of the first control point. + */ public float ctrly1; - - /** The x coordinate of the second control point. */ + + /** + * The x coordinate of the second control point. + */ public float ctrlx2; - - /** The y coordinate of the second control point. */ + + /** + * The y coordinate of the second control point. + */ public float ctrly2; - - /** The x coordinate of the end point. */ + + /** + * The x coordinate of the end point. + */ public float x2; - - /** The y coordinate of the end point. */ + + /** + * The y coordinate of the end point. + */ public float y2; /** - * Instantiates a new float-valued CubicCurve2D with all coordinate values - * set to zero. + * Instantiates a new float-valued CubicCurve2D with all coordinate + * values set to zero. */ public Float() { } @@ -79,16 +100,25 @@ public abstract class CubicCurve2D implements Shape, Cloneable { * Instantiates a new float-valued CubicCurve2D with the specified * coordinate values. * - * @param x1 the x coordinate of the starting point - * @param y1 the y coordinate of the starting point - * @param ctrlx1 the x coordinate of the first control point - * @param ctrly1 the y coordinate of the first control point - * @param ctrlx2 the x coordinate of the second control point - * @param ctrly2 the y coordinate of the second control point - * @param x2 the x coordinate of the end point - * @param y2 the y coordinate of the end point + * @param x1 + * the x coordinate of the starting point. + * @param y1 + * the y coordinate of the starting point. + * @param ctrlx1 + * the x coordinate of the first control point. + * @param ctrly1 + * the y coordinate of the first control point. + * @param ctrlx2 + * the x coordinate of the second control point. + * @param ctrly2 + * the y coordinate of the second control point. + * @param x2 + * the x coordinate of the end point. + * @param y2 + * the y coordinate of the end point. */ - public Float(float x1, float y1, float ctrlx1, float ctrly1, float ctrlx2, float ctrly2, float x2, float y2) { + public Float(float x1, float y1, float ctrlx1, float ctrly1, float ctrlx2, float ctrly2, + float x2, float y2) { setCurve(x1, y1, ctrlx1, ctrly1, ctrlx2, ctrly2, x2, y2); } @@ -153,9 +183,8 @@ public abstract class CubicCurve2D implements Shape, Cloneable { } @Override - public void setCurve(double x1, double y1, double ctrlx1, double ctrly1, - double ctrlx2, double ctrly2, double x2, double y2) - { + public void setCurve(double x1, double y1, double ctrlx1, double ctrly1, double ctrlx2, + double ctrly2, double x2, double y2) { this.x1 = (float)x1; this.y1 = (float)y1; this.ctrlx1 = (float)ctrlx1; @@ -169,18 +198,25 @@ public abstract class CubicCurve2D implements Shape, Cloneable { /** * Sets the data values of the curve. * - * @param x1 the x coordinate of the starting point - * @param y1 the y coordinate of the starting point - * @param ctrlx1 the x coordinate of the first control point - * @param ctrly1 the y coordinate of the first control point - * @param ctrlx2 the x coordinate of the second control point - * @param ctrly2 the y coordinate of the second control point - * @param x2 the x coordinate of the end point - * @param y2 the y coordinate of the end point + * @param x1 + * the x coordinate of the starting point. + * @param y1 + * the y coordinate of the starting point. + * @param ctrlx1 + * the x coordinate of the first control point. + * @param ctrly1 + * the y coordinate of the first control point. + * @param ctrlx2 + * the x coordinate of the second control point. + * @param ctrly2 + * the y coordinate of the second control point. + * @param x2 + * the x coordinate of the end point. + * @param y2 + * the y coordinate of the end point. */ - public void setCurve(float x1, float y1, float ctrlx1, float ctrly1, - float ctrlx2, float ctrly2, float x2, float y2) - { + public void setCurve(float x1, float y1, float ctrlx1, float ctrly1, float ctrlx2, + float ctrly2, float x2, float y2) { this.x1 = x1; this.y1 = y1; this.ctrlx1 = ctrlx1; @@ -201,38 +237,56 @@ public abstract class CubicCurve2D implements Shape, Cloneable { } /** - * The Class Double is the subclass of CubicCurve2D that has all - * of its data values stored with double-level precision. + * The Class Double is the subclass of CubicCurve2D that has all of its data + * values stored with double-level precision. + * + * @since Android 1.0 */ public static class Double extends CubicCurve2D { - /** The x coordinate of the starting point. */ + /** + * The x coordinate of the starting point. + */ public double x1; - - /** The y coordinate of the starting point. */ + + /** + * The y coordinate of the starting point. + */ public double y1; - - /** The x coordinate of the first control point. */ + + /** + * The x coordinate of the first control point. + */ public double ctrlx1; - - /** The y coordinate of the first control point. */ + + /** + * The y coordinate of the first control point. + */ public double ctrly1; - - /** The x coordinate of the second control point. */ + + /** + * The x coordinate of the second control point. + */ public double ctrlx2; - - /** The y coordinate of the second control point. */ + + /** + * The y coordinate of the second control point. + */ public double ctrly2; - - /** The x coordinate of the end point. */ + + /** + * The x coordinate of the end point. + */ public double x2; - - /** The y coordinate of the end point. */ + + /** + * The y coordinate of the end point. + */ public double y2; /** - * Instantiates a new double-valued CubicCurve2D with all coordinate values - * set to zero. + * Instantiates a new double-valued CubicCurve2D with all coordinate + * values set to zero. */ public Double() { } @@ -241,17 +295,25 @@ public abstract class CubicCurve2D implements Shape, Cloneable { * Instantiates a new double-valued CubicCurve2D with the specified * coordinate values. * - * @param x1 the x coordinate of the starting point - * @param y1 the y coordinate of the starting point - * @param ctrlx1 the x coordinate of the first control point - * @param ctrly1 the y coordinate of the first control point - * @param ctrlx2 the x coordinate of the second control point - * @param ctrly2 the y coordinate of the second control point - * @param x2 the x coordinate of the end point - * @param y2 the y coordinate of the end point + * @param x1 + * the x coordinate of the starting point. + * @param y1 + * the y coordinate of the starting point. + * @param ctrlx1 + * the x coordinate of the first control point. + * @param ctrly1 + * the y coordinate of the first control point. + * @param ctrlx2 + * the x coordinate of the second control point. + * @param ctrly2 + * the y coordinate of the second control point. + * @param x2 + * the x coordinate of the end point. + * @param y2 + * the y coordinate of the end point. */ - public Double(double x1, double y1, double ctrlx1, double ctrly1, - double ctrlx2, double ctrly2, double x2, double y2) { + public Double(double x1, double y1, double ctrlx1, double ctrly1, double ctrlx2, + double ctrly2, double x2, double y2) { setCurve(x1, y1, ctrlx1, ctrly1, ctrlx2, ctrly2, x2, y2); } @@ -316,9 +378,8 @@ public abstract class CubicCurve2D implements Shape, Cloneable { } @Override - public void setCurve(double x1, double y1, double ctrlx1, double ctrly1, - double ctrlx2, double ctrly2, double x2, double y2) - { + public void setCurve(double x1, double y1, double ctrlx1, double ctrly1, double ctrlx2, + double ctrly2, double x2, double y2) { this.x1 = x1; this.y1 = y1; this.ctrlx1 = ctrlx1; @@ -339,27 +400,36 @@ public abstract class CubicCurve2D implements Shape, Cloneable { } /* - * CubicCurve2D path iterator + * CubicCurve2D path iterator */ /** * The Iterator class for the Shape CubicCurve2D. */ class Iterator implements PathIterator { - /** The source CubicCurve2D object. */ + /** + * The source CubicCurve2D object. + */ CubicCurve2D c; - - /** The path iterator transformation. */ + + /** + * The path iterator transformation. + */ AffineTransform t; - - /** The current segmenet index. */ + + /** + * The current segment index. + */ int index; /** - * Constructs a new CubicCurve2D.Iterator for given line and transformation + * Constructs a new CubicCurve2D.Iterator for given line and + * transformation * - * @param c - the source CubicCurve2D object - * @param t the t + * @param c + * the source CubicCurve2D object. + * @param t + * the affine transformation object. */ Iterator(CubicCurve2D c, AffineTransform t) { this.c = c; @@ -443,42 +513,42 @@ public abstract class CubicCurve2D implements Shape, Cloneable { /** * Gets the x coordinate of the starting point. * - * @return the x coordinate of the starting point + * @return the x coordinate of the starting point. */ public abstract double getX1(); /** * Gets the y coordinate of the starting point. * - * @return the y coordinate of the starting point + * @return the y coordinate of the starting point. */ public abstract double getY1(); /** * Gets the starting point. * - * @return the starting point + * @return the starting point. */ public abstract Point2D getP1(); /** * Gets the x coordinate of the first control point. * - * @return the x coordinate of the first control point + * @return the x coordinate of the first control point. */ public abstract double getCtrlX1(); /** * Gets the y coordinate of the first control point. * - * @return the y coordinate of the first control point + * @return the y coordinate of the first control point. */ public abstract double getCtrlY1(); /** * Gets the second control point. * - * @return the second control point + * @return the second control point. */ public abstract Point2D getCtrlP1(); @@ -499,42 +569,50 @@ public abstract class CubicCurve2D implements Shape, Cloneable { /** * Gets the second control point. * - * @return the second control point + * @return the second control point. */ public abstract Point2D getCtrlP2(); /** * Gets the x coordinate of the end point. * - * @return the x coordinate of the end point + * @return the x coordinate of the end point. */ public abstract double getX2(); /** * Gets the y coordinate of the end point. * - * @return the y coordinate of the end point + * @return the y coordinate of the end point. */ public abstract double getY2(); /** * Gets the end point. * - * @return the end point + * @return the end point. */ public abstract Point2D getP2(); /** * Sets the data of the curve. * - * @param x1 the x coordinate of the starting point - * @param y1 the y coordinate of the starting point - * @param ctrlx1 the x coordinate of the first control point - * @param ctrly1 the y coordinate of the first control point - * @param ctrlx2 the x coordinate of the second control point - * @param ctrly2 the y coordinate of the second control point - * @param x2 the x coordinate of the end point - * @param y2 the y coordinate of the end point + * @param x1 + * the x coordinate of the starting point. + * @param y1 + * the y coordinate of the starting point. + * @param ctrlx1 + * the x coordinate of the first control point. + * @param ctrly1 + * the y coordinate of the first control point. + * @param ctrlx2 + * the x coordinate of the second control point. + * @param ctrly2 + * the y coordinate of the second control point. + * @param x2 + * the x coordinate of the end point. + * @param y2 + * the y coordinate of the end point. */ public abstract void setCurve(double x1, double y1, double ctrlx1, double ctrly1, double ctrlx2, double ctrly2, double x2, double y2); @@ -542,224 +620,238 @@ public abstract class CubicCurve2D implements Shape, Cloneable { /** * Sets the data of the curve as point objects. * - * @param p1 the starting point - * @param cp1 the first control point - * @param cp2 the second control point - * @param p2 the end point - * - * @throws NullPointerException if any of the points is null. + * @param p1 + * the starting point. + * @param cp1 + * the first control point. + * @param cp2 + * the second control point. + * @param p2 + * the end point. + * @throws NullPointerException + * if any of the points is null. */ public void setCurve(Point2D p1, Point2D cp1, Point2D cp2, Point2D p2) { - setCurve( - p1.getX(), p1.getY(), - cp1.getX(), cp1.getY(), - cp2.getX(), cp2.getY(), - p2.getX(), p2.getY()); + setCurve(p1.getX(), p1.getY(), cp1.getX(), cp1.getY(), cp2.getX(), cp2.getY(), p2.getX(), + p2.getY()); } /** - * Sets the data of the curve by reading the data from an array - * of values. The values are read in the same order as the arguments - * of the method {@link CubicCurve2D#setCurve(double, double, double, double, double, double, double, double)}. - * - * @param coords the array of values containing the new coordinates - * @param offset the offset of the data to read within the array + * Sets the data of the curve by reading the data from an array of values. + * The values are read in the same order as the arguments of the method + * {@link CubicCurve2D#setCurve(double, double, double, double, double, double, double, double)} + * . * - * @throws ArrayIndexOutOfBoundsException if coords.length < offset + 8. - * @throws NullPointerException if the coordinate array is null. + * @param coords + * the array of values containing the new coordinates. + * @param offset + * the offset of the data to read within the array. + * @throws ArrayIndexOutOfBoundsException + * if {@code coords.length} < offset + 8. + * @throws NullPointerException + * if the coordinate array is null. */ public void setCurve(double[] coords, int offset) { - setCurve( - coords[offset + 0], coords[offset + 1], - coords[offset + 2], coords[offset + 3], - coords[offset + 4], coords[offset + 5], - coords[offset + 6], coords[offset + 7]); + setCurve(coords[offset + 0], coords[offset + 1], coords[offset + 2], coords[offset + 3], + coords[offset + 4], coords[offset + 5], coords[offset + 6], coords[offset + 7]); } /** - * Sets the data of the curve by reading the data from an array - * of points. The values are read in the same order as the arguments - * of the method {@link CubicCurve2D#setCurve(Point2D, Point2D, Point2D, Point2D)} + * Sets the data of the curve by reading the data from an array of points. + * The values are read in the same order as the arguments of the method + * {@link CubicCurve2D#setCurve(Point2D, Point2D, Point2D, Point2D)} * - * @param points the array of points containing the new coordinates - * @param offset the offset of the data to read within the array - * - * @throws ArrayIndexOutOfBoundsException if points.length < offset + . - * @throws NullPointerException if the point array is null. + * @param points + * the array of points containing the new coordinates. + * @param offset + * the offset of the data to read within the array. + * @throws ArrayIndexOutOfBoundsException + * if {@code points.length} < offset + . + * @throws NullPointerException + * if the point array is null. */ public void setCurve(Point2D[] points, int offset) { - setCurve( - points[offset + 0].getX(), points[offset + 0].getY(), - points[offset + 1].getX(), points[offset + 1].getY(), - points[offset + 2].getX(), points[offset + 2].getY(), + setCurve(points[offset + 0].getX(), points[offset + 0].getY(), points[offset + 1].getX(), + points[offset + 1].getY(), points[offset + 2].getX(), points[offset + 2].getY(), points[offset + 3].getX(), points[offset + 3].getY()); } /** * Sets the data of the curve by copying it from another CubicCurve2D. * - * @param curve the curve to copy the data points from - * - * @throws NullPointerException if the curve is null. + * @param curve + * the curve to copy the data points from. + * @throws NullPointerException + * if the curve is null. */ public void setCurve(CubicCurve2D curve) { - setCurve( - curve.getX1(), curve.getY1(), - curve.getCtrlX1(), curve.getCtrlY1(), - curve.getCtrlX2(), curve.getCtrlY2(), - curve.getX2(), curve.getY2()); + setCurve(curve.getX1(), curve.getY1(), curve.getCtrlX1(), curve.getCtrlY1(), curve + .getCtrlX2(), curve.getCtrlY2(), curve.getX2(), curve.getY2()); } /** - * Gets the square of the flatness of this curve, where the flatness is the - * maximum distance from the curves control points to the - * line segment connecting the two points. + * Gets the square of the flatness of this curve, where the flatness is the + * maximum distance from the curves control points to the line segment + * connecting the two points. * - * @return the square of the flatness + * @return the square of the flatness. */ public double getFlatnessSq() { - return getFlatnessSq( - getX1(), getY1(), - getCtrlX1(), getCtrlY1(), - getCtrlX2(), getCtrlY2(), + return getFlatnessSq(getX1(), getY1(), getCtrlX1(), getCtrlY1(), getCtrlX2(), getCtrlY2(), getX2(), getY2()); } /** - * Gets the square of the flatness of the cubic curve segment - * defined by the specified values. + * Gets the square of the flatness of the cubic curve segment defined by the + * specified values. * - * @param x1 the x coordinate of the starting point - * @param y1 the y coordinate of the starting point - * @param ctrlx1 the x coordinate of the first control point - * @param ctrly1 the y coordinate of the first control point - * @param ctrlx2 the x coordinate of the second control point - * @param ctrly2 the y coordinate of the second control point - * @param x2 the x coordinate of the end point - * @param y2 the y coordinate of the end point - * - * @return the square of the flatness + * @param x1 + * the x coordinate of the starting point. + * @param y1 + * the y coordinate of the starting point. + * @param ctrlx1 + * the x coordinate of the first control point. + * @param ctrly1 + * the y coordinate of the first control point. + * @param ctrlx2 + * the x coordinate of the second control point. + * @param ctrly2 + * the y coordinate of the second control point. + * @param x2 + * the x coordinate of the end point. + * @param y2 + * the y coordinate of the end point. + * @return the square of the flatness. */ public static double getFlatnessSq(double x1, double y1, double ctrlx1, double ctrly1, - double ctrlx2, double ctrly2, double x2, double y2) - { - return Math.max( - Line2D.ptSegDistSq(x1, y1, x2, y2, ctrlx1, ctrly1), - Line2D.ptSegDistSq(x1, y1, x2, y2, ctrlx2, ctrly2)); + double ctrlx2, double ctrly2, double x2, double y2) { + return Math.max(Line2D.ptSegDistSq(x1, y1, x2, y2, ctrlx1, ctrly1), Line2D.ptSegDistSq(x1, + y1, x2, y2, ctrlx2, ctrly2)); } /** - * Gets the square of the flatness of the cubic curve segment - * defined by the specified values. The values are read in the same order as the arguments - * of the method {@link CubicCurve2D#getFlatnessSq(double, double, double, double, double, double, double, double)}. - * - * @param coords the array of points containing the new coordinates - * @param offset the offset of the data to read within the array + * Gets the square of the flatness of the cubic curve segment defined by the + * specified values. The values are read in the same order as the arguments + * of the method + * {@link CubicCurve2D#getFlatnessSq(double, double, double, double, double, double, double, double)} + * . * - * @return the square of the flatness - * - * @throws ArrayIndexOutOfBoundsException if points.length < offset + . - * @throws NullPointerException if the point array is null. + * @param coords + * the array of points containing the new coordinates. + * @param offset + * the offset of the data to read within the array. + * @return the square of the flatness. + * @throws ArrayIndexOutOfBoundsException + * if points.length < offset + . + * @throws NullPointerException + * if the point array is null. */ public static double getFlatnessSq(double coords[], int offset) { - return getFlatnessSq( - coords[offset + 0], coords[offset + 1], - coords[offset + 2], coords[offset + 3], - coords[offset + 4], coords[offset + 5], - coords[offset + 6], coords[offset + 7]); + return getFlatnessSq(coords[offset + 0], coords[offset + 1], coords[offset + 2], + coords[offset + 3], coords[offset + 4], coords[offset + 5], coords[offset + 6], + coords[offset + 7]); } /** - * Gets the flatness of this curve, where the flatness is the - * maximum distance from the curves control points to the - * line segment connecting the two points. + * Gets the flatness of this curve, where the flatness is the maximum + * distance from the curves control points to the line segment connecting + * the two points. * - * @return the flatness of this curve + * @return the flatness of this curve. */ public double getFlatness() { - return getFlatness( - getX1(), getY1(), - getCtrlX1(), getCtrlY1(), - getCtrlX2(), getCtrlY2(), + return getFlatness(getX1(), getY1(), getCtrlX1(), getCtrlY1(), getCtrlX2(), getCtrlY2(), getX2(), getY2()); } /** - * Gets the flatness of the cubic curve segment - * defined by the specified values. - * - * @param x1 the x coordinate of the starting point - * @param y1 the y coordinate of the starting point - * @param ctrlx1 the x coordinate of the first control point - * @param ctrly1 the y coordinate of the first control point - * @param ctrlx2 the x coordinate of the second control point - * @param ctrly2 the y coordinate of the second control point - * @param x2 the x coordinate of the end point - * @param y2 the y coordinate of the end point + * Gets the flatness of the cubic curve segment defined by the specified + * values. * - * @return the flatness + * @param x1 + * the x coordinate of the starting point. + * @param y1 + * the y coordinate of the starting point. + * @param ctrlx1 + * the x coordinate of the first control point. + * @param ctrly1 + * the y coordinate of the first control point. + * @param ctrlx2 + * the x coordinate of the second control point. + * @param ctrly2 + * the y coordinate of the second control point. + * @param x2 + * the x coordinate of the end point. + * @param y2 + * the y coordinate of the end point. + * @return the flatness. */ public static double getFlatness(double x1, double y1, double ctrlx1, double ctrly1, - double ctrlx2, double ctrly2, double x2, double y2) - { + double ctrlx2, double ctrly2, double x2, double y2) { return Math.sqrt(getFlatnessSq(x1, y1, ctrlx1, ctrly1, ctrlx2, ctrly2, x2, y2)); } /** - * Gets the flatness of the cubic curve segment - * defined by the specified values. The values are read in the same order as the arguments - * of the method {@link CubicCurve2D#getFlatness(double, double, double, double, double, double, double, double)}. + * Gets the flatness of the cubic curve segment defined by the specified + * values. The values are read in the same order as the arguments of the + * method + * {@link CubicCurve2D#getFlatness(double, double, double, double, double, double, double, double)} + * . * - * @param coords the array of points containing the new coordinates - * @param offset the offset of the data to read within the array - * - * @return the flatness - * - * @throws ArrayIndexOutOfBoundsException if points.length < offset + . - * @throws NullPointerException if the point array is null. + * @param coords + * the array of points containing the new coordinates. + * @param offset + * the offset of the data to read within the array. + * @return the flatness. + * @throws ArrayIndexOutOfBoundsException + * if points.length < offset + . + * @throws NullPointerException + * if the point array is null. */ public static double getFlatness(double coords[], int offset) { - return getFlatness( - coords[offset + 0], coords[offset + 1], - coords[offset + 2], coords[offset + 3], - coords[offset + 4], coords[offset + 5], - coords[offset + 6], coords[offset + 7]); + return getFlatness(coords[offset + 0], coords[offset + 1], coords[offset + 2], + coords[offset + 3], coords[offset + 4], coords[offset + 5], coords[offset + 6], + coords[offset + 7]); } /** - * Creates the data for two cubic curves by dividing this - * curve in two. The division point is the point on the curve - * that is closest to the average of curve's two control points. - * The two new control points (nearest the new endpoint) are computed - * by averaging the original control points with the new endpoint. - * The data of this curve is left unchanged. - * - * @param left the CubicCurve2D where the left (start) segment's - * data is written - * @param right the CubicCurve2D where the right (end) segment's - * data is written + * Creates the data for two cubic curves by dividing this curve in two. The + * division point is the point on the curve that is closest to the average + * of curve's two control points. The two new control points (nearest the + * new endpoint) are computed by averaging the original control points with + * the new endpoint. The data of this curve is left unchanged. * - * @throws NullPointerException if either curve is null. + * @param left + * the CubicCurve2D where the left (start) segment's data is + * written. + * @param right + * the CubicCurve2D where the right (end) segment's data is + * written. + * @throws NullPointerException + * if either curve is null. */ public void subdivide(CubicCurve2D left, CubicCurve2D right) { subdivide(this, left, right); } /** - * Creates the data for two cubic curves by dividing the specified - * curve in two. The division point is the point on the curve - * that is closest to the average of curve's two control points. - * The two new control points (nearest the new endpoint) are computed - * by averaging the original control points with the new endpoint. - * The data of the source curve is left unchanged. + * Creates the data for two cubic curves by dividing the specified curve in + * two. The division point is the point on the curve that is closest to the + * average of curve's two control points. The two new control points + * (nearest the new endpoint) are computed by averaging the original control + * points with the new endpoint. The data of the source curve is left + * unchanged. * - * @param src the original curve to be divided in two - * @param left the CubicCurve2D where the left (start) segment's - * data is written - * @param right the CubicCurve2D where the right (end) segment's - * data is written - * - * @throws NullPointerException if either curve is null. + * @param src + * the original curve to be divided in two. + * @param left + * the CubicCurve2D where the left (start) segment's data is + * written. + * @param right + * the CubicCurve2D where the right (end) segment's data is + * written. + * @throws NullPointerException + * if either curve is null. */ public static void subdivide(CubicCurve2D src, CubicCurve2D left, CubicCurve2D right) { double x1 = src.getX1(); @@ -791,27 +883,36 @@ public abstract class CubicCurve2D implements Shape, Cloneable { } /** - * Creates the data for two cubic curves by dividing the specified - * curve in two. The division point is the point on the curve - * that is closest to the average of curve's two control points. - * The two new control points (nearest the new endpoint) are computed - * by averaging the original control points with the new endpoint. - * The data of the source curve is left unchanged. The data for the - * three curves is read/written in the usual order: { x1, y1, - * ctrlx1, ctrly1, ctrlx2, crtry2, x2, y3 } - * - * @param src the array that gives the data values for the source curve - * @param srcOff the offset in the src array to read the values from - * @param left the array where the coordinates of the start curve should be written - * @param leftOff the offset in the left array to start writing the values - * @param right the array where the coordinates of the end curve should be written - * @param rightOff the offset in the right array to start writing the values + * Creates the data for two cubic curves by dividing the specified curve in + * two. The division point is the point on the curve that is closest to the + * average of curve's two control points. The two new control points + * (nearest the new endpoint) are computed by averaging the original control + * points with the new endpoint. The data of the source curve is left + * unchanged. The data for the three curves is read/written in the usual + * order: { x1, y1, ctrlx1, ctrly1, ctrlx2, crtry2, x2, y3 } * - * @throws ArrayIndexOutOfBoundsException if src.length < srcoff + 8 - * or if left.length < leftOff + 8 or if right.length < rightOff + 8. - * @throws NullPointerException if one of the arrays is null. + * @param src + * the array that gives the data values for the source curve. + * @param srcOff + * the offset in the src array to read the values from. + * @param left + * the array where the coordinates of the start curve should be + * written. + * @param leftOff + * the offset in the left array to start writing the values. + * @param right + * the array where the coordinates of the end curve should be + * written. + * @param rightOff + * the offset in the right array to start writing the values. + * @throws ArrayIndexOutOfBoundsException + * if src.length < srcoff + 8 or if left.length < leftOff + 8 or + * if right.length < rightOff + 8. + * @throws NullPointerException + * if one of the arrays is null. */ - public static void subdivide(double src[], int srcOff, double left[], int leftOff, double right[], int rightOff) { + public static void subdivide(double src[], int srcOff, double left[], int leftOff, + double right[], int rightOff) { double x1 = src[srcOff + 0]; double y1 = src[srcOff + 1]; double cx1 = src[srcOff + 2]; @@ -855,42 +956,43 @@ public abstract class CubicCurve2D implements Shape, Cloneable { } /** - * Finds the roots of the cubic polynomial. This is - * accomplished by finding the (real) values of x that solve - * the following equation: eqn[3]*x*x*x + eqn[2]*x*x + eqn[1]*x + eqn[0] = 0. - * The solutions are written back into the array eqn starting - * from the index 0 in the array. The return value tells how - * many array elements have been changed by this method call. + * Finds the roots of the cubic polynomial. This is accomplished by finding + * the (real) values of x that solve the following equation: eqn[3]*x*x*x + + * eqn[2]*x*x + eqn[1]*x + eqn[0] = 0. The solutions are written back into + * the array eqn starting from the index 0 in the array. The return value + * tells how many array elements have been changed by this method call. * - * @param eqn an array containing the coefficients of the - * cubic polynomial to solve. - * - * @return the number of roots of the cubic polynomial - * - * @throws ArrayIndexOutOfBoundsException if eqn.length < 4. - * @throws NullPointerException if the array is null. + * @param eqn + * an array containing the coefficients of the cubic polynomial + * to solve. + * @return the number of roots of the cubic polynomial. + * @throws ArrayIndexOutOfBoundsException + * if eqn.length < 4. + * @throws NullPointerException + * if the array is null. */ public static int solveCubic(double eqn[]) { return solveCubic(eqn, eqn); } /** - * Finds the roots of the cubic polynomial. This is - * accomplished by finding the (real) values of x that solve - * the following equation: eqn[3]*x*x*x + eqn[2]*x*x + eqn[1]*x + eqn[0] = 0. - * The solutions are written into the array res starting - * from the index 0 in the array. The return value tells how - * many array elements have been changed by this method call. - * - * @param eqn an array containing the coefficients of the - * cubic polynomial to solve. - * @param res the array that this method writes the results into - * - * @return the number of roots of the cubic polynomial + * Finds the roots of the cubic polynomial. This is accomplished by finding + * the (real) values of x that solve the following equation: eqn[3]*x*x*x + + * eqn[2]*x*x + eqn[1]*x + eqn[0] = 0. The solutions are written into the + * array res starting from the index 0 in the array. The return value tells + * how many array elements have been changed by this method call. * - * @throws ArrayIndexOutOfBoundsException if eqn.length < 4 or - * if res.length is less than the number of roots. - * @throws NullPointerException if either array is null. + * @param eqn + * an array containing the coefficients of the cubic polynomial + * to solve. + * @param res + * the array that this method writes the results into. + * @return the number of roots of the cubic polynomial. + * @throws ArrayIndexOutOfBoundsException + * if eqn.length < 4 or if res.length is less than the number of + * roots. + * @throws NullPointerException + * if either array is null. */ public static int solveCubic(double eqn[], double res[]) { return Crossing.solveCubic(eqn, res); diff --git a/awt/java/awt/geom/Dimension2D.java b/awt/java/awt/geom/Dimension2D.java index eef63e67c34ed..ea081c517c2b4 100644 --- a/awt/java/awt/geom/Dimension2D.java +++ b/awt/java/awt/geom/Dimension2D.java @@ -18,12 +18,15 @@ * @author Denis M. Kishenko * @version $Revision$ */ + package java.awt.geom; /** - * The Class Dimension2D represents a size (width and height) of a - * geometric object. It stores double-valued data in order to be compatible - * with high-precision geometric operations. + * The Class Dimension2D represents a size (width and height) of a geometric + * object. It stores double-valued data in order to be compatible with + * high-precision geometric operations. + * + * @since Android 1.0 */ public abstract class Dimension2D implements Cloneable { @@ -36,31 +39,34 @@ public abstract class Dimension2D implements Cloneable { /** * Gets the width. * - * @return the width + * @return the width. */ public abstract double getWidth(); /** * Gets the height. * - * @return the height + * @return the height. */ public abstract double getHeight(); /** * Sets the width and height. * - * @param width the width - * @param height the height + * @param width + * the width. + * @param height + * the height. */ public abstract void setSize(double width, double height); /** - * Sets the width and height based on the data of another - * Dimension2D object. + * Sets the width and height based on the data of another Dimension2D + * object. * - * @param d the Dimension2D object providing the data to copy - * into this Dimension2D object + * @param d + * the Dimension2D object providing the data to copy into this + * Dimension2D object. */ public void setSize(Dimension2D d) { setSize(d.getWidth(), d.getHeight()); @@ -75,4 +81,3 @@ public abstract class Dimension2D implements Cloneable { } } } - diff --git a/awt/java/awt/geom/Ellipse2D.java b/awt/java/awt/geom/Ellipse2D.java index 33464afe74c0a..89fd0d06617da 100644 --- a/awt/java/awt/geom/Ellipse2D.java +++ b/awt/java/awt/geom/Ellipse2D.java @@ -18,6 +18,7 @@ * @author Denis M. Kishenko * @version $Revision$ */ + package java.awt.geom; import java.util.NoSuchElementException; @@ -25,29 +26,41 @@ import java.util.NoSuchElementException; import org.apache.harmony.awt.internal.nls.Messages; /** - * The Class Ellipse2D describes an ellipse defined by a rectangular - * area in which it is inscribed. + * The Class Ellipse2D describes an ellipse defined by a rectangular area in + * which it is inscribed. + * + * @since Android 1.0 */ public abstract class Ellipse2D extends RectangularShape { /** - * The Class Float is the subclass of Ellipse2D that has all - * of its data values stored with float-level precision. + * The Class Float is the subclass of Ellipse2D that has all of its data + * values stored with float-level precision. + * + * @since Android 1.0 */ public static class Float extends Ellipse2D { - /** The x coordinate of the upper left corner of the ellipse's - * bounding rectangle. */ + /** + * The x coordinate of the upper left corner of the ellipse's bounding + * rectangle. + */ public float x; - - /** The y coordinate of the upper left corner of the ellipse's - * bounding rectangle. */ + + /** + * The y coordinate of the upper left corner of the ellipse's bounding + * rectangle. + */ public float y; - - /** The width of the ellipse's bounding rectangle. */ + + /** + * The width of the ellipse's bounding rectangle. + */ public float width; - - /** The height of the ellipse's bounding rectangle. */ + + /** + * The height of the ellipse's bounding rectangle. + */ public float height; /** @@ -59,12 +72,16 @@ public abstract class Ellipse2D extends RectangularShape { /** * Instantiates a new float-valued Ellipse2D with the specified data. * - * @param x the x coordinate of the upper left corner of the ellipse's - * bounding rectangle - * @param y the y coordinate of the upper left corner of the ellipse's - * bounding rectangle - * @param width the width of the ellipse's bounding rectangle - * @param height the height of the ellipse's bounding rectangle + * @param x + * the x coordinate of the upper left corner of the ellipse's + * bounding rectangle. + * @param y + * the y coordinate of the upper left corner of the ellipse's + * bounding rectangle. + * @param width + * the width of the ellipse's bounding rectangle. + * @param height + * the height of the ellipse's bounding rectangle. */ public Float(float x, float y, float width, float height) { setFrame(x, y, width, height); @@ -98,12 +115,16 @@ public abstract class Ellipse2D extends RectangularShape { /** * Sets the data of the ellipse's bounding rectangle. * - * @param x the x coordinate of the upper left corner of the ellipse's - * bounding rectangle - * @param y the y coordinate of the upper left corner of the ellipse's - * bounding rectangle - * @param width the width of the ellipse's bounding rectangle - * @param height the height of the ellipse's bounding rectangle + * @param x + * the x coordinate of the upper left corner of the ellipse's + * bounding rectangle. + * @param y + * the y coordinate of the upper left corner of the ellipse's + * bounding rectangle. + * @param width + * the width of the ellipse's bounding rectangle. + * @param height + * the height of the ellipse's bounding rectangle. */ public void setFrame(float x, float y, float width, float height) { this.x = x; @@ -126,23 +147,33 @@ public abstract class Ellipse2D extends RectangularShape { } /** - * The Class Double is the subclass of Ellipse2D that has all - * of its data values stored with double-level precision. + * The Class Double is the subclass of Ellipse2D that has all of its data + * values stored with double-level precision. + * + * @since Android 1.0 */ public static class Double extends Ellipse2D { - /** The x coordinate of the upper left corner of the ellipse's - * bounding rectangle. */ + /** + * The x coordinate of the upper left corner of the ellipse's bounding + * rectangle. + */ public double x; - - /** The y coordinate of the upper left corner of the ellipse's - * bounding rectangle. */ + + /** + * The y coordinate of the upper left corner of the ellipse's bounding + * rectangle. + */ public double y; - - /** The width of the ellipse's bounding rectangle. */ + + /** + * The width of the ellipse's bounding rectangle. + */ public double width; - - /** The height of the ellipse's bounding rectangle. */ + + /** + * The height of the ellipse's bounding rectangle. + */ public double height; /** @@ -152,15 +183,18 @@ public abstract class Ellipse2D extends RectangularShape { } /** - * Instantiates a new double-valued Ellipse2D with the specified - * data. + * Instantiates a new double-valued Ellipse2D with the specified data. * - * @param x the x coordinate of the upper left corner of the ellipse's - * bounding rectangle - * @param y the y coordinate of the upper left corner of the ellipse's - * bounding rectangle - * @param width the width of the ellipse's bounding rectangle - * @param height the height of the ellipse's bounding rectangle + * @param x + * the x coordinate of the upper left corner of the ellipse's + * bounding rectangle. + * @param y + * the y coordinate of the upper left corner of the ellipse's + * bounding rectangle. + * @param width + * the width of the ellipse's bounding rectangle. + * @param height + * the height of the ellipse's bounding rectangle. */ public Double(double x, double y, double width, double height) { setFrame(x, y, width, height); @@ -205,7 +239,7 @@ public abstract class Ellipse2D extends RectangularShape { } /* - * Ellipse2D path iterator + * Ellipse2D path iterator */ /** * The subclass of PathIterator to traverse an Ellipse2D. @@ -213,46 +247,72 @@ public abstract class Ellipse2D extends RectangularShape { class Iterator implements PathIterator { /* - * Ellipse is subdivided into four quarters by x and y axis. Each part approximated by - * cubic Bezier curve. Arc in first quarter is started in (a, 0) and finished in (0, b) points. - * Control points for cubic curve wiil be (a, 0), (a, m), (n, b) and (0, b) where n and m are - * calculated based on requirement Bezier curve in point 0.5 should lay on the arc. + * Ellipse is subdivided into four quarters by x and y axis. Each part + * approximated by cubic Bezier curve. Arc in first quarter is started + * in (a, 0) and finished in (0, b) points. Control points for cubic + * curve wiil be (a, 0), (a, m), (n, b) and (0, b) where n and m are + * calculated based on requirement Bezier curve in point 0.5 should lay + * on the arc. */ - /** The coefficient to calculate control points of Bezier curves. */ + /** + * The coefficient to calculate control points of Bezier curves. + */ final double u = 2.0 / 3.0 * (Math.sqrt(2.0) - 1.0); - /** The points coordinates calculation table. */ + /** + * The points coordinates calculation table. + */ final double points[][] = { - { 1.0, 0.5 + u, 0.5 + u, 1.0, 0.5, 1.0 }, - { 0.5 - u, 1.0, 0.0, 0.5 + u, 0.0, 0.5 }, - { 0.0, 0.5 - u, 0.5 - u, 0.0, 0.5, 0.0 }, - { 0.5 + u, 0.0, 1.0, 0.5 - u, 1.0, 0.5 } + { + 1.0, 0.5 + u, 0.5 + u, 1.0, 0.5, 1.0 + }, { + 0.5 - u, 1.0, 0.0, 0.5 + u, 0.0, 0.5 + }, { + 0.0, 0.5 - u, 0.5 - u, 0.0, 0.5, 0.0 + }, { + 0.5 + u, 0.0, 1.0, 0.5 - u, 1.0, 0.5 + } }; - /** The x coordinate of left-upper corner of the ellipse bounds. */ + /** + * The x coordinate of left-upper corner of the ellipse bounds. + */ double x; - - /** The y coordinate of left-upper corner of the ellipse bounds. */ + + /** + * The y coordinate of left-upper corner of the ellipse bounds. + */ double y; - - /** The width of the ellipse bounds. */ + + /** + * The width of the ellipse bounds. + */ double width; - - /** The height of the ellipse bounds. */ + + /** + * The height of the ellipse bounds. + */ double height; - /** The path iterator transformation. */ + /** + * The path iterator transformation. + */ AffineTransform t; - /** The current segmenet index. */ + /** + * The current segment index. + */ int index; /** - * Constructs a new Ellipse2D.Iterator for given ellipse and transformation + * Constructs a new Ellipse2D.Iterator for given ellipse and + * transformation * - * @param e - the source Ellipse2D object - * @param t the t + * @param e + * the source Ellipse2D object. + * @param t + * the affine transformation object. */ Iterator(Ellipse2D e, AffineTransform t) { this.x = e.getX(); @@ -389,15 +449,10 @@ public abstract class Ellipse2D extends RectangularShape { double rx2 = rx + rw; double ry2 = ry + rh; - return - contains(rx1, ry1) && - contains(rx2, ry1) && - contains(rx2, ry2) && - contains(rx1, ry2); + return contains(rx1, ry1) && contains(rx2, ry1) && contains(rx2, ry2) && contains(rx1, ry2); } public PathIterator getPathIterator(AffineTransform at) { return new Iterator(this, at); } } - diff --git a/awt/java/awt/geom/FlatteningPathIterator.java b/awt/java/awt/geom/FlatteningPathIterator.java index ca5c7c2f9bf48..8208f39635f8c 100644 --- a/awt/java/awt/geom/FlatteningPathIterator.java +++ b/awt/java/awt/geom/FlatteningPathIterator.java @@ -18,6 +18,7 @@ * @author Denis M. Kishenko * @version $Revision$ */ + package java.awt.geom; import java.util.NoSuchElementException; @@ -25,104 +26,139 @@ import java.util.NoSuchElementException; import org.apache.harmony.awt.internal.nls.Messages; /** - * The Class FlatteningPathIterator takes a PathIterator for traversing - * a curved shape and flattens it by estimating the curve as a series - * of line segments. The flattening factor indicates how far the - * estimating line segments are allowed to be from the actual curve: - * the FlatteningPathIterator will keep dividing each curved segment - * into smaller and smaller flat segments until either the segments - * are withing the flattening factor of the curve or until the buffer - * limit is reached. + * The Class FlatteningPathIterator takes a PathIterator for traversing a curved + * shape and flattens it by estimating the curve as a series of line segments. + * The flattening factor indicates how far the estimating line segments are + * allowed to be from the actual curve: the FlatteningPathIterator will keep + * dividing each curved segment into smaller and smaller flat segments until + * either the segments are within the flattening factor of the curve or until + * the buffer limit is reached. + * + * @since Android 1.0 */ public class FlatteningPathIterator implements PathIterator { - /** The default points buffer size. */ + /** + * The default points buffer size. + */ private static final int BUFFER_SIZE = 16; - - /** The default curve subdivision limit. */ + + /** + * The default curve subdivision limit. + */ private static final int BUFFER_LIMIT = 16; - /** The points buffer capacity. */ + /** + * The points buffer capacity. + */ private static final int BUFFER_CAPACITY = 16; - - /** The type of current segment to be flat. */ + + /** + * The type of current segment to be flat. + */ int bufType; - - /** The curve subdivision limit. */ + + /** + * The curve subdivision limit. + */ int bufLimit; - - /** The current points buffer size. */ + + /** + * The current points buffer size. + */ int bufSize; - - /** The inner cursor position in points buffer. */ + + /** + * The inner cursor position in points buffer. + */ int bufIndex; - - /** The current subdivision count. */ + + /** + * The current subdivision count. + */ int bufSubdiv; - /** The points buffer. */ + /** + * The points buffer. + */ double buf[]; - - /** The indicator of empty points buffer. */ + + /** + * The indicator of empty points buffer. + */ boolean bufEmpty = true; - - /** The source PathIterator. */ + + /** + * The source PathIterator. + */ PathIterator p; - - /** The flatness of new path. */ + + /** + * The flatness of new path. + */ double flatness; - - /** The square of flatness. */ + + /** + * The square of flatness. + */ double flatness2; - - /** The x coordinate of previous path segment. */ + + /** + * The x coordinate of previous path segment. + */ double px; - /** The y coordinate of previous path segment. */ + /** + * The y coordinate of previous path segment. + */ double py; - - /** The tamporary buffer for getting points from PathIterator. */ + + /** + * The temporary buffer for getting points from PathIterator. + */ double coords[] = new double[6]; /** - * Instantiates a new flattening path iterator given the path - * iterator for a (possibly) curved path and a flattening factor - * which indicates how close together the points on the curve - * should be chosen. The buffer limit defaults to 16 which means - * that each curve will be divided into no more than 16 segments - * regardless of the flattening factor. - * - * @param path the path iterator of the original curve - * @param flatness the flattening factor that indicates how far the - * flat path is allowed to be from the actual curve in order to - * decide when to stop dividing the path into smaller and smaller - * segments. + * Instantiates a new flattening path iterator given the path iterator for a + * (possibly) curved path and a flattening factor which indicates how close + * together the points on the curve should be chosen. The buffer limit + * defaults to 16 which means that each curve will be divided into no more + * than 16 segments regardless of the flattening factor. * - * @throws IllegalArgumentException if the flatness is less than zero. - * @throws NullPointerException if the path is null. + * @param path + * the path iterator of the original curve. + * @param flatness + * the flattening factor that indicates how far the flat path is + * allowed to be from the actual curve in order to decide when to + * stop dividing the path into smaller and smaller segments. + * @throws IllegalArgumentException + * if the flatness is less than zero. + * @throws NullPointerException + * if the path is null. */ public FlatteningPathIterator(PathIterator path, double flatness) { this(path, flatness, BUFFER_LIMIT); } /** - * Instantiates a new flattening path iterator given the path - * iterator for a (possibly) curved path and a flattening factor - * and a buffer limit. The FlatteningPathIterator will keep - * dividing each curved segment into smaller and smaller flat segments - * until either the segments are withing the flattening factor of the - * curve or until the buffer limit is reached. + * Instantiates a new flattening path iterator given the path iterator for a + * (possibly) curved path and a flattening factor and a buffer limit. The + * FlatteningPathIterator will keep dividing each curved segment into + * smaller and smaller flat segments until either the segments are within + * the flattening factor of the curve or until the buffer limit is reached. * - * @param path the path iterator of the original curve - * @param flatness the flattening factor that indicates how far the - * flat path is allowed to be from the actual curve in order to - * decide when to stop dividing the path into smaller and smaller - * segments. - * @param limit the maximum number of flat segments to divide each - * curve into - * - * @throws IllegalArgumentException if the flatness or limit is less than zero. - * @throws NullPointerException if the path is null. + * @param path + * the path iterator of the original curve. + * @param flatness + * the flattening factor that indicates how far the flat path is + * allowed to be from the actual curve in order to decide when to + * stop dividing the path into smaller and smaller segments. + * @param limit + * the maximum number of flat segments to divide each curve into. + * @throws IllegalArgumentException + * if the flatness or limit is less than zero. + * @throws NullPointerException + * if the path is null. */ public FlatteningPathIterator(PathIterator path, double flatness, int limit) { if (flatness < 0.0) { @@ -149,7 +185,7 @@ public class FlatteningPathIterator implements PathIterator { /** * Gets the flattening factor. * - * @return the flattening factor + * @return the flattening factor. */ public double getFlatness() { return flatness; @@ -158,7 +194,7 @@ public class FlatteningPathIterator implements PathIterator { /** * Gets the maximum number of subdivisions per curved segment. * - * @return the maximum number of subdivisions per curved segment + * @return the maximum number of subdivisions per curved segment. */ public int getRecursionLimit() { return bufLimit; @@ -173,12 +209,13 @@ public class FlatteningPathIterator implements PathIterator { } /** - * Calculates flat path points for current segment of the source shape. - * - * Line segment is flat by itself. Flatness of quad and cubic curves evaluated by getFlatnessSq() method. - * Curves subdivided until current flatness is bigger than user defined and subdivision limit isn't exhausted. - * Single source segment translated to series of buffer points. The less flatness the bigger serries. - * Every currentSegment() call extract one point from the buffer. When series completed evaluate() takes next source shape segment. + * Calculates flat path points for current segment of the source shape. Line + * segment is flat by itself. Flatness of quad and cubic curves evaluated by + * getFlatnessSq() method. Curves subdivided until current flatness is + * bigger than user defined and subdivision limit isn't exhausted. Single + * source segment translated to series of buffer points. The less flatness + * the bigger series. Every currentSegment() call extract one point from the + * buffer. When series completed evaluate() takes next source shape segment. */ void evaluate() { if (bufEmpty) { @@ -186,99 +223,95 @@ public class FlatteningPathIterator implements PathIterator { } switch (bufType) { - case SEG_MOVETO: - case SEG_LINETO: - px = coords[0]; - py = coords[1]; - break; - case SEG_QUADTO: - if (bufEmpty) { - bufIndex -= 6; - buf[bufIndex + 0] = px; - buf[bufIndex + 1] = py; - System.arraycopy(coords, 0, buf, bufIndex + 2, 4); - bufSubdiv = 0; - } - - while (bufSubdiv < bufLimit) { - if (QuadCurve2D.getFlatnessSq(buf, bufIndex) < flatness2) { - break; + case SEG_MOVETO: + case SEG_LINETO: + px = coords[0]; + py = coords[1]; + break; + case SEG_QUADTO: + if (bufEmpty) { + bufIndex -= 6; + buf[bufIndex + 0] = px; + buf[bufIndex + 1] = py; + System.arraycopy(coords, 0, buf, bufIndex + 2, 4); + bufSubdiv = 0; } - // Realloc buffer - if (bufIndex <= 4) { - double tmp[] = new double[bufSize + BUFFER_CAPACITY]; - System.arraycopy( - buf, bufIndex, - tmp, bufIndex + BUFFER_CAPACITY, - bufSize - bufIndex); - buf = tmp; - bufSize += BUFFER_CAPACITY; - bufIndex += BUFFER_CAPACITY; + while (bufSubdiv < bufLimit) { + if (QuadCurve2D.getFlatnessSq(buf, bufIndex) < flatness2) { + break; + } + + // Realloc buffer + if (bufIndex <= 4) { + double tmp[] = new double[bufSize + BUFFER_CAPACITY]; + System.arraycopy(buf, bufIndex, tmp, bufIndex + BUFFER_CAPACITY, bufSize + - bufIndex); + buf = tmp; + bufSize += BUFFER_CAPACITY; + bufIndex += BUFFER_CAPACITY; + } + + QuadCurve2D.subdivide(buf, bufIndex, buf, bufIndex - 4, buf, bufIndex); + + bufIndex -= 4; + bufSubdiv++; } - QuadCurve2D.subdivide(buf, bufIndex, buf, bufIndex - 4, buf, bufIndex); - - bufIndex -= 4; - bufSubdiv++; - } - - bufIndex += 4; - px = buf[bufIndex]; - py = buf[bufIndex + 1]; - - bufEmpty = (bufIndex == bufSize - 2); - if (bufEmpty) { - bufIndex = bufSize; - bufType = SEG_LINETO; - } else { - bufSubdiv--; - } - break; - case SEG_CUBICTO: - if (bufEmpty) { - bufIndex -= 8; - buf[bufIndex + 0] = px; - buf[bufIndex + 1] = py; - System.arraycopy(coords, 0, buf, bufIndex + 2, 6); - bufSubdiv = 0; - } + bufIndex += 4; + px = buf[bufIndex]; + py = buf[bufIndex + 1]; - while (bufSubdiv < bufLimit) { - if (CubicCurve2D.getFlatnessSq(buf, bufIndex) < flatness2) { - break; + bufEmpty = (bufIndex == bufSize - 2); + if (bufEmpty) { + bufIndex = bufSize; + bufType = SEG_LINETO; + } else { + bufSubdiv--; } - - // Realloc buffer - if (bufIndex <= 6) { - double tmp[] = new double[bufSize + BUFFER_CAPACITY]; - System.arraycopy( - buf, bufIndex, - tmp, bufIndex + BUFFER_CAPACITY, - bufSize - bufIndex); - buf = tmp; - bufSize += BUFFER_CAPACITY; - bufIndex += BUFFER_CAPACITY; + break; + case SEG_CUBICTO: + if (bufEmpty) { + bufIndex -= 8; + buf[bufIndex + 0] = px; + buf[bufIndex + 1] = py; + System.arraycopy(coords, 0, buf, bufIndex + 2, 6); + bufSubdiv = 0; } - CubicCurve2D.subdivide(buf, bufIndex, buf, bufIndex - 6, buf, bufIndex); - - bufIndex -= 6; - bufSubdiv++; - } + while (bufSubdiv < bufLimit) { + if (CubicCurve2D.getFlatnessSq(buf, bufIndex) < flatness2) { + break; + } + + // Realloc buffer + if (bufIndex <= 6) { + double tmp[] = new double[bufSize + BUFFER_CAPACITY]; + System.arraycopy(buf, bufIndex, tmp, bufIndex + BUFFER_CAPACITY, bufSize + - bufIndex); + buf = tmp; + bufSize += BUFFER_CAPACITY; + bufIndex += BUFFER_CAPACITY; + } + + CubicCurve2D.subdivide(buf, bufIndex, buf, bufIndex - 6, buf, bufIndex); + + bufIndex -= 6; + bufSubdiv++; + } - bufIndex += 6; - px = buf[bufIndex]; - py = buf[bufIndex + 1]; + bufIndex += 6; + px = buf[bufIndex]; + py = buf[bufIndex + 1]; - bufEmpty = (bufIndex == bufSize - 2); - if (bufEmpty) { - bufIndex = bufSize; - bufType = SEG_LINETO; - } else { - bufSubdiv--; - } - break; + bufEmpty = (bufIndex == bufSize - 2); + if (bufEmpty) { + bufIndex = bufSize; + bufType = SEG_LINETO; + } else { + bufSubdiv--; + } + break; } } @@ -323,4 +356,3 @@ public class FlatteningPathIterator implements PathIterator { return type; } } - diff --git a/awt/java/awt/geom/GeneralPath.java b/awt/java/awt/geom/GeneralPath.java index 36b01c40a005e..0669bc77b0064 100644 --- a/awt/java/awt/geom/GeneralPath.java +++ b/awt/java/awt/geom/GeneralPath.java @@ -18,6 +18,7 @@ * @author Denis M. Kishenko * @version $Revision$ */ + package java.awt.geom; import java.awt.Rectangle; @@ -28,81 +29,116 @@ import org.apache.harmony.awt.gl.Crossing; import org.apache.harmony.awt.internal.nls.Messages; /** - * The Class GeneralPath represents a shape whose outline is given - * by different types of curved and straight segments. + * The class GeneralPath represents a shape whose outline is given by different + * types of curved and straight segments. + * + * @since Android 1.0 */ public final class GeneralPath implements Shape, Cloneable { - /** The Constant WIND_EVEN_ODD see {@link PathIterator#WIND_EVEN_ODD}. */ + /** + * The Constant WIND_EVEN_ODD see {@link PathIterator#WIND_EVEN_ODD}. + */ public static final int WIND_EVEN_ODD = PathIterator.WIND_EVEN_ODD; - - /** The Constant WIND_NON_ZERO see {@link PathIterator#WIND_NON_ZERO}. */ + + /** + * The Constant WIND_NON_ZERO see {@link PathIterator#WIND_NON_ZERO}. + */ public static final int WIND_NON_ZERO = PathIterator.WIND_NON_ZERO; - /** The buffers size. */ + /** + * The buffers size. + */ private static final int BUFFER_SIZE = 10; - - /** The buffers capacity. */ + + /** + * The buffers capacity. + */ private static final int BUFFER_CAPACITY = 10; - /** The point's types buffer. */ + /** + * The point's types buffer. + */ byte[] types; - - /** The points buffer. */ + + /** + * The points buffer. + */ float[] points; - - /** The point's type buffer size. */ + + /** + * The point's type buffer size. + */ int typeSize; - - /** The points buffer size. */ + + /** + * The points buffer size. + */ int pointSize; - - /** The path rule. */ + + /** + * The path rule. + */ int rule; - /** The space amount in points buffer for different segmenet's types. */ + /** + * The space amount in points buffer for different segmenet's types. + */ static int pointShift[] = { - 2, // MOVETO - 2, // LINETO - 4, // QUADTO - 6, // CUBICTO - 0}; // CLOSE + 2, // MOVETO + 2, // LINETO + 4, // QUADTO + 6, // CUBICTO + 0 + }; // CLOSE /* - * GeneralPath path iterator + * GeneralPath path iterator */ /** - * The Class Iterator is the subclass of Iterator for traversing the - * outline of a GeneralPath. + * The Class Iterator is the subclass of Iterator for traversing the outline + * of a GeneralPath. */ class Iterator implements PathIterator { - /** The current cursor position in types buffer. */ + /** + * The current cursor position in types buffer. + */ int typeIndex; - - /** The current cursor position in points buffer. */ + + /** + * The current cursor position in points buffer. + */ int pointIndex; - - /** The source GeneralPath object. */ + + /** + * The source GeneralPath object. + */ GeneralPath p; - - /** The path iterator transformation. */ + + /** + * The path iterator transformation. + */ AffineTransform t; /** - * Constructs a new GeneralPath.Iterator for given general path + * Constructs a new GeneralPath.Iterator for given general path. * - * @param path - the source GeneralPath object + * @param path + * the source GeneralPath object. */ Iterator(GeneralPath path) { this(path, null); } /** - * Constructs a new GeneralPath.Iterator for given general path and transformation + * Constructs a new GeneralPath.Iterator for given general path and + * transformation. * - * @param path - the source GeneralPath object - * @param at - the AffineTransform object to apply rectangle path + * @param path + * the source GeneralPath object. + * @param at + * the AffineTransform object to apply rectangle path. */ Iterator(GeneralPath path, AffineTransform at) { this.p = path; @@ -156,33 +192,35 @@ public final class GeneralPath implements Shape, Cloneable { } /** - * Instantiates a new general path with the winding rule set - * to {@link PathIterator#WIND_NON_ZERO} and the initial capacity - * (number of segments) set to the default value 10. + * Instantiates a new general path with the winding rule set to + * {@link PathIterator#WIND_NON_ZERO} and the initial capacity (number of + * segments) set to the default value 10. */ public GeneralPath() { this(WIND_NON_ZERO, BUFFER_SIZE); } /** - * Instantiates a new general path with the given winding rule - * and the initial capacity (number of segments) set to the - * default value 10. + * Instantiates a new general path with the given winding rule and the + * initial capacity (number of segments) set to the default value 10. * - * @param rule the winding rule, either {@link PathIterator#WIND_EVEN_ODD} - * or {@link PathIterator#WIND_NON_ZERO} + * @param rule + * the winding rule, either {@link PathIterator#WIND_EVEN_ODD} or + * {@link PathIterator#WIND_NON_ZERO}. */ public GeneralPath(int rule) { this(rule, BUFFER_SIZE); } /** - * Instantiates a new general path with the given winding rule - * and initial capacity (number of segments). + * Instantiates a new general path with the given winding rule and initial + * capacity (number of segments). * - * @param rule the winding rule, either {@link PathIterator#WIND_EVEN_ODD} - * or {@link PathIterator#WIND_NON_ZERO} - * @param initialCapacity the number of segments the path is set to hold + * @param rule + * the winding rule, either {@link PathIterator#WIND_EVEN_ODD} or + * {@link PathIterator#WIND_NON_ZERO}. + * @param initialCapacity + * the number of segments the path is set to hold. */ public GeneralPath(int rule, int initialCapacity) { setWindingRule(rule); @@ -193,7 +231,8 @@ public final class GeneralPath implements Shape, Cloneable { /** * Creates a new GeneralPath from the outline of the given shape. * - * @param shape the shape + * @param shape + * the shape. */ public GeneralPath(Shape shape) { this(WIND_NON_ZERO, BUFFER_SIZE); @@ -203,14 +242,15 @@ public final class GeneralPath implements Shape, Cloneable { } /** - * Sets the winding rule, which determines how to decide whether - * a point that isn't on the path itself is inside or outside of - * the shape. - * - * @param rule the new winding rule + * Sets the winding rule, which determines how to decide whether a point + * that isn't on the path itself is inside or outside of the shape. * - * @throws IllegalArgumentException if the winding rule is neither - * {@link PathIterator#WIND_EVEN_ODD} nor {@link PathIterator#WIND_NON_ZERO}. + * @param rule + * the new winding rule. + * @throws IllegalArgumentException + * if the winding rule is neither + * {@link PathIterator#WIND_EVEN_ODD} nor + * {@link PathIterator#WIND_NON_ZERO}. */ public void setWindingRule(int rule) { if (rule != WIND_EVEN_ODD && rule != WIND_NON_ZERO) { @@ -223,8 +263,8 @@ public final class GeneralPath implements Shape, Cloneable { /** * Gets the winding rule. * - * @return the winding rule, either {@link PathIterator#WIND_EVEN_ODD} - * or {@link PathIterator#WIND_NON_ZERO} + * @return the winding rule, either {@link PathIterator#WIND_EVEN_ODD} or + * {@link PathIterator#WIND_NON_ZERO}. */ public int getWindingRule() { return rule; @@ -232,15 +272,16 @@ public final class GeneralPath implements Shape, Cloneable { /** * Checks the point data buffer sizes to see whether pointCount additional - * point-data elements can fit. (Note that the number of point data - * elements to add is more than one per point -- it depends on the type - * of point being added.) Reallocates the buffers to enlarge the size if necessary. + * point-data elements can fit. (Note that the number of point data elements + * to add is more than one per point -- it depends on the type of point + * being added.) Reallocates the buffers to enlarge the size if necessary. * - * @param pointCount - the number of point data elements to be added - * @param checkMove whether to check for existing points - * - * @throws IllegalPathStateException checkMove is true and the - * path is currently empty. + * @param pointCount + * the number of point data elements to be added. + * @param checkMove + * whether to check for existing points. + * @throws IllegalPathStateException + * checkMove is true and the path is currently empty. */ void checkBuf(int pointCount, boolean checkMove) { if (checkMove && typeSize == 0) { @@ -260,11 +301,13 @@ public final class GeneralPath implements Shape, Cloneable { } /** - * Appends a new point to the end of this general path, disconnected - * from the existing path. + * Appends a new point to the end of this general path, disconnected from + * the existing path. * - * @param x the x coordinate of the next point to append - * @param y the y coordinate of the next point to append + * @param x + * the x coordinate of the next point to append. + * @param y + * the y coordinate of the next point to append. */ public void moveTo(float x, float y) { if (typeSize > 0 && types[typeSize - 1] == PathIterator.SEG_MOVETO) { @@ -279,12 +322,13 @@ public final class GeneralPath implements Shape, Cloneable { } /** - * Appends a new segment to the end of this general path by making - * a straight line segment from the current endpoint to the - * given new point. + * Appends a new segment to the end of this general path by making a + * straight line segment from the current endpoint to the given new point. * - * @param x the x coordinate of the next point to append - * @param y the y coordinate of the next point to append + * @param x + * the x coordinate of the next point to append. + * @param y + * the y coordinate of the next point to append. */ public void lineTo(float x, float y) { checkBuf(2, true); @@ -294,14 +338,18 @@ public final class GeneralPath implements Shape, Cloneable { } /** - * Appends a new segment to the end of this general path by making - * a quadratic curve from the current endpoint to the point (x2, y2) - * using the point (x1, y1) as the quadratic curve's control point. + * Appends a new segment to the end of this general path by making a + * quadratic curve from the current endpoint to the point (x2, y2) using the + * point (x1, y1) as the quadratic curve's control point. * - * @param x1 the x coordinate of the quadratic curve's control point - * @param y1 the y coordinate of the quadratic curve's control point - * @param x2 the x coordinate of the quadratic curve's end point - * @param y2 the y coordinate of the quadratic curve's end point + * @param x1 + * the x coordinate of the quadratic curve's control point. + * @param y1 + * the y coordinate of the quadratic curve's control point. + * @param x2 + * the x coordinate of the quadratic curve's end point. + * @param y2 + * the y coordinate of the quadratic curve's end point. */ public void quadTo(float x1, float y1, float x2, float y2) { checkBuf(4, true); @@ -313,18 +361,27 @@ public final class GeneralPath implements Shape, Cloneable { } /** - * Appends a new segment to the end of this general path by making - * a cubic curve from the current endpoint to the point (x3, y3) - * using (x1, y1) and (x2, y2) as control points. + * Appends a new segment to the end of this general path by making a cubic + * curve from the current endpoint to the point (x3, y3) using (x1, y1) and + * (x2, y2) as control points. * * @see java.awt.geom.CubicCurve2D - * - * @param x1 the x coordinate of the new cubic segment's first control point - * @param y1 the y coordinate of the new cubic segment's first control point - * @param x2 the x coordinate of the new cubic segment's second control point - * @param y2 the y coordinate of the new cubic segment's second control point - * @param x3 the x coordinate of the new cubic segment's end point - * @param y3 the y coordinate of the new cubic segment's end point + * @param x1 + * the x coordinate of the new cubic segment's first control + * point. + * @param y1 + * the y coordinate of the new cubic segment's first control + * point. + * @param x2 + * the x coordinate of the new cubic segment's second control + * point. + * @param y2 + * the y coordinate of the new cubic segment's second control + * point. + * @param x3 + * the x coordinate of the new cubic segment's end point. + * @param y3 + * the y coordinate of the new cubic segment's end point. */ public void curveTo(float x1, float y1, float x2, float y2, float x3, float y3) { checkBuf(6, true); @@ -338,8 +395,8 @@ public final class GeneralPath implements Shape, Cloneable { } /** - * Appends the type information to declare that the current - * endpoint closes the curve. + * Appends the type information to declare that the current endpoint closes + * the curve. */ public void closePath() { if (typeSize == 0 || types[typeSize - 1] != PathIterator.SEG_CLOSE) { @@ -349,15 +406,17 @@ public final class GeneralPath implements Shape, Cloneable { } /** - * Appends the outline of the specified shape onto the end - * of this GeneralPath. - * - * @param shape the shape whose outline is to be appended - * @param connect true to connect this path's current - * endpoint to the first point of the shape's outline or - * false to append the shape's outline without connecting it + * Appends the outline of the specified shape onto the end of this + * GeneralPath. * - * @throws NullPointerException if the shape parameter is null + * @param shape + * the shape whose outline is to be appended. + * @param connect + * true to connect this path's current endpoint to the first + * point of the shape's outline or false to append the shape's + * outline without connecting it. + * @throws NullPointerException + * if the shape parameter is null. */ public void append(Shape shape, boolean connect) { PathIterator p = shape.getPathIterator(null); @@ -365,42 +424,43 @@ public final class GeneralPath implements Shape, Cloneable { } /** - * Appends the path defined by the specified PathIterator onto the end - * of this GeneralPath. + * Appends the path defined by the specified PathIterator onto the end of + * this GeneralPath. * - * @param path the PathIterator that defines the new path to append - * @param connect true to connect this path's current - * endpoint to the first point of the shape's outline or - * false to append the shape's outline without connecting it + * @param path + * the PathIterator that defines the new path to append. + * @param connect + * true to connect this path's current endpoint to the first + * point of the shape's outline or false to append the shape's + * outline without connecting it. */ public void append(PathIterator path, boolean connect) { while (!path.isDone()) { float coords[] = new float[6]; switch (path.currentSegment(coords)) { - case PathIterator.SEG_MOVETO: - if (!connect || typeSize == 0) { - moveTo(coords[0], coords[1]); + case PathIterator.SEG_MOVETO: + if (!connect || typeSize == 0) { + moveTo(coords[0], coords[1]); + break; + } + if (types[typeSize - 1] != PathIterator.SEG_CLOSE + && points[pointSize - 2] == coords[0] + && points[pointSize - 1] == coords[1]) { + break; + } + // NO BREAK; + case PathIterator.SEG_LINETO: + lineTo(coords[0], coords[1]); break; - } - if (types[typeSize - 1] != PathIterator.SEG_CLOSE && - points[pointSize - 2] == coords[0] && - points[pointSize - 1] == coords[1]) - { + case PathIterator.SEG_QUADTO: + quadTo(coords[0], coords[1], coords[2], coords[3]); + break; + case PathIterator.SEG_CUBICTO: + curveTo(coords[0], coords[1], coords[2], coords[3], coords[4], coords[5]); + break; + case PathIterator.SEG_CLOSE: + closePath(); break; - } - // NO BREAK; - case PathIterator.SEG_LINETO: - lineTo(coords[0], coords[1]); - break; - case PathIterator.SEG_QUADTO: - quadTo(coords[0], coords[1], coords[2], coords[3]); - break; - case PathIterator.SEG_CUBICTO: - curveTo(coords[0], coords[1], coords[2], coords[3], coords[4], coords[5]); - break; - case PathIterator.SEG_CLOSE: - closePath(); - break; } path.next(); connect = false; @@ -410,7 +470,7 @@ public final class GeneralPath implements Shape, Cloneable { /** * Gets the current end point of the path. * - * @return the current end point of the path + * @return the current end point of the path. */ public Point2D getCurrentPoint() { if (typeSize == 0) { @@ -431,9 +491,9 @@ public final class GeneralPath implements Shape, Cloneable { } /** - * Resets the GeneralPath to being an empty path. The underlying - * point and segment data is not deleted but rather the end indices - * of the data arrays are set to zero. + * Resets the GeneralPath to being an empty path. The underlying point and + * segment data is not deleted but rather the end indices of the data arrays + * are set to zero. */ public void reset() { typeSize = 0; @@ -441,23 +501,24 @@ public final class GeneralPath implements Shape, Cloneable { } /** - * Transform all of the coordinates of this path according to the - * specified AffineTransform. + * Transform all of the coordinates of this path according to the specified + * AffineTransform. * - * @param t the AffineTransform + * @param t + * the AffineTransform. */ public void transform(AffineTransform t) { t.transform(points, 0, points, 0, pointSize / 2); } /** - * Creates a new GeneralPath whose data is given by this path's - * data transformed according to the specified AffineTransform. - * - * @param t the AffineTransform + * Creates a new GeneralPath whose data is given by this path's data + * transformed according to the specified AffineTransform. * - * @return the new GeneralPath whose data is given by this path's - * data transformed according to the specified AffineTransform + * @param t + * the AffineTransform. + * @return the new GeneralPath whose data is given by this path's data + * transformed according to the specified AffineTransform. */ public Shape createTransformedShape(AffineTransform t) { GeneralPath p = (GeneralPath)clone(); @@ -480,16 +541,14 @@ public final class GeneralPath implements Shape, Cloneable { float x = points[i--]; if (x < rx1) { rx1 = x; - } else - if (x > rx2) { - rx2 = x; - } + } else if (x > rx2) { + rx2 = x; + } if (y < ry1) { ry1 = y; - } else - if (y > ry2) { - ry2 = y; - } + } else if (y > ry2) { + ry2 = y; + } } } return new Rectangle2D.Float(rx1, ry1, rx2 - rx1, ry2 - ry1); @@ -500,14 +559,14 @@ public final class GeneralPath implements Shape, Cloneable { } /** - * Checks the cross count (number of times a ray from the point - * crosses the shape's boundary) to determine whether the number - * of crossings corresponds to a point inside the shape or not - * (according to the shape's path rule). - * - * @param cross - the point's cross count + * Checks the cross count (number of times a ray from the point crosses the + * shape's boundary) to determine whether the number of crossings + * corresponds to a point inside the shape or not (according to the shape's + * path rule). * - * @return true if the point is inside the path, or false otherwise + * @param cross + * the point's cross count. + * @return true if the point is inside the path, or false otherwise. */ boolean isInside(int cross) { if (rule == WIND_NON_ZERO) { @@ -553,7 +612,7 @@ public final class GeneralPath implements Shape, Cloneable { @Override public Object clone() { try { - GeneralPath p = (GeneralPath) super.clone(); + GeneralPath p = (GeneralPath)super.clone(); p.types = types.clone(); p.points = points.clone(); return p; @@ -563,4 +622,3 @@ public final class GeneralPath implements Shape, Cloneable { } } - diff --git a/awt/java/awt/geom/IllegalPathStateException.java b/awt/java/awt/geom/IllegalPathStateException.java index 7f459e77fff7c..750ba29fe6c55 100644 --- a/awt/java/awt/geom/IllegalPathStateException.java +++ b/awt/java/awt/geom/IllegalPathStateException.java @@ -18,16 +18,21 @@ * @author Denis M. Kishenko * @version $Revision$ */ + package java.awt.geom; /** - * The Class IllegalPathStateException indicates errors where the - * current state of a path object is imcompatible with the desired - * action, such as performing non-trivial actions on an empty path. + * The Class IllegalPathStateException indicates errors where the current state + * of a path object is incompatible with the desired action, such as performing + * non-trivial actions on an empty path. + * + * @since Android 1.0 */ public class IllegalPathStateException extends RuntimeException { - /** The Constant serialVersionUID. */ + /** + * The Constant serialVersionUID. + */ private static final long serialVersionUID = -5158084205220481094L; /** @@ -37,14 +42,14 @@ public class IllegalPathStateException extends RuntimeException { } /** - * Instantiates a new illegal path state exception with the - * specified detail message. + * Instantiates a new illegal path state exception with the specified detail + * message. * - * @param s the details of the error + * @param s + * the details of the error. */ public IllegalPathStateException(String s) { super(s); } } - diff --git a/awt/java/awt/geom/Line2D.java b/awt/java/awt/geom/Line2D.java index a53c4709016ca..fcd51b6dd15b8 100644 --- a/awt/java/awt/geom/Line2D.java +++ b/awt/java/awt/geom/Line2D.java @@ -18,6 +18,7 @@ * @author Denis M. Kishenko * @version $Revision$ */ + package java.awt.geom; import java.awt.Rectangle; @@ -27,55 +28,71 @@ import java.util.NoSuchElementException; import org.apache.harmony.awt.internal.nls.Messages; /** - * The Class Line2D represents a line whose data is given in - * high-precision values appropriate for graphical operations. + * The Class Line2D represents a line whose data is given in high-precision + * values appropriate for graphical operations. + * + * @since Android 1.0 */ public abstract class Line2D implements Shape, Cloneable { /** - * The Class Float is the subclass of Line2D that has all - * of its data values stored with float-level precision. + * The Class Float is the subclass of Line2D that has all of its data values + * stored with float-level precision. + * + * @since Android 1.0 */ public static class Float extends Line2D { - /** The x coordinate of the starting point. */ + /** + * The x coordinate of the starting point. + */ public float x1; - - /** The y coordinate of the starting point. */ + + /** + * The y coordinate of the starting point. + */ public float y1; - - /** The x coordinate of the end point. */ + + /** + * The x coordinate of the end point. + */ public float x2; - - /** The y coordinate of the end point. */ + + /** + * The y coordinate of the end point. + */ public float y2; /** - * Instantiates a new float-valued Line2D with - * its data values set to zero. + * Instantiates a new float-valued Line2D with its data values set to + * zero. */ public Float() { } /** - * Instantiates a new float-valued Line2D with - * the specified endpoints. + * Instantiates a new float-valued Line2D with the specified endpoints. * - * @param x1 the x coordinate of the starting point - * @param y1 the y coordinate of the starting point - * @param x2 the x coordinate of the end point - * @param y2 the y coordinate of the end point + * @param x1 + * the x coordinate of the starting point. + * @param y1 + * the y coordinate of the starting point. + * @param x2 + * the x coordinate of the end point. + * @param y2 + * the y coordinate of the end point. */ public Float(float x1, float y1, float x2, float y2) { setLine(x1, y1, x2, y2); } /** - * Instantiates a new float-valued Line2D with - * the specified endpoints. + * Instantiates a new float-valued Line2D with the specified endpoints. * - * @param p1 the starting point - * @param p2 the end point + * @param p1 + * the starting point. + * @param p2 + * the end point. */ public Float(Point2D p1, Point2D p2) { setLine(p1, p2); @@ -122,10 +139,14 @@ public abstract class Line2D implements Shape, Cloneable { /** * Sets the data values that define the line. * - * @param x1 the x coordinate of the starting point - * @param y1 the y coordinate of the starting point - * @param x2 the x coordinate of the end point - * @param y2 the y coordinate of the end point + * @param x1 + * the x coordinate of the starting point. + * @param y1 + * the y coordinate of the starting point. + * @param x2 + * the x coordinate of the end point. + * @param y2 + * the y coordinate of the end point. */ public void setLine(float x1, float y1, float x2, float y2) { this.x1 = x1; @@ -155,49 +176,63 @@ public abstract class Line2D implements Shape, Cloneable { } /** - * The Class Double is the subclass of Line2D that has all - * of its data values stored with double-level precision. + * The Class Double is the subclass of Line2D that has all of its data + * values stored with double-level precision. + * + * @since Android 1.0 */ public static class Double extends Line2D { - /** The x coordinate of the starting point. */ + /** + * The x coordinate of the starting point. + */ public double x1; - - /** The y coordinate of the starting point. */ + + /** + * The y coordinate of the starting point. + */ public double y1; - - /** The x coordinate of the end point. */ + + /** + * The x coordinate of the end point. + */ public double x2; - - /** The y coordinate of the end point. */ + + /** + * The y coordinate of the end point. + */ public double y2; /** - * Instantiates a new double-valued Line2D with - * its data values set to zero. + * Instantiates a new double-valued Line2D with its data values set to + * zero. */ public Double() { } /** - * Instantiates a new double-valued Line2D with - * the specified endpoints. + * Instantiates a new double-valued Line2D with the specified endpoints. * - * @param x1 the x coordinate of the starting point - * @param y1 the y coordinate of the starting point - * @param x2 the x coordinate of the end point - * @param y2 the y coordinate of the end point + * @param x1 + * the x coordinate of the starting point. + * @param y1 + * the y coordinate of the starting point. + * @param x2 + * the x coordinate of the end point. + * @param y2 + * the y coordinate of the end point. */ public Double(double x1, double y1, double x2, double y2) { setLine(x1, y1, x2, y2); } /** - * Instantiates a new double-valued Line2D with - * the specified endpoints. + * Instantiates a new double-valued Line2D with the specified endpoints. * - * @param p1 the starting point - * @param p2 the end point + * @param p1 + * the starting point. + * @param p2 + * the end point. */ public Double(Point2D p1, Point2D p2) { setLine(p1, p2); @@ -262,36 +297,50 @@ public abstract class Line2D implements Shape, Cloneable { } /* - * Line2D path iterator + * Line2D path iterator */ /** * The subclass of PathIterator to traverse a Line2D. */ class Iterator implements PathIterator { - /** The x coordinate of the start line point. */ + /** + * The x coordinate of the start line point. + */ double x1; - - /** The y coordinate of the start line point. */ + + /** + * The y coordinate of the start line point. + */ double y1; - - /** The x coordinate of the end line point. */ + + /** + * The x coordinate of the end line point. + */ double x2; - - /** The y coordinate of the end line point. */ + + /** + * The y coordinate of the end line point. + */ double y2; - /** The path iterator transformation. */ + /** + * The path iterator transformation. + */ AffineTransform t; - /** The current segmenet index. */ + /** + * The current segment index. + */ int index; /** - * Constructs a new Line2D.Iterator for given line and transformation + * Constructs a new Line2D.Iterator for given line and transformation. * - * @param l - the source Line2D object - * @param at - the AffineTransform object to apply rectangle path + * @param l + * the source Line2D object. + * @param at + * the AffineTransform object to apply rectangle path. */ Iterator(Line2D l, AffineTransform at) { this.x1 = l.getX1(); @@ -366,60 +415,66 @@ public abstract class Line2D implements Shape, Cloneable { /** * Gets the x coordinate of the starting point. * - * @return the x coordinate of the starting point + * @return the x coordinate of the starting point. */ public abstract double getX1(); /** * Gets the y coordinate of the starting point. * - * @return the y coordinate of the starting point + * @return the y coordinate of the starting point. */ public abstract double getY1(); /** * Gets the x coordinate of the end point. * - * @return the x2 + * @return the x2. */ public abstract double getX2(); /** * Gets the y coordinate of the end point. * - * @return the y coordinate of the end point + * @return the y coordinate of the end point. */ public abstract double getY2(); /** * Gets the p the starting point. * - * @return the p the starting point + * @return the p the starting point. */ public abstract Point2D getP1(); /** * Gets the p end point. * - * @return the p end point + * @return the p end point. */ public abstract Point2D getP2(); /** * Sets the line's endpoints. * - * @param x1 the x coordinate of the starting point - * @param y1 the y coordinate of the starting point - * @param x2 the x coordinate of the end point - * @param y2 the y coordinate of the end point + * @param x1 + * the x coordinate of the starting point. + * @param y1 + * the y coordinate of the starting point. + * @param x2 + * the x coordinate of the end point. + * @param y2 + * the y coordinate of the end point. */ public abstract void setLine(double x1, double y1, double x2, double y2); /** * Sets the line's endpoints. * - * @param p1 the starting point - * @param p2 the end point + * @param p1 + * the starting point. + * @param p2 + * the end point. */ public void setLine(Point2D p1, Point2D p2) { setLine(p1.getX(), p1.getY(), p2.getX(), p2.getY()); @@ -428,39 +483,44 @@ public abstract class Line2D implements Shape, Cloneable { /** * Sets the line's endpoints by copying the data from another Line2D. * - * @param line the Line2D to copy the endpoint data from + * @param line + * the Line2D to copy the endpoint data from. */ public void setLine(Line2D line) { setLine(line.getX1(), line.getY1(), line.getX2(), line.getY2()); } public Rectangle getBounds() { - return getBounds2D().getBounds(); + return getBounds2D().getBounds(); } /** - * Tells where the point is with respect to the line segment, - * given the orientation of the line segment. If the ray - * found by extending the line segment from its starting point - * is rotated, this method tells whether the ray - * should rotate in a clockwise direction or a counter-clockwise - * direction to hit the point first. The return value is 0 if the - * point is on the line segment, it's 1 if the point is on the ray - * or if the ray should rotate in a counter-clockwise direction to get to the - * point, and it's -1 if the ray should rotate in a clockwise - * direction to get to the point or if the point is on the line - * determined by the line segment but not on the ray from the - * segment's starting point and through its end point. - * - * @param x1 the x coordinate of the starting point of the line segment - * @param y1 the y coordinate of the starting point of the line segment - * @param x2 the x coordinate of the end point of the line segment - * @param y2 the y coordinate of the end point of the line segment - * @param px the x coordinate of the test point - * @param py the p coordinate of the test point - * - * @return the value that describes where the point is with respect to the line segment, - * given the orientation of the line segment + * Tells where the point is with respect to the line segment, given the + * orientation of the line segment. If the ray found by extending the line + * segment from its starting point is rotated, this method tells whether the + * ray should rotate in a clockwise direction or a counter-clockwise + * direction to hit the point first. The return value is 0 if the point is + * on the line segment, it's 1 if the point is on the ray or if the ray + * should rotate in a counter-clockwise direction to get to the point, and + * it's -1 if the ray should rotate in a clockwise direction to get to the + * point or if the point is on the line determined by the line segment but + * not on the ray from the segment's starting point and through its end + * point. + * + * @param x1 + * the x coordinate of the starting point of the line segment. + * @param y1 + * the y coordinate of the starting point of the line segment. + * @param x2 + * the x coordinate of the end point of the line segment. + * @param y2 + * the y coordinate of the end point of the line segment. + * @param px + * the x coordinate of the test point. + * @param py + * the p coordinate of the test point. + * @return the value that describes where the point is with respect to the + * line segment, given the orientation of the line segment. */ public static int relativeCCW(double x1, double y1, double x2, double y2, double px, double py) { /* @@ -487,47 +547,46 @@ public abstract class Line2D implements Shape, Cloneable { } /** - * Tells where the point is with respect to this line segment, - * given the orientation of this line segment. If the ray - * found by extending the line segment from its starting point - * is rotated, this method tells whether the ray - * should rotate in a clockwise direction or a counter-clockwise - * direction to hit the point first. The return value is 0 if the - * point is on the line segment, it's 1 if the point is on the ray - * or if the ray should rotate in a counter-clockwise direction to get to the - * point, and it's -1 if the ray should rotate in a clockwise - * direction to get to the point or if the point is on the line - * determined by the line segment but not on the ray from the - * segment's starting point and through its end point. - * - * @param px the x coordinate of the test point - * @param py the p coordinate of the test point - * - * @return the value that describes where the point is with respect to - * this line segment, given the orientation of this line segment + * Tells where the point is with respect to this line segment, given the + * orientation of this line segment. If the ray found by extending the line + * segment from its starting point is rotated, this method tells whether the + * ray should rotate in a clockwise direction or a counter-clockwise + * direction to hit the point first. The return value is 0 if the point is + * on the line segment, it's 1 if the point is on the ray or if the ray + * should rotate in a counter-clockwise direction to get to the point, and + * it's -1 if the ray should rotate in a clockwise direction to get to the + * point or if the point is on the line determined by the line segment but + * not on the ray from the segment's starting point and through its end + * point. + * + * @param px + * the x coordinate of the test point. + * @param py + * the p coordinate of the test point. + * @return the value that describes where the point is with respect to this + * line segment, given the orientation of this line segment. */ public int relativeCCW(double px, double py) { return relativeCCW(getX1(), getY1(), getX2(), getY2(), px, py); } /** - * Tells where the point is with respect to this line segment, - * given the orientation of this line segment. If the ray - * found by extending the line segment from its starting point - * is rotated, this method tells whether the ray - * should rotate in a clockwise direction or a counter-clockwise - * direction to hit the point first. The return value is 0 if the - * point is on the line segment, it's 1 if the point is on the ray - * or if the ray should rotate in a counter-clockwise direction to get to the - * point, and it's -1 if the ray should rotate in a clockwise - * direction to get to the point or if the point is on the line - * determined by the line segment but not on the ray from the - * segment's starting point and through its end point. - * - * @param p the test point - * - * @return the value that describes where the point is with respect to - * this line segment, given the orientation of this line segment + * Tells where the point is with respect to this line segment, given the + * orientation of this line segment. If the ray found by extending the line + * segment from its starting point is rotated, this method tells whether the + * ray should rotate in a clockwise direction or a counter-clockwise + * direction to hit the point first. The return value is 0 if the point is + * on the line segment, it's 1 if the point is on the ray or if the ray + * should rotate in a counter-clockwise direction to get to the point, and + * it's -1 if the ray should rotate in a clockwise direction to get to the + * point or if the point is on the line determined by the line segment but + * not on the ray from the segment's starting point and through its end + * point. + * + * @param p + * the test point. + * @return the value that describes where the point is with respect to this + * line segment, given the orientation of this line segment. */ public int relativeCCW(Point2D p) { return relativeCCW(getX1(), getY1(), getX2(), getY2(), p.getX(), p.getY()); @@ -536,28 +595,31 @@ public abstract class Line2D implements Shape, Cloneable { /** * Tells whether the two line segments cross. * - * @param x1 the x coordinate of the starting point of the first segment - * @param y1 the y coordinate of the starting point of the first segment - * @param x2 the x coordinate of the end point of the first segment - * @param y2 the y coordinate of the end point of the first segment - * @param x3 the x coordinate of the starting point of the second segment - * @param y3 the y coordinate of the starting point of the second segment - * @param x4 the x coordinate of the end point of the second segment - * @param y4 the y coordinate of the end point of the second segment - * - * @return true, if the two line segments cross - */ - public static boolean linesIntersect(double x1, double y1, double x2, - double y2, double x3, double y3, double x4, double y4) - { + * @param x1 + * the x coordinate of the starting point of the first segment. + * @param y1 + * the y coordinate of the starting point of the first segment. + * @param x2 + * the x coordinate of the end point of the first segment. + * @param y2 + * the y coordinate of the end point of the first segment. + * @param x3 + * the x coordinate of the starting point of the second segment. + * @param y3 + * the y coordinate of the starting point of the second segment. + * @param x4 + * the x coordinate of the end point of the second segment. + * @param y4 + * the y coordinate of the end point of the second segment. + * @return true, if the two line segments cross. + */ + public static boolean linesIntersect(double x1, double y1, double x2, double y2, double x3, + double y3, double x4, double y4) { /* * A = (x2-x1, y2-y1) B = (x3-x1, y3-y1) C = (x4-x1, y4-y1) D = (x4-x3, - * y4-y3) = C-B E = (x1-x3, y1-y3) = -B F = (x2-x3, y2-y3) = A-B - * - * Result is ((AxB) * (AxC) <=0) and ((DxE) * (DxF) <= 0) - * - * DxE = (C-B)x(-B) = BxB-CxB = BxC DxF = (C-B)x(A-B) = CxA-CxB-BxA+BxB = - * AxB+BxC-AxC + * y4-y3) = C-B E = (x1-x3, y1-y3) = -B F = (x2-x3, y2-y3) = A-B Result + * is ((AxB) (AxC) <=0) and ((DxE) (DxF) <= 0) DxE = (C-B)x(-B) = + * BxB-CxB = BxC DxF = (C-B)x(A-B) = CxA-CxB-BxA+BxB = AxB+BxC-AxC */ x2 -= x1; // A @@ -573,16 +635,14 @@ public abstract class Line2D implements Shape, Cloneable { // Online if (AvB == 0.0 && AvC == 0.0) { if (x2 != 0.0) { - return - (x4 * x3 <= 0.0) || - ((x3 * x2 >= 0.0) && - (x2 > 0.0 ? x3 <= x2 || x4 <= x2 : x3 >= x2 || x4 >= x2)); + return (x4 * x3 <= 0.0) + || ((x3 * x2 >= 0.0) && (x2 > 0.0 ? x3 <= x2 || x4 <= x2 : x3 >= x2 + || x4 >= x2)); } if (y2 != 0.0) { - return - (y4 * y3 <= 0.0) || - ((y3 * y2 >= 0.0) && - (y2 > 0.0 ? y3 <= y2 || y4 <= y2 : y3 >= y2 || y4 >= y2)); + return (y4 * y3 <= 0.0) + || ((y3 * y2 >= 0.0) && (y2 > 0.0 ? y3 <= y2 || y4 <= y2 : y3 >= y2 + || y4 >= y2)); } return false; } @@ -595,12 +655,15 @@ public abstract class Line2D implements Shape, Cloneable { /** * Tells whether the specified line segments crosses this line segment. * - * @param x1 the x coordinate of the starting point of the test segment - * @param y1 the y coordinate of the starting point of the test segment - * @param x2 the x coordinate of the end point of the test segment - * @param y2 the y coordinate of the end point of the test segment - * - * @return true, if the specified line segments crosses this line segment + * @param x1 + * the x coordinate of the starting point of the test segment. + * @param y1 + * the y coordinate of the starting point of the test segment. + * @param x2 + * the x coordinate of the end point of the test segment. + * @param y2 + * the y coordinate of the end point of the test segment. + * @return true, if the specified line segments crosses this line segment. */ public boolean intersectsLine(double x1, double y1, double x2, double y2) { return linesIntersect(x1, y1, x2, y2, getX1(), getY1(), getX2(), getY2()); @@ -609,31 +672,37 @@ public abstract class Line2D implements Shape, Cloneable { /** * Tells whether the specified line segments crosses this line segment. * - * @param l the test segment - * - * @return true, if the specified line segments crosses this line segment - * - * @throws NullPointerException if l is null + * @param l + * the test segment. + * @return true, if the specified line segments crosses this line segment. + * @throws NullPointerException + * if l is null. */ public boolean intersectsLine(Line2D l) { - return linesIntersect(l.getX1(), l.getY1(), l.getX2(), l.getY2(), getX1(), getY1(), getX2(), getY2()); + return linesIntersect(l.getX1(), l.getY1(), l.getX2(), l.getY2(), getX1(), getY1(), + getX2(), getY2()); } /** - * Gives the square of the distance between the point and the - * line segment. - * - * @param x1 the x coordinate of the starting point of the line segment - * @param y1 the y coordinate of the starting point of the line segment - * @param x2 the x coordinate of the end point of the line segment - * @param y2 the y coordinate of the end point of the line segment - * @param px the x coordinate of the test point - * @param py the y coordinate of the test point - * - * @return the the square of the distance between the point and the - * line segment - */ - public static double ptSegDistSq(double x1, double y1, double x2, double y2, double px, double py) { + * Gives the square of the distance between the point and the line segment. + * + * @param x1 + * the x coordinate of the starting point of the line segment. + * @param y1 + * the y coordinate of the starting point of the line segment. + * @param x2 + * the x coordinate of the end point of the line segment. + * @param y2 + * the y coordinate of the end point of the line segment. + * @param px + * the x coordinate of the test point. + * @param py + * the y coordinate of the test point. + * @return the the square of the distance between the point and the line + * segment. + */ + public static double ptSegDistSq(double x1, double y1, double x2, double y2, double px, + double py) { /* * A = (x2 - x1, y2 - y1) P = (px - x1, py - y1) */ @@ -661,92 +730,95 @@ public abstract class Line2D implements Shape, Cloneable { } /** - * Gives the distance between the point and the - * line segment. - * - * @param x1 the x coordinate of the starting point of the line segment - * @param y1 the y coordinate of the starting point of the line segment - * @param x2 the x coordinate of the end point of the line segment - * @param y2 the y coordinate of the end point of the line segment - * @param px the x coordinate of the test point - * @param py the y coordinate of the test point - * - * @return the the distance between the point and the - * line segment + * Gives the distance between the point and the line segment. + * + * @param x1 + * the x coordinate of the starting point of the line segment. + * @param y1 + * the y coordinate of the starting point of the line segment. + * @param x2 + * the x coordinate of the end point of the line segment. + * @param y2 + * the y coordinate of the end point of the line segment. + * @param px + * the x coordinate of the test point. + * @param py + * the y coordinate of the test point. + * @return the the distance between the point and the line segment. */ public static double ptSegDist(double x1, double y1, double x2, double y2, double px, double py) { return Math.sqrt(ptSegDistSq(x1, y1, x2, y2, px, py)); } /** - * Gives the square of the distance between the point and this - * line segment. - * - * @param px the x coordinate of the test point - * @param py the y coordinate of the test point + * Gives the square of the distance between the point and this line segment. * - * @return the the square of the distance between the point and this - * line segment + * @param px + * the x coordinate of the test point. + * @param py + * the y coordinate of the test point. + * @return the the square of the distance between the point and this line + * segment. */ public double ptSegDistSq(double px, double py) { return ptSegDistSq(getX1(), getY1(), getX2(), getY2(), px, py); } /** - * Gives the square of the distance between the point and this - * line segment. + * Gives the square of the distance between the point and this line segment. * - * @param p the test point - * - * @return the square of the distance between the point and this - * line segment + * @param p + * the test point. + * @return the square of the distance between the point and this line + * segment. */ public double ptSegDistSq(Point2D p) { return ptSegDistSq(getX1(), getY1(), getX2(), getY2(), p.getX(), p.getY()); } /** - * Gives the distance between the point and this - * line segment. - * - * @param px the x coordinate of the test point - * @param py the y coordinate of the test point + * Gives the distance between the point and this line segment. * - * @return the distance between the point and this - * line segment + * @param px + * the x coordinate of the test point. + * @param py + * the y coordinate of the test point. + * @return the distance between the point and this line segment. */ public double ptSegDist(double px, double py) { return ptSegDist(getX1(), getY1(), getX2(), getY2(), px, py); } /** - * Gives the distance between the point and this - * line segment. + * Gives the distance between the point and this line segment. * - * @param p the test point - * - * @return the distance between the point and this - * line segment + * @param p + * the test point. + * @return the distance between the point and this line segment. */ public double ptSegDist(Point2D p) { return ptSegDist(getX1(), getY1(), getX2(), getY2(), p.getX(), p.getY()); } /** - * Gives the square of the distance between the point and the - * line. - * - * @param x1 the x coordinate of the starting point of the line segment - * @param y1 the y coordinate of the starting point of the line segment - * @param x2 the x coordinate of the end point of the line segment - * @param y2 the y coordinate of the end point of the line segment - * @param px the x coordinate of the test point - * @param py the y coordinate of the test point - * - * @return the square of the distance between the point and the - * line - */ - public static double ptLineDistSq(double x1, double y1, double x2, double y2, double px, double py) { + * Gives the square of the distance between the point and the line. + * + * @param x1 + * the x coordinate of the starting point of the line segment. + * @param y1 + * the y coordinate of the starting point of the line segment. + * @param x2 + * the x coordinate of the end point of the line segment. + * @param y2 + * the y coordinate of the end point of the line segment. + * @param px + * the x coordinate of the test point. + * @param py + * the y coordinate of the test point. + * @return the square of the distance between the point and the line. + */ + public static double ptLineDistSq(double x1, double y1, double x2, double y2, double px, + double py) { x2 -= x1; y2 -= y1; px -= x1; @@ -756,72 +828,77 @@ public abstract class Line2D implements Shape, Cloneable { } /** - * Gives the square of the distance between the point and the - * line. - * - * @param x1 the x coordinate of the starting point of the line segment - * @param y1 the y coordinate of the starting point of the line segment - * @param x2 the x coordinate of the end point of the line segment - * @param y2 the y coordinate of the end point of the line segment - * @param px the x coordinate of the test point - * @param py the y coordinate of the test point - * - * @return the square of the distance between the point and the - * line + * Gives the square of the distance between the point and the line. + * + * @param x1 + * the x coordinate of the starting point of the line segment. + * @param y1 + * the y coordinate of the starting point of the line segment. + * @param x2 + * the x coordinate of the end point of the line segment. + * @param y2 + * the y coordinate of the end point of the line segment. + * @param px + * the x coordinate of the test point. + * @param py + * the y coordinate of the test point. + * @return the square of the distance between the point and the line. */ public static double ptLineDist(double x1, double y1, double x2, double y2, double px, double py) { return Math.sqrt(ptLineDistSq(x1, y1, x2, y2, px, py)); } /** - * Gives the square of the distance between the point and the - * line determined by this Line2D. + * Gives the square of the distance between the point and the line + * determined by this Line2D. * - * @param px the x coordinate of the test point - * @param py the y coordinate of the test point - * - * @return the square of the distance between the point and the - * line determined by this Line2D + * @param px + * the x coordinate of the test point. + * @param py + * the y coordinate of the test point. + * @return the square of the distance between the point and the line + * determined by this Line2D. */ public double ptLineDistSq(double px, double py) { return ptLineDistSq(getX1(), getY1(), getX2(), getY2(), px, py); } /** - * Gives the square of the distance between the point and the - * line determined by this Line2D. - * - * @param p the test point + * Gives the square of the distance between the point and the line + * determined by this Line2D. * - * @return the square of the distance between the point and the - * line determined by this Line2D + * @param p + * the test point. + * @return the square of the distance between the point and the line + * determined by this Line2D. */ public double ptLineDistSq(Point2D p) { return ptLineDistSq(getX1(), getY1(), getX2(), getY2(), p.getX(), p.getY()); } /** - * Gives the distance between the point and the - * line determined by this Line2D. + * Gives the distance between the point and the line determined by this + * Line2D. * - * @param px the x coordinate of the test point - * @param py the y coordinate of the test point - * - * @return the distance between the point and the - * line determined by this Line2D + * @param px + * the x coordinate of the test point. + * @param py + * the y coordinate of the test point. + * @return the distance between the point and the line determined by this + * Line2D. */ public double ptLineDist(double px, double py) { return ptLineDist(getX1(), getY1(), getX2(), getY2(), px, py); } /** - * Gives the distance between the point and the - * line determined by this Line2D. - * - * @param p the test point + * Gives the distance between the point and the line determined by this + * Line2D. * - * @return the distance between the point and the - * line determined by this Line2D + * @param p + * the test point. + * @return the distance between the point and the line determined by this + * Line2D. */ public double ptLineDist(Point2D p) { return ptLineDist(getX1(), getY1(), getX2(), getY2(), p.getX(), p.getY()); diff --git a/awt/java/awt/geom/NoninvertibleTransformException.java b/awt/java/awt/geom/NoninvertibleTransformException.java index 2b7b542476823..a4e6f0f859525 100644 --- a/awt/java/awt/geom/NoninvertibleTransformException.java +++ b/awt/java/awt/geom/NoninvertibleTransformException.java @@ -18,26 +18,31 @@ * @author Denis M. Kishenko * @version $Revision$ */ + package java.awt.geom; /** - * The Class NoninvertibleTransformException is the exception that is thrown - * when an action requires inverting an {@link AffineTransform} that is - * not invertible (has determinant 0). + * The Class NoninvertibleTransformException is the exception that is thrown + * when an action requires inverting an {@link AffineTransform} that is not + * invertible (has determinant 0). + * + * @since Android 1.0 */ public class NoninvertibleTransformException extends java.lang.Exception { - /** The Constant serialVersionUID. */ + /** + * The Constant serialVersionUID. + */ private static final long serialVersionUID = 6137225240503990466L; /** - * Instantiates a new noninvertible transform exception. + * Instantiates a new non-invertible transform exception. * - * @param s the error message + * @param s + * the error message. */ public NoninvertibleTransformException(String s) { super(s); } } - diff --git a/awt/java/awt/geom/PathIterator.java b/awt/java/awt/geom/PathIterator.java index 5a98083473f5a..2d1c0ffa641b1 100644 --- a/awt/java/awt/geom/PathIterator.java +++ b/awt/java/awt/geom/PathIterator.java @@ -18,72 +18,87 @@ * @author Denis M. Kishenko * @version $Revision$ */ + package java.awt.geom; /** - * The Interface PathIterator represents an iterator object that can - * be used to traverse the outline of a {@link java.awt.Shape}. - * It returns points along the boundary of the Shape - * which may be actual vertices (in the case of a shape made of line - * segments) or may be points on a curved segment with the distance - * between the points determined by a chosen flattening factor. + * The Interface PathIterator represents an iterator object that can be used to + * traverse the outline of a {@link java.awt.Shape}. It returns points along the + * boundary of the Shape which may be actual vertices (in the case of a shape + * made of line segments) or may be points on a curved segment with the distance + * between the points determined by a chosen flattening factor. *

    - * If the shape is closed, the outline is traversed in the counter-clockwise - * direction. That means that moving forward along the boundary is to travel - * in such a way that the interior of the shape is to the left of the - * outline path and the exterior of the shape is to the right of the outline - * path. The interior and exterior of the shape are determined by a - * winding rule. + * If the shape is closed, the outline is traversed in the counter-clockwise + * direction. That means that moving forward along the boundary is to travel in + * such a way that the interior of the shape is to the left of the outline path + * and the exterior of the shape is to the right of the outline path. The + * interior and exterior of the shape are determined by a winding rule. + *

    + * + * @since Android 1.0 */ public interface PathIterator { - /** The Constant WIND_EVEN_ODD indicates the winding rule that says - * that a point is outside the shape if any infinite ray from the point - * crosses the outline of the shape an even number of times, otherwise - * it is inside. */ + /** + * The Constant WIND_EVEN_ODD indicates the winding rule that says that a + * point is outside the shape if any infinite ray from the point crosses the + * outline of the shape an even number of times, otherwise it is inside. + */ public static final int WIND_EVEN_ODD = 0; - - /** The Constant WIND_NON_ZERO indicates the winding rule that says that - * a point is inside the shape if every infinite ray starting from that - * point crosses the outline of the shape a non-zero number of times. */ + + /** + * The Constant WIND_NON_ZERO indicates the winding rule that says that a + * point is inside the shape if every infinite ray starting from that point + * crosses the outline of the shape a non-zero number of times. + */ public static final int WIND_NON_ZERO = 1; - /** The Constant SEG_MOVETO indicates that to follow the shape's outline - * from the previous point to the current point, the cursor (traversal - * point) should be placed directly on the current point. */ - public static final int SEG_MOVETO = 0; - - /** The Constant SEG_LINETO indicates that to follow the shape's outline - * from the previous point to the current point, the cursor (traversal - * point) should follow a straight line. */ - public static final int SEG_LINETO = 1; - - /** The Constant SEG_QUADTO indicates that to follow the shape's outline - * from the previous point to the current point, the cursor (traversal - * point) should follow a quadratic curve. */ - public static final int SEG_QUADTO = 2; - - /** The Constant SEG_CUBICTO indicates that to follow the shape's outline - * from the previous point to the current point, the cursor (traversal - * point) should follow a cubic curve. */ + /** + * The Constant SEG_MOVETO indicates that to follow the shape's outline from + * the previous point to the current point, the cursor (traversal point) + * should be placed directly on the current point. + */ + public static final int SEG_MOVETO = 0; + + /** + * The Constant SEG_LINETO indicates that to follow the shape's outline from + * the previous point to the current point, the cursor (traversal point) + * should follow a straight line. + */ + public static final int SEG_LINETO = 1; + + /** + * The Constant SEG_QUADTO indicates that to follow the shape's outline from + * the previous point to the current point, the cursor (traversal point) + * should follow a quadratic curve. + */ + public static final int SEG_QUADTO = 2; + + /** + * The Constant SEG_CUBICTO indicates that to follow the shape's outline + * from the previous point to the current point, the cursor (traversal + * point) should follow a cubic curve. + */ public static final int SEG_CUBICTO = 3; - - /** The Constant SEG_CLOSE indicates that the previous point was the end - * of the shape's outline. */ - public static final int SEG_CLOSE = 4; + + /** + * The Constant SEG_CLOSE indicates that the previous point was the end of + * the shape's outline. + */ + public static final int SEG_CLOSE = 4; /** * Gets the winding rule, either {@link PathIterator#WIND_EVEN_ODD} or * {@link PathIterator#WIND_NON_ZERO}. * - * @return the winding rule + * @return the winding rule. */ public int getWindingRule(); /** * Checks if this PathIterator has been completely traversed. * - * @return true, if this PathIterator has been completely traversed + * @return true, if this PathIterator has been completely traversed. */ public boolean isDone(); @@ -93,40 +108,39 @@ public interface PathIterator { public void next(); /** - * Gets the coordinates of the next vertex point along the shape's outline - * and a flag that indicates what kind of segment to use in order to - * connect the previous vertex point to the current vertex point to form - * the current segment. - * - * @param coords the array that the coordinates of the end point of the current - * segment are written into. + * Gets the coordinates of the next vertex point along the shape's outline + * and a flag that indicates what kind of segment to use in order to connect + * the previous vertex point to the current vertex point to form the current + * segment. * - * @return the flag that indicates how to follow the shape's outline - * from the previous point to the current one, chosen from - * the following constants: - * {@link PathIterator#SEG_MOVETO}, {@link PathIterator#SEG_LINETO}, - * {@link PathIterator#SEG_QUADTO}, {@link PathIterator#SEG_CUBICTO}, - * or {@link PathIterator#SEG_CLOSE} + * @param coords + * the array that the coordinates of the end point of the current + * segment are written into. + * @return the flag that indicates how to follow the shape's outline from + * the previous point to the current one, chosen from the following + * constants: {@link PathIterator#SEG_MOVETO}, + * {@link PathIterator#SEG_LINETO}, {@link PathIterator#SEG_QUADTO}, + * {@link PathIterator#SEG_CUBICTO}, or + * {@link PathIterator#SEG_CLOSE}. */ public int currentSegment(float[] coords); /** - * Gets the coordinates of the next vertex point along the shape's outline - * and a flag that indicates what kind of segment to use in order to - * connect the previous vertex point to the current vertex point to form - * the current segment. + * Gets the coordinates of the next vertex point along the shape's outline + * and a flag that indicates what kind of segment to use in order to connect + * the previous vertex point to the current vertex point to form the current + * segment. * - * @param coords the array that the coordinates of the end point of the current - * segment are written into. - * - * @return the flag that indicates how to follow the shape's outline - * from the previous point to the current one, chosen from - * the following constants: - * {@link PathIterator#SEG_MOVETO}, {@link PathIterator#SEG_LINETO}, - * {@link PathIterator#SEG_QUADTO}, {@link PathIterator#SEG_CUBICTO}, - * or {@link PathIterator#SEG_CLOSE} + * @param coords + * the array that the coordinates of the end point of the current + * segment are written into. + * @return the flag that indicates how to follow the shape's outline from + * the previous point to the current one, chosen from the following + * constants: {@link PathIterator#SEG_MOVETO}, + * {@link PathIterator#SEG_LINETO}, {@link PathIterator#SEG_QUADTO}, + * {@link PathIterator#SEG_CUBICTO}, or + * {@link PathIterator#SEG_CLOSE}. */ public int currentSegment(double[] coords); } - diff --git a/awt/java/awt/geom/Point2D.java b/awt/java/awt/geom/Point2D.java index 7719e674e6529..f7026c8c6a031 100644 --- a/awt/java/awt/geom/Point2D.java +++ b/awt/java/awt/geom/Point2D.java @@ -18,40 +18,51 @@ * @author Denis M. Kishenko * @version $Revision$ */ + package java.awt.geom; import org.apache.harmony.misc.HashCode; /** - * The Class Point2D represents a point whose data is given in - * high-precision values appropriate for graphical operations. + * The Class Point2D represents a point whose data is given in high-precision + * values appropriate for graphical operations. + * + * @since Android 1.0 */ public abstract class Point2D implements Cloneable { /** - * The Class Float is the subclass of Point2D that has all - * of its data values stored with float-level precision. + * The Class Float is the subclass of Point2D that has all of its data + * values stored with float-level precision. + * + * @since Android 1.0 */ public static class Float extends Point2D { - /** The x coordinate. */ + /** + * The x coordinate. + */ public float x; - - /** The y coordinate. */ + + /** + * The y coordinate. + */ public float y; /** - * Instantiates a new float-valued Point2D with its data - * set to zero. + * Instantiates a new float-valued Point2D with its data set to zero. */ public Float() { } /** - * Instantiates a new float-valued Point2D with the specified coordinates. + * Instantiates a new float-valued Point2D with the specified + * coordinates. * - * @param x the x coordinate - * @param y the y coordinate + * @param x + * the x coordinate. + * @param y + * the y coordinate. */ public Float(float x, float y) { this.x = x; @@ -71,8 +82,10 @@ public abstract class Point2D implements Cloneable { /** * Sets the point's coordinates. * - * @param x the x coordinate - * @param y the y coordinate + * @param x + * the x coordinate. + * @param y + * the y coordinate. */ public void setLocation(float x, float y) { this.x = x; @@ -92,29 +105,37 @@ public abstract class Point2D implements Cloneable { } /** - * The Class Double is the subclass of Point2D that has all - * of its data values stored with double-level precision. + * The Class Double is the subclass of Point2D that has all of its data + * values stored with double-level precision. + * + * @since Android 1.0 */ public static class Double extends Point2D { - /** The x coordinate. */ + /** + * The x coordinate. + */ public double x; - - /** The y coordinate. */ + + /** + * The y coordinate. + */ public double y; /** - * Instantiates a new double-valued Point2D with its data - * set to zero. + * Instantiates a new double-valued Point2D with its data set to zero. */ public Double() { } /** - * Instantiates a new double-valued Point2D with the specified coordinates. + * Instantiates a new double-valued Point2D with the specified + * coordinates. * - * @param x the x coordinate - * @param y the y coordinate + * @param x + * the x coordinate. + * @param y + * the y coordinate. */ public Double(double x, double y) { this.x = x; @@ -152,29 +173,32 @@ public abstract class Point2D implements Cloneable { /** * Gets the x coordinate. * - * @return the x coordinate + * @return the x coordinate. */ public abstract double getX(); /** * Gets the y coordinate. * - * @return the y coordinate + * @return the y coordinate. */ public abstract double getY(); /** * Sets the point's coordinates. * - * @param x the x coordinate - * @param y the y coordinate + * @param x + * the x coordinate. + * @param y + * the y coordinate. */ public abstract void setLocation(double x, double y); /** * Sets the point's coordinates by copying them from another point. * - * @param p the point to copy the data from + * @param p + * the point to copy the data from. */ public void setLocation(Point2D p) { setLocation(p.getX(), p.getY()); @@ -183,12 +207,15 @@ public abstract class Point2D implements Cloneable { /** * Finds the square of the distance between the two specified points. * - * @param x1 the x coordinate of the first point - * @param y1 the y coordinate of the first point - * @param x2 the x coordinate of the second point - * @param y2 the y coordinate of the second point - * - * @return the square of the distance between the two specified points + * @param x1 + * the x coordinate of the first point. + * @param y1 + * the y coordinate of the first point. + * @param x2 + * the x coordinate of the second point. + * @param y2 + * the y coordinate of the second point. + * @return the square of the distance between the two specified points. */ public static double distanceSq(double x1, double y1, double x2, double y2) { x2 -= x1; @@ -197,23 +224,28 @@ public abstract class Point2D implements Cloneable { } /** - * Finds the square of the distance between this point and the specified point. - * - * @param px the x coordinate of the point - * @param py the y coordinate of the point + * Finds the square of the distance between this point and the specified + * point. * - * @return the square of the distance between this point and the specified point + * @param px + * the x coordinate of the point. + * @param py + * the y coordinate of the point. + * @return the square of the distance between this point and the specified + * point. */ public double distanceSq(double px, double py) { return Point2D.distanceSq(getX(), getY(), px, py); } /** - * Finds the square of the distance between this point and the specified point. + * Finds the square of the distance between this point and the specified + * point. * - * @param p the other point - * - * @return the square of the distance between this point and the specified point + * @param p + * the other point. + * @return the square of the distance between this point and the specified + * point. */ public double distanceSq(Point2D p) { return Point2D.distanceSq(getX(), getY(), p.getX(), p.getY()); @@ -222,12 +254,15 @@ public abstract class Point2D implements Cloneable { /** * Finds the distance between the two specified points. * - * @param x1 the x coordinate of the first point - * @param y1 the y coordinate of the first point - * @param x2 the x coordinate of the second point - * @param y2 the y coordinate of the second point - * - * @return the distance between the two specified points + * @param x1 + * the x coordinate of the first point. + * @param y1 + * the y coordinate of the first point. + * @param x2 + * the x coordinate of the second point. + * @param y2 + * the y coordinate of the second point. + * @return the distance between the two specified points. */ public static double distance(double x1, double y1, double x2, double y2) { return Math.sqrt(distanceSq(x1, y1, x2, y2)); @@ -236,10 +271,11 @@ public abstract class Point2D implements Cloneable { /** * Finds the distance between this point and the specified point. * - * @param px the x coordinate of the point - * @param py the y coordinate of the point - * - * @return the distance between this point and the specified point + * @param px + * the x coordinate of the point. + * @param py + * the y coordinate of the point. + * @return the distance between this point and the specified point. */ public double distance(double px, double py) { return Math.sqrt(distanceSq(px, py)); @@ -248,9 +284,9 @@ public abstract class Point2D implements Cloneable { /** * Finds the distance between this point and the specified point. * - * @param p the other point - * - * @return the distance between this point and the specified point + * @param p + * the other point. + * @return the distance between this point and the specified point. */ public double distance(Point2D p) { return Math.sqrt(distanceSq(p)); @@ -279,10 +315,9 @@ public abstract class Point2D implements Cloneable { return true; } if (obj instanceof Point2D) { - Point2D p = (Point2D) obj; + Point2D p = (Point2D)obj; return getX() == p.getX() && getY() == p.getY(); } return false; } } - diff --git a/awt/java/awt/geom/QuadCurve2D.java b/awt/java/awt/geom/QuadCurve2D.java index 64ea6d68b8bb1..7a86a4840fb7c 100644 --- a/awt/java/awt/geom/QuadCurve2D.java +++ b/awt/java/awt/geom/QuadCurve2D.java @@ -18,6 +18,7 @@ * @author Denis M. Kishenko * @version $Revision$ */ + package java.awt.geom; import java.awt.Rectangle; @@ -28,42 +29,58 @@ import org.apache.harmony.awt.gl.Crossing; import org.apache.harmony.awt.internal.nls.Messages; /** - * The Class QuadCurve2D is a Shape that represents a segment of a - * quadratic (Bezier) curve. The curved segment is determined by three points: - * a start point, an end point, and a control point. The line from the control - * point to the starting point gives the tangent to the curve at the - * starting point, and the line from the control point to the end point - * gives the tangent to the curve at the end point. + * The Class QuadCurve2D is a Shape that represents a segment of a quadratic + * (Bezier) curve. The curved segment is determined by three points: a start + * point, an end point, and a control point. The line from the control point to + * the starting point gives the tangent to the curve at the starting point, and + * the line from the control point to the end point gives the tangent to the + * curve at the end point. + * + * @since Android 1.0 */ public abstract class QuadCurve2D implements Shape, Cloneable { /** - * The Class Float is the subclass of QuadCurve2D that has all - * of its data values stored with float-level precision. + * The Class Float is the subclass of QuadCurve2D that has all of its data + * values stored with float-level precision. + * + * @since Android 1.0 */ public static class Float extends QuadCurve2D { - /** The x coordinate of the starting point of the curved segment. */ + /** + * The x coordinate of the starting point of the curved segment. + */ public float x1; - - /** The y coordinate of the starting point of the curved segment. */ + + /** + * The y coordinate of the starting point of the curved segment. + */ public float y1; - - /** The x coordinate of the control point. */ + + /** + * The x coordinate of the control point. + */ public float ctrlx; - - /** The y coordinate of the control point. */ + + /** + * The y coordinate of the control point. + */ public float ctrly; - - /** The x coordinate of the end point of the curved segment. */ + + /** + * The x coordinate of the end point of the curved segment. + */ public float x2; - - /** The y coordinate of the end point of the curved segment. */ + + /** + * The y coordinate of the end point of the curved segment. + */ public float y2; /** - * Instantiates a new float-valued QuadCurve2D with all coordinate values - * set to zero. + * Instantiates a new float-valued QuadCurve2D with all coordinate + * values set to zero. */ public Float() { } @@ -72,12 +89,20 @@ public abstract class QuadCurve2D implements Shape, Cloneable { * Instantiates a new float-valued QuadCurve2D with the specified * coordinate values. * - * @param x1 the x coordinate of the starting point of the curved segment - * @param y1 the y coordinate of the starting point of the curved segment - * @param ctrlx the x coordinate of the control point - * @param ctrly the y coordinate of the control point - * @param x2 the x coordinate of the end point of the curved segment - * @param y2 the y coordinate of the end point of the curved segment + * @param x1 + * the x coordinate of the starting point of the curved + * segment. + * @param y1 + * the y coordinate of the starting point of the curved + * segment. + * @param ctrlx + * the x coordinate of the control point. + * @param ctrly + * the y coordinate of the control point. + * @param x2 + * the x coordinate of the end point of the curved segment. + * @param y2 + * the y coordinate of the end point of the curved segment. */ public Float(float x1, float y1, float ctrlx, float ctrly, float x2, float y2) { setCurve(x1, y1, ctrlx, ctrly, x2, y2); @@ -141,12 +166,20 @@ public abstract class QuadCurve2D implements Shape, Cloneable { /** * Sets the data values of the curve. * - * @param x1 the x coordinate of the starting point of the curved segment - * @param y1 the y coordinate of the starting point of the curved segment - * @param ctrlx the x coordinate of the control point - * @param ctrly the y coordinate of the control point - * @param x2 the x coordinate of the end point of the curved segment - * @param y2 the y coordinate of the end point of the curved segment + * @param x1 + * the x coordinate of the starting point of the curved + * segment. + * @param y1 + * the y coordinate of the starting point of the curved + * segment. + * @param ctrlx + * the x coordinate of the control point. + * @param ctrly + * the y coordinate of the control point. + * @param x2 + * the x coordinate of the end point of the curved segment. + * @param y2 + * the y coordinate of the end point of the curved segment. */ public void setCurve(float x1, float y1, float ctrlx, float ctrly, float x2, float y2) { this.x1 = x1; @@ -167,32 +200,46 @@ public abstract class QuadCurve2D implements Shape, Cloneable { } /** - * The Class Double is the subclass of QuadCurve2D that has all - * of its data values stored with double-level precision. + * The Class Double is the subclass of QuadCurve2D that has all of its data + * values stored with double-level precision. + * + * @since Android 1.0 */ public static class Double extends QuadCurve2D { - /** The x coordinate of the starting point of the curved segment. */ + /** + * The x coordinate of the starting point of the curved segment. + */ public double x1; - - /** The y coordinate of the starting point of the curved segment. */ + + /** + * The y coordinate of the starting point of the curved segment. + */ public double y1; - - /** The x coordinate of the control point. */ + + /** + * The x coordinate of the control point. + */ public double ctrlx; - - /** The y coordinate of the control point. */ + + /** + * The y coordinate of the control point. + */ public double ctrly; - - /** The x coordinate of the end point of the curved segment. */ + + /** + * The x coordinate of the end point of the curved segment. + */ public double x2; - - /** The y coordinate of the end point of the curved segment. */ + + /** + * The y coordinate of the end point of the curved segment. + */ public double y2; /** - * Instantiates a new double-valued QuadCurve2D with all coordinate values - * set to zero. + * Instantiates a new double-valued QuadCurve2D with all coordinate + * values set to zero. */ public Double() { } @@ -201,12 +248,20 @@ public abstract class QuadCurve2D implements Shape, Cloneable { * Instantiates a new double-valued QuadCurve2D with the specified * coordinate values. * - * @param x1 the x coordinate of the starting point of the curved segment - * @param y1 the y coordinate of the starting point of the curved segment - * @param ctrlx the x coordinate of the control point - * @param ctrly the y coordinate of the control point - * @param x2 the x coordinate of the end point of the curved segment - * @param y2 the y coordinate of the end point of the curved segment + * @param x1 + * the x coordinate of the starting point of the curved + * segment. + * @param y1 + * the y coordinate of the starting point of the curved + * segment. + * @param ctrlx + * the x coordinate of the control point. + * @param ctrly + * the y coordinate of the control point. + * @param x2 + * the x coordinate of the end point of the curved segment. + * @param y2 + * the y coordinate of the end point of the curved segment. */ public Double(double x1, double y1, double ctrlx, double ctrly, double x2, double y2) { setCurve(x1, y1, ctrlx, ctrly, x2, y2); @@ -277,28 +332,37 @@ public abstract class QuadCurve2D implements Shape, Cloneable { } /* - * QuadCurve2D path iterator + * QuadCurve2D path iterator */ /** * The PathIterator for a Quad2D curve. */ class Iterator implements PathIterator { - /** The source QuadCurve2D object. */ + /** + * The source QuadCurve2D object. + */ QuadCurve2D c; - /** The path iterator transformation. */ + /** + * The path iterator transformation. + */ AffineTransform t; - /** The current segment index. */ + /** + * The current segment index. + */ int index; /** - * Constructs a new QuadCurve2D.Iterator for given curve and transformation + * Constructs a new QuadCurve2D.Iterator for given curve and + * transformation * - * @param q - the source QuadCurve2D object - * @param t the AffineTransform that acts on the coordinates before - * returning them (or null) + * @param q + * the source QuadCurve2D object. + * @param t + * the AffineTransform that acts on the coordinates before + * returning them (or null). */ Iterator(QuadCurve2D q, AffineTransform t) { this.c = q; @@ -380,284 +444,307 @@ public abstract class QuadCurve2D implements Shape, Cloneable { /** * Gets the x coordinate of the starting point. * - * @return the x coordinate of the starting point + * @return the x coordinate of the starting point. */ public abstract double getX1(); /** * Gets the y coordinate of the starting point. * - * @return the y coordinate of the starting point + * @return the y coordinate of the starting point. */ public abstract double getY1(); /** * Gets the starting point. * - * @return the starting point + * @return the starting point. */ public abstract Point2D getP1(); /** * Gets the x coordinate of the control point. * - * @return the x coordinate of the control point + * @return the x coordinate of the control point. */ public abstract double getCtrlX(); /** * Gets the y coordinate of the control point. * - * @return y coordinate of the control point + * @return y coordinate of the control point. */ public abstract double getCtrlY(); /** * Gets the control point. * - * @return the control point + * @return the control point. */ public abstract Point2D getCtrlPt(); /** * Gets the x coordinate of the end point. * - * @return the x coordinate of the end point + * @return the x coordinate of the end point. */ public abstract double getX2(); /** * Gets the y coordinate of the end point. * - * @return the y coordinate of the end point + * @return the y coordinate of the end point. */ public abstract double getY2(); /** * Gets the end point. * - * @return the end point + * @return the end point. */ public abstract Point2D getP2(); /** * Sets the data of the curve. * - * @param x1 the x coordinate of the starting point of the curved segment - * @param y1 the y coordinate of the starting point of the curved segment - * @param ctrlx the x coordinate of the control point - * @param ctrly the y coordinate of the control point - * @param x2 the x coordinate of the end point of the curved segment - * @param y2 the y coordinate of the end point of the curved segment + * @param x1 + * the x coordinate of the starting point of the curved segment. + * @param y1 + * the y coordinate of the starting point of the curved segment. + * @param ctrlx + * the x coordinate of the control point. + * @param ctrly + * the y coordinate of the control point. + * @param x2 + * the x coordinate of the end point of the curved segment. + * @param y2 + * the y coordinate of the end point of the curved segment. */ - public abstract void setCurve(double x1, double y1, double ctrlx, double ctrly, double x2, double y2); + public abstract void setCurve(double x1, double y1, double ctrlx, double ctrly, double x2, + double y2); /** * Sets the data of the curve. * - * @param p1 the starting point of the curved segment - * @param cp the control point - * @param p2 the end point of the curved segment - * - * @throws NullPointerException if any of the three points is null. + * @param p1 + * the starting point of the curved segment. + * @param cp + * the control point. + * @param p2 + * the end point of the curved segment. + * @throws NullPointerException + * if any of the three points is null. */ public void setCurve(Point2D p1, Point2D cp, Point2D p2) { setCurve(p1.getX(), p1.getY(), cp.getX(), cp.getY(), p2.getX(), p2.getY()); } /** - * Sets the data of the curve by reading the data from an array - * of values. The values are read in the same order as the arguments - * of the method {@link QuadCurve2D#setCurve(double, double, double, double, double, double)}. - * - * @param coords the array of values containing the new coordinates - * @param offset the offset of the data to read within the array - * - * @throws ArrayIndexOutOfBoundsException if coords.length < offset + 6. - * @throws NullPointerException if the coordinate array is null. + * Sets the data of the curve by reading the data from an array of values. + * The values are read in the same order as the arguments of the method + * {@link QuadCurve2D#setCurve(double, double, double, double, double, double)} + * . + * + * @param coords + * the array of values containing the new coordinates. + * @param offset + * the offset of the data to read within the array. + * @throws ArrayIndexOutOfBoundsException + * if {@code coords.length} < offset + 6. + * @throws NullPointerException + * if the coordinate array is null. */ public void setCurve(double[] coords, int offset) { - setCurve( - coords[offset + 0], coords[offset + 1], - coords[offset + 2], coords[offset + 3], + setCurve(coords[offset + 0], coords[offset + 1], coords[offset + 2], coords[offset + 3], coords[offset + 4], coords[offset + 5]); } /** - * Sets the data of the curve by reading the data from an array - * of points. The values are read in the same order as the arguments - * of the method {@link QuadCurve2D#setCurve(Point2D, Point2D, Point2D)} - * - * @param points the array of points containing the new coordinates - * @param offset the offset of the data to read within the array - * - * @throws ArrayIndexOutOfBoundsException if points.length < offset + 3. - * @throws NullPointerException if the point array is null. + * Sets the data of the curve by reading the data from an array of points. + * The values are read in the same order as the arguments of the method + * {@link QuadCurve2D#setCurve(Point2D, Point2D, Point2D)}. + * + * @param points + * the array of points containing the new coordinates. + * @param offset + * the offset of the data to read within the array. + * @throws ArrayIndexOutOfBoundsException + * if points.length < offset + 3. + * @throws NullPointerException + * if the point array is null. */ public void setCurve(Point2D[] points, int offset) { - setCurve( - points[offset + 0].getX(), points[offset + 0].getY(), - points[offset + 1].getX(), points[offset + 1].getY(), - points[offset + 2].getX(), points[offset + 2].getY()); + setCurve(points[offset + 0].getX(), points[offset + 0].getY(), points[offset + 1].getX(), + points[offset + 1].getY(), points[offset + 2].getX(), points[offset + 2].getY()); } /** * Sets the data of the curve by copying it from another QuadCurve2D. * - * @param curve the curve to copy the data points from - * - * @throws NullPointerException if the curve is null. + * @param curve + * the curve to copy the data points from. + * @throws NullPointerException + * if the curve is null. */ public void setCurve(QuadCurve2D curve) { - setCurve( - curve.getX1(), curve.getY1(), - curve.getCtrlX(), curve.getCtrlY(), - curve.getX2(), curve.getY2()); + setCurve(curve.getX1(), curve.getY1(), curve.getCtrlX(), curve.getCtrlY(), curve.getX2(), + curve.getY2()); } /** - * Gets the square of the distance from the control point to the - * straight line segment connecting the start point and the end point - * for this curve. + * Gets the square of the distance from the control point to the straight + * line segment connecting the start point and the end point for this curve. * - * @return the square of the distance from the control point to the - * straight line segment connecting the start point and the end point. + * @return the square of the distance from the control point to the straight + * line segment connecting the start point and the end point. */ public double getFlatnessSq() { - return Line2D.ptSegDistSq( - getX1(), getY1(), - getX2(), getY2(), - getCtrlX(), getCtrlY()); + return Line2D.ptSegDistSq(getX1(), getY1(), getX2(), getY2(), getCtrlX(), getCtrlY()); } /** - * Gets the square of the distance from the control point to the - * straight line segment connecting the start point and the end point. - * - * @param x1 the x coordinate of the starting point of the curved segment - * @param y1 the y coordinate of the starting point of the curved segment - * @param ctrlx the x coordinate of the control point - * @param ctrly the y coordinate of the control point - * @param x2 the x coordinate of the end point of the curved segment - * @param y2 the y coordinate of the end point of the curved segment - * - * @return the square of the distance from the control point to the - * straight line segment connecting the start point and the end point. + * Gets the square of the distance from the control point to the straight + * line segment connecting the start point and the end point. + * + * @param x1 + * the x coordinate of the starting point of the curved segment. + * @param y1 + * the y coordinate of the starting point of the curved segment. + * @param ctrlx + * the x coordinate of the control point. + * @param ctrly + * the y coordinate of the control point. + * @param x2 + * the x coordinate of the end point of the curved segment. + * @param y2 + * the y coordinate of the end point of the curved segment. + * @return the square of the distance from the control point to the straight + * line segment connecting the start point and the end point. */ - public static double getFlatnessSq(double x1, double y1, double ctrlx, double ctrly, double x2, double y2) { + public static double getFlatnessSq(double x1, double y1, double ctrlx, double ctrly, double x2, + double y2) { return Line2D.ptSegDistSq(x1, y1, x2, y2, ctrlx, ctrly); } /** - * Gets the square of the distance from the control point to the - * straight line segment connecting the start point and the end point - * by reading the coordinates of the points from an array of values. - * The values are read in the same order as the arguments - * of the method {@link QuadCurve2D#getFlatnessSq(double, double, double, double, double, double)}. - * - * @param coords the array of points containing the coordinates to use for - * the calculation - * @param offset the offset of the data to read within the array - * - * @return the square of the distance from the control point to the - * straight line segment connecting the start point and the end point. - * - * @throws ArrayIndexOutOfBoundsException if coords.length < offset + 6. - * @throws NullPointerException if the coordinate array is null. + * Gets the square of the distance from the control point to the straight + * line segment connecting the start point and the end point by reading the + * coordinates of the points from an array of values. The values are read in + * the same order as the arguments of the method + * {@link QuadCurve2D#getFlatnessSq(double, double, double, double, double, double)} + * . + * + * @param coords + * the array of points containing the coordinates to use for the + * calculation + * @param offset + * the offset of the data to read within the array + * @return the square of the distance from the control point to the straight + * line segment connecting the start point and the end point. + * @throws ArrayIndexOutOfBoundsException + * if {@code coords.length} < offset + 6. + * @throws NullPointerException + * if the coordinate array is null. */ public static double getFlatnessSq(double coords[], int offset) { - return Line2D.ptSegDistSq( - coords[offset + 0], coords[offset + 1], - coords[offset + 4], coords[offset + 5], - coords[offset + 2], coords[offset + 3]); + return Line2D.ptSegDistSq(coords[offset + 0], coords[offset + 1], coords[offset + 4], + coords[offset + 5], coords[offset + 2], coords[offset + 3]); } /** - * Gets the distance from the control point to the - * straight line segment connecting the start point and the end point - * of this QuadCurve2D. + * Gets the distance from the control point to the straight line segment + * connecting the start point and the end point of this QuadCurve2D. * - * @return the the distance from the control point to the - * straight line segment connecting the start point and the end point - * of this QuadCurve2D + * @return the the distance from the control point to the straight line + * segment connecting the start point and the end point of this + * QuadCurve2D. */ public double getFlatness() { return Line2D.ptSegDist(getX1(), getY1(), getX2(), getY2(), getCtrlX(), getCtrlY()); } /** - * Gets the distance from the control point to the - * straight line segment connecting the start point and the end point. - * - * @param x1 the x coordinate of the starting point of the curved segment - * @param y1 the y coordinate of the starting point of the curved segment - * @param ctrlx the x coordinate of the control point - * @param ctrly the y coordinate of the control point - * @param x2 the x coordinate of the end point of the curved segment - * @param y2 the y coordinate of the end point of the curved segment - * - * @return the the distance from the control point to the - * straight line segment connecting the start point and the end point + * Gets the distance from the control point to the straight line segment + * connecting the start point and the end point. + * + * @param x1 + * the x coordinate of the starting point of the curved segment. + * @param y1 + * the y coordinate of the starting point of the curved segment. + * @param ctrlx + * the x coordinate of the control point. + * @param ctrly + * the y coordinate of the control point. + * @param x2 + * the x coordinate of the end point of the curved segment. + * @param y2 + * the y coordinate of the end point of the curved segment. + * @return the the distance from the control point to the straight line + * segment connecting the start point and the end point. */ - public static double getFlatness(double x1, double y1, double ctrlx, - double ctrly, double x2, double y2) - { + public static double getFlatness(double x1, double y1, double ctrlx, double ctrly, double x2, + double y2) { return Line2D.ptSegDist(x1, y1, x2, y2, ctrlx, ctrly); } /** - * Gets the the distance from the control point to the - * straight line segment connecting the start point and the end point. - * The values are read in the same order as the arguments - * of the method {@link QuadCurve2D#getFlatness(double, double, double, double, double, double)}. - * - * @param coords the array of points containing the coordinates to use for - * the calculation - * @param offset the offset of the data to read within the array - * - * @return the the distance from the control point to the - * straight line segment connecting the start point and the end point - * - * @throws ArrayIndexOutOfBoundsException if coords.length < offset + 6. - * @throws NullPointerException if the coordinate array is null. + * Gets the the distance from the control point to the straight line segment + * connecting the start point and the end point. The values are read in the + * same order as the arguments of the method + * {@link QuadCurve2D#getFlatness(double, double, double, double, double, double)} + * . + * + * @param coords + * the array of points containing the coordinates to use for the + * calculation. + * @param offset + * the offset of the data to read within the array. + * @return the the distance from the control point to the straight line + * segment connecting the start point and the end point. + * @throws ArrayIndexOutOfBoundsException + * if {code coords.length} < offset + 6. + * @throws NullPointerException + * if the coordinate array is null. */ public static double getFlatness(double coords[], int offset) { - return Line2D.ptSegDist( - coords[offset + 0], coords[offset + 1], - coords[offset + 4], coords[offset + 5], - coords[offset + 2], coords[offset + 3]); + return Line2D.ptSegDist(coords[offset + 0], coords[offset + 1], coords[offset + 4], + coords[offset + 5], coords[offset + 2], coords[offset + 3]); } /** - * Creates the data for two quadratic curves by dividing this - * curve in two. The division point is the point on the curve - * that is closest to this curve's control point. The data of - * this curve is left unchanged. - * - * @param left the QuadCurve2D where the left (start) segment's - * data is written - * @param right the QuadCurve2D where the right (end) segment's - * data is written - * - * @throws NullPointerException if either curve is null. + * Creates the data for two quadratic curves by dividing this curve in two. + * The division point is the point on the curve that is closest to this + * curve's control point. The data of this curve is left unchanged. + * + * @param left + * the QuadCurve2D where the left (start) segment's data is + * written. + * @param right + * the QuadCurve2D where the right (end) segment's data is + * written. + * @throws NullPointerException + * if either curve is null. */ public void subdivide(QuadCurve2D left, QuadCurve2D right) { subdivide(this, left, right); } /** - * Creates the data for two quadratic curves by dividing a source - * curve in two. The division point is the point on the curve - * that is closest to the source curve's control point. The data of - * the source curve is left unchanged. - * - * @param src the curve that provides the initial data - * @param left the QuadCurve2D where the left (start) segment's - * data is written - * @param right the QuadCurve2D where the right (end) segment's - * data is written - * - * @throws NullPointerException if one of the curves is null. + * Creates the data for two quadratic curves by dividing a source curve in + * two. The division point is the point on the curve that is closest to the + * source curve's control point. The data of the source curve is left + * unchanged. + * + * @param src + * the curve that provides the initial data. + * @param left + * the QuadCurve2D where the left (start) segment's data is + * written. + * @param right + * the QuadCurve2D where the right (end) segment's data is + * written. + * @throws NullPointerException + * if one of the curves is null. */ public static void subdivide(QuadCurve2D src, QuadCurve2D left, QuadCurve2D right) { double x1 = src.getX1(); @@ -681,26 +768,33 @@ public abstract class QuadCurve2D implements Shape, Cloneable { } /** - * Creates the data for two quadratic curves by dividing a source - * curve in two. The division point is the point on the curve - * that is closest to the source curve's control point. The data - * for the three curves is read and written from arrays of values in - * the usual order: x1, y1, cx, cy, x2, y2. - * - * @param src the array that gives the data values for the source curve - * @param srcoff the offset in the src array to read the values from - * @param left the array where the coordinates of the start curve should be written - * @param leftOff the offset in the left array to start writing the values - * @param right the array where the coordinates of the end curve should be written - * @param rightOff the offset in the right array to start writing the values - * - * @throws ArrayIndexOutOfBoundsException if src.length < srcoff + 6 - * or if left.length < leftOff + 6 or if right.length < rightOff + 6. - * @throws NullPointerException if one of the arrays is null. + * Creates the data for two quadratic curves by dividing a source curve in + * two. The division point is the point on the curve that is closest to the + * source curve's control point. The data for the three curves is read and + * written from arrays of values in the usual order: x1, y1, cx, cy, x2, y2. + * + * @param src + * the array that gives the data values for the source curve. + * @param srcoff + * the offset in the src array to read the values from. + * @param left + * the array where the coordinates of the start curve should be + * written. + * @param leftOff + * the offset in the left array to start writing the values. + * @param right + * the array where the coordinates of the end curve should be + * written. + * @param rightOff + * the offset in the right array to start writing the values. + * @throws ArrayIndexOutOfBoundsException + * if {@code src.length} < srcoff + 6 or if {@code left.length} + * < leftOff + 6 or if {@code right.length} < rightOff + 6. + * @throws NullPointerException + * if one of the arrays is null. */ - public static void subdivide(double src[], int srcoff, double left[], - int leftOff, double right[], int rightOff) - { + public static void subdivide(double src[], int srcoff, double left[], int leftOff, + double right[], int rightOff) { double x1 = src[srcoff + 0]; double y1 = src[srcoff + 1]; double cx = src[srcoff + 2]; @@ -732,42 +826,43 @@ public abstract class QuadCurve2D implements Shape, Cloneable { } /** - * Finds the roots of the quadratic polynomial. This is - * accomplished by finding the (real) values of x that solve - * the following equation: eqn[2]*x*x + eqn[1]*x + eqn[0] = 0. - * The solutions are written back into the array eqn starting - * from the index 0 in the array. The return value tells how - * many array elements have been changed by this method call. - * - * @param eqn an array containing the coefficients of the - * quadratic polynomial to solve. - * - * @return the number of roots of the quadratic polynomial - * - * @throws ArrayIndexOutOfBoundsException if eqn.length < 3. - * @throws NullPointerException if the array is null. + * Finds the roots of the quadratic polynomial. This is accomplished by + * finding the (real) values of x that solve the following equation: + * eqn[2]*x*x + eqn[1]*x + eqn[0] = 0. The solutions are written back into + * the array eqn starting from the index 0 in the array. The return value + * tells how many array elements have been changed by this method call. + * + * @param eqn + * an array containing the coefficients of the quadratic + * polynomial to solve. + * @return the number of roots of the quadratic polynomial. + * @throws ArrayIndexOutOfBoundsException + * if {@code eqn.length} < 3. + * @throws NullPointerException + * if the array is null. */ public static int solveQuadratic(double eqn[]) { return solveQuadratic(eqn, eqn); } /** - * Finds the roots of the quadratic polynomial. This is - * accomplished by finding the (real) values of x that solve - * the following equation: eqn[2]*x*x + eqn[1]*x + eqn[0] = 0. - * The solutions are written into the array res starting - * from the index 0 in the array. The return value tells how - * many array elements have been written by this method call. - * - * @param eqn an array containing the coefficients of the - * quadratic polynomial to solve. - * @param res the array that this method writes the results into - * - * @return the number of roots of the quadratic polynomial - * - * @throws ArrayIndexOutOfBoundsException if eqn.length < 3 or - * if res.length is less than the number of roots. - * @throws NullPointerException if either array is null. + * Finds the roots of the quadratic polynomial. This is accomplished by + * finding the (real) values of x that solve the following equation: + * eqn[2]*x*x + eqn[1]*x + eqn[0] = 0. The solutions are written into the + * array res starting from the index 0 in the array. The return value tells + * how many array elements have been written by this method call. + * + * @param eqn + * an array containing the coefficients of the quadratic + * polynomial to solve. + * @param res + * the array that this method writes the results into. + * @return the number of roots of the quadratic polynomial. + * @throws ArrayIndexOutOfBoundsException + * if {@code eqn.length} < 3 or if {@code res.length} is less + * than the number of roots. + * @throws NullPointerException + * if either array is null. */ public static int solveQuadratic(double eqn[], double res[]) { return Crossing.solveQuad(eqn, res); @@ -821,4 +916,3 @@ public abstract class QuadCurve2D implements Shape, Cloneable { } } - diff --git a/awt/java/awt/geom/Rectangle2D.java b/awt/java/awt/geom/Rectangle2D.java index d33dd91d429d4..8166134afd617 100644 --- a/awt/java/awt/geom/Rectangle2D.java +++ b/awt/java/awt/geom/Rectangle2D.java @@ -18,6 +18,7 @@ * @author Denis M. Kishenko * @version $Revision$ */ + package java.awt.geom; import java.util.NoSuchElementException; @@ -26,44 +27,64 @@ import org.apache.harmony.awt.internal.nls.Messages; import org.apache.harmony.misc.HashCode; /** - * The Class Rectangle2D represents a rectangle whose coordinates are given - * with the correct precision to be used with the Graphics2D classes. + * The Class Rectangle2D represents a rectangle whose coordinates are given with + * the correct precision to be used with the Graphics2D classes. + * + * @since Android 1.0 */ public abstract class Rectangle2D extends RectangularShape { - /** The Constant OUT_LEFT is a mask that is used to indicate that a - * given point is outside the rectangle and to its left. */ - public static final int OUT_LEFT = 1; - - /** The Constant OUT_TOP is a mask that is used to indicate that a - * given point is outside the rectangle and above it. */ - public static final int OUT_TOP = 2; - - /** The Constant OUT_RIGHT is a mask that is used to indicate that a - * given point is outside the rectangle and to its right. */ - public static final int OUT_RIGHT = 4; - - /** The Constant OUT_BOTTOM is a mask that is used to indicate that a - * given point is outside the rectangle and above it. */ + /** + * The Constant OUT_LEFT is a mask that is used to indicate that a given + * point is outside the rectangle and to its left. + */ + public static final int OUT_LEFT = 1; + + /** + * The Constant OUT_TOP is a mask that is used to indicate that a given + * point is outside the rectangle and above it. + */ + public static final int OUT_TOP = 2; + + /** + * The Constant OUT_RIGHT is a mask that is used to indicate that a given + * point is outside the rectangle and to its right. + */ + public static final int OUT_RIGHT = 4; + + /** + * The Constant OUT_BOTTOM is a mask that is used to indicate that a given + * point is outside the rectangle and above it. + */ public static final int OUT_BOTTOM = 8; /** - * The Class Float is the subclass of Rectangle2D that represents a + * The Class Float is the subclass of Rectangle2D that represents a * rectangle whose data values are given as floats (with float-level * precision). + * + * @since Android 1.0 */ public static class Float extends Rectangle2D { - /** The x coordinate of the rectangle's upper left corner. */ + /** + * The x coordinate of the rectangle's upper left corner. + */ public float x; - - /** The y coordinate of the rectangle's upper left corner. */ + + /** + * The y coordinate of the rectangle's upper left corner. + */ public float y; - - /** The width of the rectangle. */ + + /** + * The width of the rectangle. + */ public float width; - - /** The height of the rectangle. */ + + /** + * The height of the rectangle. + */ public float height; /** @@ -75,10 +96,14 @@ public abstract class Rectangle2D extends RectangularShape { /** * Instantiates a new rectangle with the specified float-precision data. * - * @param x the x coordinate of the rectangle's upper left corner - * @param y the y coordinate of the rectangle's upper left corner - * @param width the width of the rectangle - * @param height the height of the rectangle + * @param x + * the x coordinate of the rectangle's upper left corner. + * @param y + * the y coordinate of the rectangle's upper left corner. + * @param width + * the width of the rectangle. + * @param height + * the height of the rectangle. */ public Float(float x, float y, float width, float height) { setRect(x, y, width, height); @@ -112,10 +137,14 @@ public abstract class Rectangle2D extends RectangularShape { /** * Sets the rectangle's data to the given values. * - * @param x the x coordinate of the rectangle's upper left corner - * @param y the y coordinate of the rectangle's upper left corner - * @param width the width of the rectangle - * @param height the height of the rectangle + * @param x + * the x coordinate of the rectangle's upper left corner. + * @param y + * the y coordinate of the rectangle's upper left corner. + * @param width + * the width of the rectangle. + * @param height + * the height of the rectangle. */ public void setRect(float x, float y, float width, float height) { this.x = x; @@ -146,23 +175,19 @@ public abstract class Rectangle2D extends RectangularShape { if (width <= 0.0f) { code |= OUT_LEFT | OUT_RIGHT; - } else - if (px < x) { - code |= OUT_LEFT; - } else - if (px > x + width) { - code |= OUT_RIGHT; - } + } else if (px < x) { + code |= OUT_LEFT; + } else if (px > x + width) { + code |= OUT_RIGHT; + } if (height <= 0.0f) { code |= OUT_TOP | OUT_BOTTOM; - } else - if (py < y) { - code |= OUT_TOP; - } else - if (py > y + height) { - code |= OUT_BOTTOM; - } + } else if (py < y) { + code |= OUT_TOP; + } else if (py > y + height) { + code |= OUT_BOTTOM; + } return code; } @@ -198,29 +223,41 @@ public abstract class Rectangle2D extends RectangularShape { @Override public String toString() { - // The output format based on 1.5 release behaviour. It could be obtained in the following way + // The output format based on 1.5 release behaviour. It could be + // obtained in the following way // System.out.println(new Rectangle2D.Float().toString()) - return getClass().getName() + "[x=" + x + ",y=" + y + ",width=" + width + ",height=" + height + "]"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ + return getClass().getName() + + "[x=" + x + ",y=" + y + ",width=" + width + ",height=" + height + "]"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ } } /** - * The Class Double is the subclass of Rectangle2D that represents a - * rectangle whose data values are given as doubles (with double-precision-level - * precision). + * The Class Double is the subclass of Rectangle2D that represents a + * rectangle whose data values are given as doubles (with + * double-precision-level precision). + * + * @since Android 1.0 */ public static class Double extends Rectangle2D { - /** The x coordinate of the rectangle's upper left corner. */ + /** + * The x coordinate of the rectangle's upper left corner. + */ public double x; - - /** The y coordinate of the rectangle's upper left corner. */ + + /** + * The y coordinate of the rectangle's upper left corner. + */ public double y; - - /** The width of the rectangle. */ + + /** + * The width of the rectangle. + */ public double width; - - /** The height of the rectangle. */ + + /** + * The height of the rectangle. + */ public double height; /** @@ -232,10 +269,14 @@ public abstract class Rectangle2D extends RectangularShape { /** * Instantiates a new rectangle with the given double values. * - * @param x the x coordinate of the rectangle's upper left corner - * @param y the y coordinate of the rectangle's upper left corner - * @param width the width of the rectangle - * @param height the height of the rectangle + * @param x + * the x coordinate of the rectangle's upper left corner. + * @param y + * the y coordinate of the rectangle's upper left corner. + * @param width + * the width of the rectangle. + * @param height + * the height of the rectangle. */ public Double(double x, double y, double width, double height) { setRect(x, y, width, height); @@ -288,23 +329,19 @@ public abstract class Rectangle2D extends RectangularShape { if (width <= 0.0) { code |= OUT_LEFT | OUT_RIGHT; - } else - if (px < x) { - code |= OUT_LEFT; - } else - if (px > x + width) { - code |= OUT_RIGHT; - } + } else if (px < x) { + code |= OUT_LEFT; + } else if (px > x + width) { + code |= OUT_RIGHT; + } if (height <= 0.0) { code |= OUT_TOP | OUT_BOTTOM; - } else - if (py < y) { - code |= OUT_TOP; - } else - if (py > y + height) { - code |= OUT_BOTTOM; - } + } else if (py < y) { + code |= OUT_TOP; + } else if (py > y + height) { + code |= OUT_BOTTOM; + } return code; } @@ -330,45 +367,60 @@ public abstract class Rectangle2D extends RectangularShape { @Override public String toString() { - // The output format based on 1.5 release behaviour. It could be obtained in the following way + // The output format based on 1.5 release behaviour. It could be + // obtained in the following way // System.out.println(new Rectangle2D.Double().toString()) - return getClass().getName() + "[x=" + x + ",y=" + y + ",width=" + width + ",height=" + height + "]"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ + return getClass().getName() + + "[x=" + x + ",y=" + y + ",width=" + width + ",height=" + height + "]"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ } } /** - * The Class Iterator provides - * access to the coordinates of the Rectangle2D's boundary modified - * by an AffineTransform. + * The Class Iterator provides access to the coordinates of the + * Rectangle2D's boundary modified by an AffineTransform. */ class Iterator implements PathIterator { - /** The x coordinate of the rectangle's upper left corner. */ + /** + * The x coordinate of the rectangle's upper left corner. + */ double x; - - /** The y coordinate of the rectangle's upper left corner. */ + + /** + * The y coordinate of the rectangle's upper left corner. + */ double y; - - - /** The width of the rectangle. */ + + /** + * The width of the rectangle. + */ double width; - - /** The height of the rectangle. */ + + /** + * The height of the rectangle. + */ double height; - - /** The AffineTransform that is used to modify the coordinates - * that are returned by the path iterator. */ + + /** + * The AffineTransform that is used to modify the coordinates that are + * returned by the path iterator. + */ AffineTransform t; - - /** The current segment index. */ + + /** + * The current segment index. + */ int index; - + /** - * Constructs a new Rectangle2D.Iterator for given rectangle and transformation. + * Constructs a new Rectangle2D.Iterator for given rectangle and + * transformation. * - * @param r - the source Rectangle2D object - * @param at - the AffineTransform object to apply to the coordinates - * before returning them + * @param r + * the source Rectangle2D object. + * @param at + * the AffineTransform object to apply to the coordinates + * before returning them. */ Iterator(Rectangle2D r, AffineTransform at) { this.x = r.getX(); @@ -407,23 +459,23 @@ public abstract class Rectangle2D extends RectangularShape { coords[1] = y; } else { type = SEG_LINETO; - switch(index) { - case 1: - coords[0] = x + width; - coords[1] = y; - break; - case 2: - coords[0] = x + width; - coords[1] = y + height; - break; - case 3: - coords[0] = x; - coords[1] = y + height; - break; - case 4: - coords[0] = x; - coords[1] = y; - break; + switch (index) { + case 1: + coords[0] = x + width; + coords[1] = y; + break; + case 2: + coords[0] = x + width; + coords[1] = y + height; + break; + case 3: + coords[0] = x; + coords[1] = y + height; + break; + case 4: + coords[0] = x; + coords[1] = y; + break; } } if (t != null) { @@ -446,23 +498,23 @@ public abstract class Rectangle2D extends RectangularShape { type = SEG_MOVETO; } else { type = SEG_LINETO; - switch(index) { - case 1: - coords[0] = (float)(x + width); - coords[1] = (float)y; - break; - case 2: - coords[0] = (float)(x + width); - coords[1] = (float)(y + height); - break; - case 3: - coords[0] = (float)x; - coords[1] = (float)(y + height); - break; - case 4: - coords[0] = (float)x; - coords[1] = (float)y; - break; + switch (index) { + case 1: + coords[0] = (float)(x + width); + coords[1] = (float)y; + break; + case 2: + coords[0] = (float)(x + width); + coords[1] = (float)(y + height); + break; + case 3: + coords[0] = (float)x; + coords[1] = (float)(y + height); + break; + case 4: + coords[0] = (float)x; + coords[1] = (float)y; + break; } } if (t != null) { @@ -474,7 +526,7 @@ public abstract class Rectangle2D extends RectangularShape { } /** - * Instantiates a new rectangle2 d. + * Instantiates a new Rectangle2D. */ protected Rectangle2D() { } @@ -482,58 +534,64 @@ public abstract class Rectangle2D extends RectangularShape { /** * Sets the rectangle's location and dimension. * - * @param x the x coordinate of the rectangle's upper left corner - * @param y the y coordinate of the rectangle's upper left corner - * @param width the width of the rectangle - * @param height the height of the rectangle + * @param x + * the x coordinate of the rectangle's upper left corner. + * @param y + * the y coordinate of the rectangle's upper left corner. + * @param width + * the width of the rectangle. + * @param height + * the height of the rectangle. */ public abstract void setRect(double x, double y, double width, double height); /** - * Gets the location of the point with respect to the rectangle and - * packs the information into a single int using the bitmasks - * {@link Rectangle2D#OUT_LEFT}, {@link Rectangle2D#OUT_RIGHT}, - * {@link Rectangle2D#OUT_TOP}, and {@link Rectangle2D#OUT_BOTTOM}. - * If the rectangle has zero or negative width, then every point - * is regarded as being both to the left and to the right of the - * rectangle. Similarly, if the height is zero or negative then - * all points are considered to be both both above and below it. - * - * @param x the x coordinate of the point to check - * @param y the y coordinate of the point to check + * Gets the location of the point with respect to the rectangle and packs + * the information into a single integer using the bitmasks + * {@link Rectangle2D#OUT_LEFT}, {@link Rectangle2D#OUT_RIGHT}, + * {@link Rectangle2D#OUT_TOP}, and {@link Rectangle2D#OUT_BOTTOM}. If the + * rectangle has zero or negative width, then every point is regarded as + * being both to the left and to the right of the rectangle. Similarly, if + * the height is zero or negative then all points are considered to be both + * both above and below it. * + * @param x + * the x coordinate of the point to check. + * @param y + * the y coordinate of the point to check. * @return the point's location with respect to the rectangle. */ public abstract int outcode(double x, double y); /** - * Creates an new rectangle that is the intersection of this rectangle - * with the given rectangle. The resulting rectangle may be empty. - * The data of this rectangle is left unchanged. - * - * @param r the rectangle to intersect with this rectangle. + * Creates an new rectangle that is the intersection of this rectangle with + * the given rectangle. The resulting rectangle may be empty. The data of + * this rectangle is left unchanged. * + * @param r + * the rectangle to intersect with this rectangle. * @return the new rectangle given by intersection. */ public abstract Rectangle2D createIntersection(Rectangle2D r); /** - * Creates an new rectangle that is the union of this rectangle - * with the given rectangle. The new rectangle is the smallest - * rectangle which contains both this rectangle and the rectangle - * specified as a parameter. The data of this rectangle is left unchanged. - * - * @param r the rectangle to combine with this rectangle + * Creates an new rectangle that is the union of this rectangle with the + * given rectangle. The new rectangle is the smallest rectangle which + * contains both this rectangle and the rectangle specified as a parameter. + * The data of this rectangle is left unchanged. * - * @return the new rectangle given by union + * @param r + * the rectangle to combine with this rectangle. + * @return the new rectangle given by union. */ public abstract Rectangle2D createUnion(Rectangle2D r); /** - * Sets the data of this rectangle to match the data of the given - * rectangle. + * Sets the data of this rectangle to match the data of the given rectangle. * - * @param r the rectangle whose data is to be copied into this rectangle's fields. + * @param r + * the rectangle whose data is to be copied into this rectangle's + * fields. */ public void setRect(Rectangle2D r) { setRect(r.getX(), r.getY(), r.getWidth(), r.getHeight()); @@ -549,61 +607,63 @@ public abstract class Rectangle2D extends RectangularShape { } /** - * Determines whether any part of the line segment between (and including) - * the two given points touches any - * part of the rectangle, including its boundary. + * Determines whether any part of the line segment between (and including) + * the two given points touches any part of the rectangle, including its + * boundary. * - * @param x1 the x coordinate of one of the points that determines the - * line segment to test - * @param y1 the y coordinate of one of the points that determines the - * line segment to test - * @param x2 the x coordinate of one of the points that determines the - * line segment to test - * @param y2 the y coordinate of one of the points that determines the - * line segment to test - * - * @return true, if at least one point of the line segment between the - * two points matches any point of the interior of the rectangle or the - * rectangle's boundary. + * @param x1 + * the x coordinate of one of the points that determines the line + * segment to test. + * @param y1 + * the y coordinate of one of the points that determines the line + * segment to test. + * @param x2 + * the x coordinate of one of the points that determines the line + * segment to test. + * @param y2 + * the y coordinate of one of the points that determines the line + * segment to test. + * @return true, if at least one point of the line segment between the two + * points matches any point of the interior of the rectangle or the + * rectangle's boundary. */ public boolean intersectsLine(double x1, double y1, double x2, double y2) { double rx1 = getX(); double ry1 = getY(); double rx2 = rx1 + getWidth(); double ry2 = ry1 + getHeight(); - return - (rx1 <= x1 && x1 <= rx2 && ry1 <= y1 && y1 <= ry2) || - (rx1 <= x2 && x2 <= rx2 && ry1 <= y2 && y2 <= ry2) || - Line2D.linesIntersect(rx1, ry1, rx2, ry2, x1, y1, x2, y2) || - Line2D.linesIntersect(rx2, ry1, rx1, ry2, x1, y1, x2, y2); + return (rx1 <= x1 && x1 <= rx2 && ry1 <= y1 && y1 <= ry2) + || (rx1 <= x2 && x2 <= rx2 && ry1 <= y2 && y2 <= ry2) + || Line2D.linesIntersect(rx1, ry1, rx2, ry2, x1, y1, x2, y2) + || Line2D.linesIntersect(rx2, ry1, rx1, ry2, x1, y1, x2, y2); } /** - * Determines whether any part of the specified line segment touches any + * Determines whether any part of the specified line segment touches any * part of the rectangle, including its boundary. * - * @param l the line segment to test - * - * @return true, if at least one point of the given line segment - * matches any point of the interior of the rectangle or the - * rectangle's boundary. + * @param l + * the line segment to test. + * @return true, if at least one point of the given line segment matches any + * point of the interior of the rectangle or the rectangle's + * boundary. */ public boolean intersectsLine(Line2D l) { return intersectsLine(l.getX1(), l.getY1(), l.getX2(), l.getY2()); } /** - * Gets the location of the point with respect to the rectangle and - * packs the information into a single int using the bitmasks - * {@link Rectangle2D#OUT_LEFT}, {@link Rectangle2D#OUT_RIGHT}, - * {@link Rectangle2D#OUT_TOP}, and {@link Rectangle2D#OUT_BOTTOM}. - * If the rectangle has zero or negative width, then every point - * is regarded as being both to the left and to the right of the - * rectangle. Similarly, if the height is zero or negative then - * all points are considered to be both both above and below it. - * - * @param p the point to check + * Gets the location of the point with respect to the rectangle and packs + * the information into a single integer using the bitmasks + * {@link Rectangle2D#OUT_LEFT}, {@link Rectangle2D#OUT_RIGHT}, + * {@link Rectangle2D#OUT_TOP}, and {@link Rectangle2D#OUT_BOTTOM}. If the + * rectangle has zero or negative width, then every point is regarded as + * being both to the left and to the right of the rectangle. Similarly, if + * the height is zero or negative then all points are considered to be both + * both above and below it. * + * @param p + * the point to check. * @return the point's location with respect to the rectangle. */ public int outcode(Point2D p) { @@ -620,9 +680,7 @@ public abstract class Rectangle2D extends RectangularShape { double x2 = x1 + getWidth(); double y2 = y1 + getHeight(); - return - x1 <= x && x < x2 && - y1 <= y && y < y2; + return x1 <= x && x < x2 && y1 <= y && y < y2; } public boolean intersects(double x, double y, double width, double height) { @@ -635,9 +693,7 @@ public abstract class Rectangle2D extends RectangularShape { double x2 = x1 + getWidth(); double y2 = y1 + getHeight(); - return - x + width > x1 && x < x2 && - y + height > y1 && y < y2; + return x + width > x1 && x < x2 && y + height > y1 && y < y2; } public boolean contains(double x, double y, double width, double height) { @@ -650,19 +706,21 @@ public abstract class Rectangle2D extends RectangularShape { double x2 = x1 + getWidth(); double y2 = y1 + getHeight(); - return - x1 <= x && x + width <= x2 && - y1 <= y && y + height <= y2; + return x1 <= x && x + width <= x2 && y1 <= y && y + height <= y2; } /** - * Changes the data values of the destination rectangle to match - * the intersection of the two source rectangles, leaving the - * two source rectangles unchanged. The resulting rectangle may be empty. + * Changes the data values of the destination rectangle to match the + * intersection of the two source rectangles, leaving the two source + * rectangles unchanged. The resulting rectangle may be empty. * - * @param src1 one of the two source rectangles giving the data to intersect - * @param src2 one of the two source rectangles giving the data to intersect - * @param dst the destination object where the data of the intersection is written + * @param src1 + * one of the two source rectangles giving the data to intersect. + * @param src2 + * one of the two source rectangles giving the data to intersect. + * @param dst + * the destination object where the data of the intersection is + * written. */ public static void intersect(Rectangle2D src1, Rectangle2D src2, Rectangle2D dst) { double x1 = Math.max(src1.getMinX(), src2.getMinX()); @@ -673,14 +731,17 @@ public abstract class Rectangle2D extends RectangularShape { } /** - * Changes the data values of the destination rectangle to match - * the union of the two source rectangles, leaving the - * two source rectangles unchanged. The union is the smallest rectangle - * tha completely covers the two source rectangles. + * Changes the data values of the destination rectangle to match the union + * of the two source rectangles, leaving the two source rectangles + * unchanged. The union is the smallest rectangle that completely covers the + * two source rectangles. * - * @param src1 one of the two source rectangles giving the data - * @param src2 one of the two source rectangles giving the data - * @param dst the destination object where the data of the union is written + * @param src1 + * one of the two source rectangles giving the data. + * @param src2 + * one of the two source rectangles giving the data. + * @param dst + * the destination object where the data of the union is written. */ public static void union(Rectangle2D src1, Rectangle2D src2, Rectangle2D dst) { double x1 = Math.min(src1.getMinX(), src2.getMinX()); @@ -693,8 +754,12 @@ public abstract class Rectangle2D extends RectangularShape { /** * Enlarges the rectangle so that it includes the given point. * - * @param x the x coordinate of the new point to be covered by the rectangle - * @param y the y coordinate of the new point to be covered by the rectangle + * @param x + * the x coordinate of the new point to be covered by the + * rectangle. + * @param y + * the y coordinate of the new point to be covered by the + * rectangle. */ public void add(double x, double y) { double x1 = Math.min(getMinX(), x); @@ -707,7 +772,8 @@ public abstract class Rectangle2D extends RectangularShape { /** * Enlarges the rectangle so that it includes the given point. * - * @param p the new point to be covered by the rectangle + * @param p + * the new point to be covered by the rectangle. */ public void add(Point2D p) { add(p.getX(), p.getY()); @@ -716,7 +782,8 @@ public abstract class Rectangle2D extends RectangularShape { /** * Enlarges the rectangle so that it covers the given rectangle. * - * @param r the new rectangle to be covered by this rectangle + * @param r + * the new rectangle to be covered by this rectangle. */ public void add(Rectangle2D r) { union(this, r, this); @@ -748,14 +815,10 @@ public abstract class Rectangle2D extends RectangularShape { } if (obj instanceof Rectangle2D) { Rectangle2D r = (Rectangle2D)obj; - return - getX() == r.getX() && - getY() == r.getY() && - getWidth() == r.getWidth() && - getHeight() == r.getHeight(); + return getX() == r.getX() && getY() == r.getY() && getWidth() == r.getWidth() + && getHeight() == r.getHeight(); } return false; } } - diff --git a/awt/java/awt/geom/RectangularShape.java b/awt/java/awt/geom/RectangularShape.java index 0a77dfdbcdaa5..0b0d05cad67c0 100644 --- a/awt/java/awt/geom/RectangularShape.java +++ b/awt/java/awt/geom/RectangularShape.java @@ -18,17 +18,19 @@ * @author Denis M. Kishenko * @version $Revision$ */ + package java.awt.geom; import java.awt.Rectangle; import java.awt.Shape; /** - * The Class RectangularShape represents a Shape whose data is - * (at least partially) described by a rectangular frame. This includes - * shapes which are obviously rectangular (such as Rectangle2D) as well as - * shapes like Arc2D which are largely determined by the rectangle they - * fit inside. + * The Class RectangularShape represents a Shape whose data is (at least + * partially) described by a rectangular frame. This includes shapes which are + * obviously rectangular (such as Rectangle2D) as well as shapes like Arc2D + * which are largely determined by the rectangle they fit inside. + * + * @since Android 1.0 */ public abstract class RectangularShape implements Shape, Cloneable { @@ -67,25 +69,30 @@ public abstract class RectangularShape implements Shape, Cloneable { public abstract double getHeight(); /** - * Checks if this is an empty rectangle: one with zero as its width or height. + * Checks if this is an empty rectangle: one with zero as its width or + * height. * * @return true, if the width or height is empty. */ public abstract boolean isEmpty(); /** - * Sets the data for the bounding rectangle in terms of double values. + * Sets the data for the bounding rectangle in terms of double values. * - * @param x the x coordinate of the upper left corner of the rectangle. - * @param y the y coordinate of the upper left corner of the rectangle. - * @param w the width of the rectangle. - * @param h the height of the rectangle. + * @param x + * the x coordinate of the upper left corner of the rectangle. + * @param y + * the y coordinate of the upper left corner of the rectangle. + * @param w + * the width of the rectangle. + * @param h + * the height of the rectangle. */ public abstract void setFrame(double x, double y, double w, double h); /** - * Gets the minimum x value of the bounding rectangle (the x - * coordinate of the upper left corner of the rectangle). + * Gets the minimum x value of the bounding rectangle (the x coordinate of + * the upper left corner of the rectangle). * * @return the minimum x value of the bounding rectangle. */ @@ -94,8 +101,8 @@ public abstract class RectangularShape implements Shape, Cloneable { } /** - * Gets the minimum y value of the bounding rectangle (the y - * coordinate of the upper left corner of the rectangle). + * Gets the minimum y value of the bounding rectangle (the y coordinate of + * the upper left corner of the rectangle). * * @return the minimum y value of the bounding rectangle. */ @@ -104,9 +111,8 @@ public abstract class RectangularShape implements Shape, Cloneable { } /** - * Gets the maximum x value of the bounding rectangle (the x - * coordinate of the upper left corner of the rectangle plus the - * rectangle's width). + * Gets the maximum x value of the bounding rectangle (the x coordinate of + * the upper left corner of the rectangle plus the rectangle's width). * * @return the maximum x value of the bounding rectangle. */ @@ -115,9 +121,8 @@ public abstract class RectangularShape implements Shape, Cloneable { } /** - * Gets the maximum y value of the bounding rectangle (the y - * coordinate of the upper left corner of the rectangle plus the - * rectangle's height). + * Gets the maximum y value of the bounding rectangle (the y coordinate of + * the upper left corner of the rectangle plus the rectangle's height). * * @return the maximum y value of the bounding rectangle. */ @@ -144,8 +149,8 @@ public abstract class RectangularShape implements Shape, Cloneable { } /** - * Places the rectangle's size and location data in a new Rectangle2D - * object and returns it. + * Places the rectangle's size and location data in a new Rectangle2D object + * and returns it. * * @return the bounding rectangle as a new Rectangle2D object. */ @@ -154,21 +159,24 @@ public abstract class RectangularShape implements Shape, Cloneable { } /** - * Sets the bounding rectangle in terms of a Point2D which gives its - * upper left corner and a Dimension2D object giving its width and height. + * Sets the bounding rectangle in terms of a Point2D which gives its upper + * left corner and a Dimension2D object giving its width and height. * - * @param loc the new upper left corner coordinate. - * @param size the new size dimensions. + * @param loc + * the new upper left corner coordinate. + * @param size + * the new size dimensions. */ public void setFrame(Point2D loc, Dimension2D size) { setFrame(loc.getX(), loc.getY(), size.getWidth(), size.getHeight()); } /** - * Sets the bounding rectangle to match the data contained in the - * specified Rectangle2D. + * Sets the bounding rectangle to match the data contained in the specified + * Rectangle2D. * - * @param r the rectangle that gives the new frame data. + * @param r + * the rectangle that gives the new frame data. */ public void setFrame(Rectangle2D r) { setFrame(r.getX(), r.getY(), r.getWidth(), r.getHeight()); @@ -176,12 +184,17 @@ public abstract class RectangularShape implements Shape, Cloneable { /** * Sets the framing rectangle given two opposite corners. Any two corners - * may be used in any order as long as they are diagonally opposite one another. + * may be used in any order as long as they are diagonally opposite one + * another. * - * @param x1 the x coordinate of one of the corner points. - * @param y1 the y coordinate of one of the corner points. - * @param x2 the x coordinate of the other corner point. - * @param y2 the y coordinate of the other corner point. + * @param x1 + * the x coordinate of one of the corner points. + * @param y1 + * the y coordinate of one of the corner points. + * @param x2 + * the x coordinate of the other corner point. + * @param y2 + * the y coordinate of the other corner point. */ public void setFrameFromDiagonal(double x1, double y1, double x2, double y2) { double rx, ry, rw, rh; @@ -204,10 +217,13 @@ public abstract class RectangularShape implements Shape, Cloneable { /** * Sets the framing rectangle given two opposite corners. Any two corners - * may be used in any order as long as they are diagonally opposite one another. + * may be used in any order as long as they are diagonally opposite one + * another. * - * @param p1 one of the corner points. - * @param p2 the other corner point. + * @param p1 + * one of the corner points. + * @param p2 + * the other corner point. */ public void setFrameFromDiagonal(Point2D p1, Point2D p2) { setFrameFromDiagonal(p1.getX(), p1.getY(), p2.getX(), p2.getY()); @@ -217,10 +233,14 @@ public abstract class RectangularShape implements Shape, Cloneable { * Sets the framing rectangle given the center point and one corner. Any * corner may be used. * - * @param centerX the x coordinate of the center point. - * @param centerY the y coordinate of the center point. - * @param cornerX the x coordinate of one of the corner points. - * @param cornerY the y coordinate of one of the corner points. + * @param centerX + * the x coordinate of the center point. + * @param centerY + * the y coordinate of the center point. + * @param cornerX + * the x coordinate of one of the corner points. + * @param cornerY + * the y coordinate of one of the corner points. */ public void setFrameFromCenter(double centerX, double centerY, double cornerX, double cornerY) { double width = Math.abs(cornerX - centerX); @@ -232,8 +252,10 @@ public abstract class RectangularShape implements Shape, Cloneable { * Sets the framing rectangle given the center point and one corner. Any * corner may be used. * - * @param center the center point. - * @param corner a corner point. + * @param center + * the center point. + * @param corner + * a corner point. */ public void setFrameFromCenter(Point2D center, Point2D corner) { setFrameFromCenter(center.getX(), center.getY(), corner.getX(), corner.getY()); @@ -273,4 +295,3 @@ public abstract class RectangularShape implements Shape, Cloneable { } } - diff --git a/awt/java/awt/geom/RoundRectangle2D.java b/awt/java/awt/geom/RoundRectangle2D.java index 680a146bfd101..8fbddd64d9db1 100644 --- a/awt/java/awt/geom/RoundRectangle2D.java +++ b/awt/java/awt/geom/RoundRectangle2D.java @@ -18,6 +18,7 @@ * @author Denis M. Kishenko * @version $Revision$ */ + package java.awt.geom; import java.util.NoSuchElementException; @@ -25,53 +26,74 @@ import java.util.NoSuchElementException; import org.apache.harmony.awt.internal.nls.Messages; /** - * The Class RoundRectangle2D describes a rectangle with rounded - * corners with high-precision data that is appropriate for geometric - * operations. + * The Class RoundRectangle2D describes a rectangle with rounded corners with + * high-precision data that is appropriate for geometric operations. + * + * @since Android 1.0 */ public abstract class RoundRectangle2D extends RectangularShape { /** - * The Class Float is the subclass of RoundRectangle2D that has all - * of its data values stored with float-level precision. + * The Class Float is the subclass of RoundRectangle2D that has all of its + * data values stored with float-level precision. + * + * @since Android 1.0 */ public static class Float extends RoundRectangle2D { - /** The x coordinate of the rectangle's upper left corner. */ + /** + * The x coordinate of the rectangle's upper left corner. + */ public float x; - - /** The y coordinate of the rectangle's upper left corner. */ + + /** + * The y coordinate of the rectangle's upper left corner. + */ public float y; - - /** The width of the rectangle. */ + + /** + * The width of the rectangle. + */ public float width; - - /** The height of the rectangle. */ + + /** + * The height of the rectangle. + */ public float height; - - /** The arcwidth of the rounded corners. */ + + /** + * The arc width of the rounded corners. + */ public float arcwidth; - - /** The archeight of the rounded corners. */ + + /** + * The arc height of the rounded corners. + */ public float archeight; /** - * Instantiates a new float-valued RoundRectangle2D with - * its data-values set to zero. + * Instantiates a new float-valued RoundRectangle2D with its data-values + * set to zero. */ public Float() { } /** - * Instantiates a new float-valued RoundRectangle2D with - * the specified data values + * Instantiates a new float-valued RoundRectangle2D with the specified + * data values. * - * @param x the x coordinate of the rectangle's upper left corner - * @param y the y coordinate of the rectangle's upper left corner - * @param width the width of the rectangle - * @param height the height of the rectangle - * @param arcwidth the arcwidth of the rounded corners - * @param archeight the archeight of the rounded corners + * @param x + * the x coordinate of the rectangle's upper left corner. + * @param y + * the y coordinate of the rectangle's upper left corner. + * @param width + * the width of the rectangle. + * @param height + * the height of the rectangle. + * @param arcwidth + * the arc width of the rounded corners. + * @param archeight + * the arc height of the rounded corners. */ public Float(float x, float y, float width, float height, float arcwidth, float archeight) { setRoundRect(x, y, width, height, arcwidth, archeight); @@ -113,16 +135,23 @@ public abstract class RoundRectangle2D extends RectangularShape { } /** - * Sets the data of the round rect. + * Sets the data of the round rectangle. * - * @param x the x coordinate of the rectangle's upper left corner - * @param y the y coordinate of the rectangle's upper left corner - * @param width the width of the rectangle - * @param height the height of the rectangle - * @param arcwidth the arcwidth of the rounded corners - * @param archeight the archeight of the rounded corners + * @param x + * the x coordinate of the rectangle's upper left corner. + * @param y + * the y coordinate of the rectangle's upper left corner. + * @param width + * the width of the rectangle. + * @param height + * the height of the rectangle. + * @param arcwidth + * the arc width of the rounded corners. + * @param archeight + * the arc height of the rounded corners. */ - public void setRoundRect(float x, float y, float width, float height, float arcwidth, float archeight) { + public void setRoundRect(float x, float y, float width, float height, float arcwidth, + float archeight) { this.x = x; this.y = y; this.width = width; @@ -132,7 +161,8 @@ public abstract class RoundRectangle2D extends RectangularShape { } @Override - public void setRoundRect(double x, double y, double width, double height, double arcwidth, double archeight) { + public void setRoundRect(double x, double y, double width, double height, double arcwidth, + double archeight) { this.x = (float)x; this.y = (float)y; this.width = (float)width; @@ -157,48 +187,69 @@ public abstract class RoundRectangle2D extends RectangularShape { } /** - * The Class Double is the subclass of RoundRectangle2D that has all - * of its data values stored with double-level precision. + * The Class Double is the subclass of RoundRectangle2D that has all of its + * data values stored with double-level precision. + * + * @since Android 1.0 */ public static class Double extends RoundRectangle2D { - /** The x coordinate of the rectangle's upper left corner. */ + /** + * The x coordinate of the rectangle's upper left corner. + */ public double x; - - /** The y coordinate of the rectangle's upper left corner. */ + + /** + * The y coordinate of the rectangle's upper left corner. + */ public double y; - - /** The width of the rectangle. */ + + /** + * The width of the rectangle. + */ public double width; - - /** The height of the rectangle. */ + + /** + * The height of the rectangle. + */ public double height; - - /** The arcwidth of the rounded corners. */ + + /** + * The arc width of the rounded corners. + */ public double arcwidth; - - /** The archeight of the rounded corners. */ + + /** + * The arc height of the rounded corners. + */ public double archeight; /** - * Instantiates a new double-valued RoundRectangle2D with - * its data-values set to zero. + * Instantiates a new double-valued RoundRectangle2D with its + * data-values set to zero. */ public Double() { } /** - * Instantiates a new double-valued RoundRectangle2D with - * the specified data values. + * Instantiates a new double-valued RoundRectangle2D with the specified + * data values. * - * @param x the x coordinate of the rectangle's upper left corner - * @param y the y coordinate of the rectangle's upper left corner - * @param width the width of the rectangle - * @param height the height of the rectangle - * @param arcwidth the arcwidth of the rounded corners - * @param archeight the archeight of the rounded corners + * @param x + * the x coordinate of the rectangle's upper left corner. + * @param y + * the y coordinate of the rectangle's upper left corner. + * @param width + * the width of the rectangle. + * @param height + * the height of the rectangle. + * @param arcwidth + * the arc width of the rounded corners. + * @param archeight + * the arc height of the rounded corners. */ - public Double(double x, double y, double width, double height, double arcwidth, double archeight) { + public Double(double x, double y, double width, double height, double arcwidth, + double archeight) { setRoundRect(x, y, width, height, arcwidth, archeight); } @@ -238,7 +289,8 @@ public abstract class RoundRectangle2D extends RectangularShape { } @Override - public void setRoundRect(double x, double y, double width, double height, double arcwidth, double archeight) { + public void setRoundRect(double x, double y, double width, double height, double arcwidth, + double archeight) { this.x = x; this.y = y; this.width = width; @@ -263,7 +315,7 @@ public abstract class RoundRectangle2D extends RectangularShape { } /* - * RoundRectangle2D path iterator + * RoundRectangle2D path iterator */ /** * The subclass of PathIterator to traverse a RoundRectangle2D. @@ -274,70 +326,101 @@ public abstract class RoundRectangle2D extends RectangularShape { * Path for round corners generated the same way as Ellipse2D */ - /** The coefficient to calculate control points of Bezier curves. */ + /** + * The coefficient to calculate control points of Bezier curves. + */ double u = 0.5 - 2.0 / 3.0 * (Math.sqrt(2.0) - 1.0); - /** The points coordinates calculation table. */ + /** + * The points coordinates calculation table. + */ double points[][] = { - { 0.0, 0.5, 0.0, 0.0 }, // MOVETO - { 1.0, -0.5, 0.0, 0.0 }, // LINETO - { 1.0, -u, 0.0, 0.0, // CUBICTO - 1.0, 0.0, 0.0, u, - 1.0, 0.0, 0.0, 0.5 }, - { 1.0, 0.0, 1.0, -0.5 }, // LINETO - { 1.0, 0.0, 1.0, -u, // CUBICTO - 1.0, -u, 1.0, 0.0, - 1.0, -0.5, 1.0, 0.0 }, - { 0.0, 0.5, 1.0, 0.0 }, // LINETO - { 0.0, u, 1.0, 0.0, // CUBICTO - 0.0, 0.0, 1.0, -u, - 0.0, 0.0, 1.0, -0.5 }, - { 0.0, 0.0, 0.0, 0.5 }, // LINETO - { 0.0, 0.0, 0.0, u, // CUBICTO - 0.0, u, 0.0, 0.0, - 0.0, 0.5, 0.0, 0.0 } }; - - /** The segment types correspond to points array. */ + { + 0.0, 0.5, 0.0, 0.0 + }, // MOVETO + { + 1.0, -0.5, 0.0, 0.0 + }, // LINETO + { + 1.0, -u, 0.0, 0.0, // CUBICTO + 1.0, 0.0, 0.0, u, 1.0, 0.0, 0.0, 0.5 + }, { + 1.0, 0.0, 1.0, -0.5 + }, // LINETO + { + 1.0, 0.0, 1.0, -u, // CUBICTO + 1.0, -u, 1.0, 0.0, 1.0, -0.5, 1.0, 0.0 + }, { + 0.0, 0.5, 1.0, 0.0 + }, // LINETO + { + 0.0, u, 1.0, 0.0, // CUBICTO + 0.0, 0.0, 1.0, -u, 0.0, 0.0, 1.0, -0.5 + }, { + 0.0, 0.0, 0.0, 0.5 + }, // LINETO + { + 0.0, 0.0, 0.0, u, // CUBICTO + 0.0, u, 0.0, 0.0, 0.0, 0.5, 0.0, 0.0 + } + }; + + /** + * The segment types correspond to points array. + */ int types[] = { - SEG_MOVETO, - SEG_LINETO, - SEG_CUBICTO, - SEG_LINETO, - SEG_CUBICTO, - SEG_LINETO, - SEG_CUBICTO, - SEG_LINETO, - SEG_CUBICTO}; - - /** The x coordinate of left-upper corner of the round rectangle bounds. */ + SEG_MOVETO, SEG_LINETO, SEG_CUBICTO, SEG_LINETO, SEG_CUBICTO, SEG_LINETO, + SEG_CUBICTO, SEG_LINETO, SEG_CUBICTO + }; + + /** + * The x coordinate of left-upper corner of the round rectangle bounds. + */ double x; - - /** The y coordinate of left-upper corner of the round rectangle bounds. */ + + /** + * The y coordinate of left-upper corner of the round rectangle bounds. + */ double y; - - /** The width of the round rectangle bounds. */ + + /** + * The width of the round rectangle bounds. + */ double width; - - /** The height of the round rectangle bounds. */ + + /** + * The height of the round rectangle bounds. + */ double height; - - /** The width of arc corners of the round rectangle. */ + + /** + * The width of arc corners of the round rectangle. + */ double aw; - - /** The height of arc corners of the round rectangle. */ + + /** + * The height of arc corners of the round rectangle. + */ double ah; - /** The path iterator transformation. */ + /** + * The path iterator transformation. + */ AffineTransform t; - /** The current segmenet index. */ + /** + * The current segment index. + */ int index; /** - * Constructs a new RoundRectangle2D.Iterator for given round rectangle and transformation. + * Constructs a new RoundRectangle2D.Iterator for given round rectangle + * and transformation. * - * @param rr - the source RoundRectangle2D object - * @param at - the AffineTransform object to apply rectangle path + * @param rr + * - the source RoundRectangle2D object + * @param at + * - the AffineTransform object to apply rectangle path */ Iterator(RoundRectangle2D rr, AffineTransform at) { this.x = rr.getX(); @@ -415,41 +498,48 @@ public abstract class RoundRectangle2D extends RectangularShape { /** * Gets the arc width. * - * @return the arc width + * @return the arc width. */ public abstract double getArcWidth(); /** * Gets the arc height. * - * @return the arc height + * @return the arc height. */ public abstract double getArcHeight(); /** * Sets the data of the RoundRectangle2D. * - * @param x the x coordinate of the rectangle's upper left corner - * @param y the y coordinate of the rectangle's upper left corner - * @param width the width of the rectangle - * @param height the height of the rectangle - * @param arcWidth the arcwidth of the rounded corners - * @param arcHeight the archeight of the rounded corners + * @param x + * the x coordinate of the rectangle's upper left corner. + * @param y + * the y coordinate of the rectangle's upper left corner. + * @param width + * the width of the rectangle. + * @param height + * the height of the rectangle. + * @param arcWidth + * the arc width of the rounded corners. + * @param arcHeight + * the arc height of the rounded corners. */ public abstract void setRoundRect(double x, double y, double width, double height, double arcWidth, double arcHeight); /** - * Sets the data of the RoundRectangle2D by copying the values - * from an existing RoundRectangle2D. + * Sets the data of the RoundRectangle2D by copying the values from an + * existing RoundRectangle2D. * - * @param rr the round rectangle to copy the data from - * - * @throws NullPointerException if rr is null + * @param rr + * the round rectangle to copy the data from. + * @throws NullPointerException + * if rr is null. */ public void setRoundRect(RoundRectangle2D rr) { - setRoundRect(rr.getX(), rr.getY(), rr.getWidth(), rr.getHeight(), rr - .getArcWidth(), rr.getArcHeight()); + setRoundRect(rr.getX(), rr.getY(), rr.getWidth(), rr.getHeight(), rr.getArcWidth(), rr + .getArcHeight()); } @Override @@ -478,21 +568,19 @@ public abstract class RoundRectangle2D extends RectangularShape { if (px < rx1 + aw) { cx = rx1 + aw; - } else - if (px > rx2 - aw) { - cx = rx2 - aw; - } else { - return true; - } + } else if (px > rx2 - aw) { + cx = rx2 - aw; + } else { + return true; + } if (py < ry1 + ah) { cy = ry1 + ah; - } else - if (py > ry2 - ah) { - cy = ry2 - ah; - } else { - return true; - } + } else if (py > ry2 - ah) { + cy = ry2 - ah; + } else { + return true; + } px = (px - cx) / aw; py = (py - cy) / ah; @@ -537,11 +625,7 @@ public abstract class RoundRectangle2D extends RectangularShape { double rx2 = rx + rw; double ry2 = ry + rh; - return - contains(rx1, ry1) && - contains(rx2, ry1) && - contains(rx2, ry2) && - contains(rx1, ry2); + return contains(rx1, ry1) && contains(rx2, ry1) && contains(rx2, ry2) && contains(rx1, ry2); } public PathIterator getPathIterator(AffineTransform at) { @@ -549,4 +633,3 @@ public abstract class RoundRectangle2D extends RectangularShape { } } - diff --git a/awt/java/awt/geom/package.html b/awt/java/awt/geom/package.html new file mode 100644 index 0000000000000..e3a236ee34aac --- /dev/null +++ b/awt/java/awt/geom/package.html @@ -0,0 +1,8 @@ + + +

    + This package contains classes and interfaces related to Java2D shapes and geometry. +

    + @since Android 1.0 + + diff --git a/awt/java/awt/im/InputContext.java b/awt/java/awt/im/InputContext.java index 3468474686cab..cce5148422016 100644 --- a/awt/java/awt/im/InputContext.java +++ b/awt/java/awt/im/InputContext.java @@ -26,6 +26,12 @@ import java.util.Locale; import org.apache.harmony.awt.im.InputMethodContext; +/** + * This class is not supported in Android 1.0. It is merely provided to maintain + * interface compatibility with desktop Java implementations. + * + * @since Android 1.0 + */ public class InputContext { protected InputContext() { } diff --git a/awt/java/awt/im/InputMethodHighlight.java b/awt/java/awt/im/InputMethodHighlight.java index 53bb20bb64233..865d47c807012 100644 --- a/awt/java/awt/im/InputMethodHighlight.java +++ b/awt/java/awt/im/InputMethodHighlight.java @@ -25,6 +25,12 @@ import java.awt.font.TextAttribute; import org.apache.harmony.awt.internal.nls.Messages; +/** + * This class is not supported in Android 1.0. It is merely provided to maintain + * interface compatibility with desktop Java implementations. + * + * @since Android 1.0 + */ public class InputMethodHighlight { public static final int RAW_TEXT = 0; diff --git a/awt/java/awt/im/InputMethodRequests.java b/awt/java/awt/im/InputMethodRequests.java index bdd25e610a3da..b12d397b5273d 100644 --- a/awt/java/awt/im/InputMethodRequests.java +++ b/awt/java/awt/im/InputMethodRequests.java @@ -24,6 +24,12 @@ import java.awt.Rectangle; import java.awt.font.TextHitInfo; import java.text.AttributedCharacterIterator; +/** + * This class is not supported in Android 1.0. It is merely provided to maintain + * interface compatibility with desktop Java implementations. + * + * @since Android 1.0 + */ public interface InputMethodRequests { public AttributedCharacterIterator cancelLatestCommittedText(AttributedCharacterIterator.Attribute[] attributes); diff --git a/awt/java/awt/im/InputSubset.java b/awt/java/awt/im/InputSubset.java index 02a1049684f38..708881eaee39a 100644 --- a/awt/java/awt/im/InputSubset.java +++ b/awt/java/awt/im/InputSubset.java @@ -20,6 +20,12 @@ */ package java.awt.im; +/** + * This class is not supported in Android 1.0. It is merely provided to maintain + * interface compatibility with desktop Java implementations. + * + * @since Android 1.0 + */ public final class InputSubset extends Character.Subset { public static final InputSubset LATIN = new InputSubset("LATIN"); //$NON-NLS-1$ diff --git a/awt/java/awt/im/spi/InputMethod.java b/awt/java/awt/im/spi/InputMethod.java index 2c98c46cb3541..67a88346c814f 100644 --- a/awt/java/awt/im/spi/InputMethod.java +++ b/awt/java/awt/im/spi/InputMethod.java @@ -24,6 +24,12 @@ import java.awt.AWTEvent; import java.awt.Rectangle; import java.util.Locale; +/** + * This class is not supported in Android 1.0. It is merely provided to maintain + * interface compatibility with desktop Java implementations. + * + * @since Android 1.0 + */ public interface InputMethod { public void activate(); diff --git a/awt/java/awt/im/spi/InputMethodContext.java b/awt/java/awt/im/spi/InputMethodContext.java index ca33e879ec7a9..bfc773cf05fae 100644 --- a/awt/java/awt/im/spi/InputMethodContext.java +++ b/awt/java/awt/im/spi/InputMethodContext.java @@ -26,6 +26,12 @@ import java.awt.im.InputMethodRequests; import java.text.AttributedCharacterIterator; //???AWT: import javax.swing.JFrame; +/** + * This class is not supported in Android 1.0. It is merely provided to maintain + * interface compatibility with desktop Java implementations. + * + * @since Android 1.0 + */ public interface InputMethodContext extends InputMethodRequests { // ???AWT: public JFrame createInputMethodJFrame(String title, boolean attachToInputContext); diff --git a/awt/java/awt/im/spi/InputMethodDescriptor.java b/awt/java/awt/im/spi/InputMethodDescriptor.java index 3068cac1b6771..c800bc1791e16 100644 --- a/awt/java/awt/im/spi/InputMethodDescriptor.java +++ b/awt/java/awt/im/spi/InputMethodDescriptor.java @@ -24,6 +24,12 @@ import java.awt.AWTException; import java.awt.Image; import java.util.Locale; +/** + * This class is not supported in Android 1.0. It is merely provided to maintain + * interface compatibility with desktop Java implementations. + * + * @since Android 1.0 + */ public interface InputMethodDescriptor { public Locale[] getAvailableLocales() throws AWTException; diff --git a/awt/java/awt/image/AffineTransformOp.java b/awt/java/awt/image/AffineTransformOp.java index 546837a48e1f5..db25e1aeccbf2 100644 --- a/awt/java/awt/image/AffineTransformOp.java +++ b/awt/java/awt/image/AffineTransformOp.java @@ -32,50 +32,60 @@ import org.apache.harmony.awt.gl.AwtImageBackdoorAccessor; import org.apache.harmony.awt.internal.nls.Messages; /** - * The AffineTransform class translates coordinates from 2D coordinates - * in the source image or Raster to 2D coordinates in the destination - * image or Raster using Affine transformation. The number of bands in - * the source Raster should equal to the number of bands in the destination - * Raster. + * The AffineTransform class translates coordinates from 2D coordinates in the + * source image or Raster to 2D coordinates in the destination image or Raster + * using affine transformation. The number of bands in the source Raster should + * equal to the number of bands in the destination Raster. + * + * @since Android 1.0 */ public class AffineTransformOp implements BufferedImageOp, RasterOp { - - /** - * The Constant TYPE_NEAREST_NEIGHBOR indicates nearest-neighbor - * interpolation type. + + /** + * The Constant TYPE_NEAREST_NEIGHBOR indicates nearest-neighbor + * interpolation type. */ public static final int TYPE_NEAREST_NEIGHBOR = 1; - - /** - * The Constant TYPE_BILINEAR indicates bilinear interpolation type. + + /** + * The Constant TYPE_BILINEAR indicates bilinear interpolation type. */ public static final int TYPE_BILINEAR = 2; - - /** The Constant TYPE_BICUBIC indicates bicubic interpolation type. */ + + /** + * The Constant TYPE_BICUBIC indicates bi-cubic interpolation type. + */ public static final int TYPE_BICUBIC = 3; - /** The i type. */ + /** + * The i type. + */ private int iType; // interpolation type - - /** The at. */ + + /** + * The at. + */ private AffineTransform at; - - /** The hints. */ + + /** + * The hints. + */ private RenderingHints hints; static { // TODO - uncomment - //System.loadLibrary("imageops"); + // System.loadLibrary("imageops"); } /** - * Instantiates a new AffineTransformOp with the specified - * AffineTransform and RenderingHints object which defines - * the interpolation type. + * Instantiates a new AffineTransformOp with the specified AffineTransform + * and RenderingHints object which defines the interpolation type. * - * @param xform the AffineTransform. - * @param hints the RenderingHints object which defines - * the interpolation type. + * @param xform + * the AffineTransform. + * @param hints + * the RenderingHints object which defines the interpolation + * type. */ public AffineTransformOp(AffineTransform xform, RenderingHints hints) { this(xform, TYPE_NEAREST_NEIGHBOR); @@ -95,20 +105,22 @@ public class AffineTransformOp implements BufferedImageOp, RasterOp { // Determine from rendering quality if (hint == RenderingHints.VALUE_RENDER_QUALITY) { this.iType = TYPE_BILINEAR; - // For speed use nearest neighbor + // For speed use nearest neighbor } } } } /** - * Instantiates a new AffineTransformOp with the specified - * AffineTransform and a specified interpolation type from the - * list of predefined interpolation types. + * Instantiates a new AffineTransformOp with the specified AffineTransform + * and a specified interpolation type from the list of predefined + * interpolation types. * - * @param xform the AffineTransform. - * @param interp the one of predefined interpolation types: - * TYPE_NEAREST_NEIGHBOR, TYPE_BILINEAR, or TYPE_BICUBIC. + * @param xform + * the AffineTransform. + * @param interp + * the one of predefined interpolation types: + * TYPE_NEAREST_NEIGHBOR, TYPE_BILINEAR, or TYPE_BICUBIC. */ public AffineTransformOp(AffineTransform xform, int interp) { if (Math.abs(xform.getDeterminant()) <= Double.MIN_VALUE) { @@ -116,7 +128,7 @@ public class AffineTransformOp implements BufferedImageOp, RasterOp { throw new ImagingOpException(Messages.getString("awt.24F", xform)); //$NON-NLS-1$ } - this.at = (AffineTransform) xform.clone(); + this.at = (AffineTransform)xform.clone(); if (interp != TYPE_NEAREST_NEIGHBOR && interp != TYPE_BILINEAR && interp != TYPE_BICUBIC) { // awt.250=Unknown interpolation type: {0} @@ -129,7 +141,7 @@ public class AffineTransformOp implements BufferedImageOp, RasterOp { /** * Gets the interpolation type. * - * @return the interpolation type + * @return the interpolation type. */ public final int getInterpolationType() { return iType; @@ -165,7 +177,7 @@ public class AffineTransformOp implements BufferedImageOp, RasterOp { * @return the AffineTransform. */ public final AffineTransform getTransform() { - return (AffineTransform) at.clone(); + return (AffineTransform)at.clone(); } public final Point2D getPoint2D(Point2D srcPt, Point2D dstPt) { @@ -177,21 +189,19 @@ public class AffineTransformOp implements BufferedImageOp, RasterOp { } public final Rectangle2D getBounds2D(Raster src) { - // We position source raster to (0,0) even if it is translated child raster. + // We position source raster to (0,0) even if it is translated child + // raster. // This means that we need only width and height of the src int width = src.getWidth(); int height = src.getHeight(); float[] corners = { - 0, 0, - width, 0, - width, height, - 0, height + 0, 0, width, 0, width, height, 0, height }; at.transform(corners, 0, corners, 0, 4); - Rectangle2D.Float bounds = new Rectangle2D.Float(corners[0], corners[1], 0 , 0); + Rectangle2D.Float bounds = new Rectangle2D.Float(corners[0], corners[1], 0, 0); bounds.add(corners[2], corners[3]); bounds.add(corners[4], corners[5]); bounds.add(corners[6], corners[7]); @@ -208,17 +218,14 @@ public class AffineTransformOp implements BufferedImageOp, RasterOp { double dstHeight = newBounds.getY() + newBounds.getHeight(); if (dstWidth <= 0 || dstHeight <= 0) { - // awt.251=Transformed width ({0}) and height ({1}) should be greater than 0 - throw new RasterFormatException( - Messages.getString("awt.251", dstWidth, dstHeight)); //$NON-NLS-1$ + // awt.251=Transformed width ({0}) and height ({1}) should be + // greater than 0 + throw new RasterFormatException(Messages.getString("awt.251", dstWidth, dstHeight)); //$NON-NLS-1$ } if (destCM != null) { - return new BufferedImage(destCM, - destCM.createCompatibleWritableRaster((int)dstWidth, (int)dstHeight), - destCM.isAlphaPremultiplied(), - null - ); + return new BufferedImage(destCM, destCM.createCompatibleWritableRaster((int)dstWidth, + (int)dstHeight), destCM.isAlphaPremultiplied(), null); } ColorModel cm = src.getColorModel(); @@ -229,23 +236,18 @@ public class AffineTransformOp implements BufferedImageOp, RasterOp { } // OK, we can get source color model - return new BufferedImage(cm, - src.getRaster().createCompatibleWritableRaster((int)dstWidth, (int)dstHeight), - cm.isAlphaPremultiplied(), - null - ); + return new BufferedImage(cm, src.getRaster().createCompatibleWritableRaster((int)dstWidth, + (int)dstHeight), cm.isAlphaPremultiplied(), null); } - public WritableRaster createCompatibleDestRaster (Raster src) { + public WritableRaster createCompatibleDestRaster(Raster src) { // Here approach is other then in createCompatibleDestImage - // destination should include only // transformed image, but not (0,0) in source coordinate system Rectangle2D newBounds = getBounds2D(src); - return src.createCompatibleWritableRaster( - (int) newBounds.getX(), (int) newBounds.getY(), - (int) newBounds.getWidth(), (int)newBounds.getHeight() - ); + return src.createCompatibleWritableRaster((int)newBounds.getX(), (int)newBounds.getY(), + (int)newBounds.getWidth(), (int)newBounds.getHeight()); } public final BufferedImage filter(BufferedImage src, BufferedImage dst) { @@ -257,10 +259,8 @@ public class AffineTransformOp implements BufferedImageOp, RasterOp { ColorModel srcCM = src.getColorModel(); BufferedImage finalDst = null; - if ( - srcCM instanceof IndexColorModel && - (iType != TYPE_NEAREST_NEIGHBOR || srcCM.getPixelSize() % 8 != 0) - ) { + if (srcCM instanceof IndexColorModel + && (iType != TYPE_NEAREST_NEIGHBOR || srcCM.getPixelSize() % 8 != 0)) { src = ((IndexColorModel)srcCM).convertToIntDiscrete(src.getRaster(), true); srcCM = src.getColorModel(); } @@ -269,15 +269,10 @@ public class AffineTransformOp implements BufferedImageOp, RasterOp { dst = createCompatibleDestImage(src, srcCM); } else { if (!srcCM.equals(dst.getColorModel())) { - // Treat BufferedImage.TYPE_INT_RGB and BufferedImage.TYPE_INT_ARGB as same - if ( - !( - (src.getType() == BufferedImage.TYPE_INT_RGB || - src.getType() == BufferedImage.TYPE_INT_ARGB) && - (dst.getType() == BufferedImage.TYPE_INT_RGB || - dst.getType() == BufferedImage.TYPE_INT_ARGB) - ) - ) { + // Treat BufferedImage.TYPE_INT_RGB and + // BufferedImage.TYPE_INT_ARGB as same + if (!((src.getType() == BufferedImage.TYPE_INT_RGB || src.getType() == BufferedImage.TYPE_INT_ARGB) && (dst + .getType() == BufferedImage.TYPE_INT_RGB || dst.getType() == BufferedImage.TYPE_INT_ARGB))) { finalDst = dst; dst = createCompatibleDestImage(src, srcCM); } @@ -287,10 +282,11 @@ public class AffineTransformOp implements BufferedImageOp, RasterOp { // Skip alpha channel for TYPE_INT_RGB images if (slowFilter(src.getRaster(), dst.getRaster()) != 0) { // awt.21F=Unable to transform source - throw new ImagingOpException (Messages.getString("awt.21F")); //$NON-NLS-1$ - // TODO - uncomment - //if (ippFilter(src.getRaster(), dst.getRaster(), src.getType()) != 0) - //throw new ImagingOpException ("Unable to transform source"); + throw new ImagingOpException(Messages.getString("awt.21F")); //$NON-NLS-1$ + // TODO - uncomment + // if (ippFilter(src.getRaster(), dst.getRaster(), src.getType()) != + // 0) + // throw new ImagingOpException ("Unable to transform source"); } if (finalDst != null) { @@ -320,9 +316,9 @@ public class AffineTransformOp implements BufferedImageOp, RasterOp { if (slowFilter(src, dst) != 0) { // awt.21F=Unable to transform source throw new ImagingOpException(Messages.getString("awt.21F")); //$NON-NLS-1$ - // TODO - uncomment - //if (ippFilter(src, dst, BufferedImage.TYPE_CUSTOM) != 0) - // throw new ImagingOpException("Unable to transform source"); + // TODO - uncomment + // if (ippFilter(src, dst, BufferedImage.TYPE_CUSTOM) != 0) + // throw new ImagingOpException("Unable to transform source"); } return dst; @@ -332,11 +328,13 @@ public class AffineTransformOp implements BufferedImageOp, RasterOp { /** * Ipp filter. * - * @param src the src - * @param dst the dst - * @param imageType the image type - * - * @return the int + * @param src + * the src. + * @param dst + * the dst. + * @param imageType + * the image type. + * @return the int. */ @SuppressWarnings("unused") private int ippFilter(Raster src, WritableRaster dst, int imageType) { @@ -349,8 +347,8 @@ public class AffineTransformOp implements BufferedImageOp, RasterOp { case BufferedImage.TYPE_INT_RGB: case BufferedImage.TYPE_INT_BGR: { channels = 4; - srcStride = src.getWidth()*4; - dstStride = dst.getWidth()*4; + srcStride = src.getWidth() * 4; + dstStride = dst.getWidth() * 4; skipChannel = true; break; } @@ -360,8 +358,8 @@ public class AffineTransformOp implements BufferedImageOp, RasterOp { case BufferedImage.TYPE_4BYTE_ABGR: case BufferedImage.TYPE_4BYTE_ABGR_PRE: { channels = 4; - srcStride = src.getWidth()*4; - dstStride = dst.getWidth()*4; + srcStride = src.getWidth() * 4; + dstStride = dst.getWidth() * 4; break; } @@ -375,12 +373,13 @@ public class AffineTransformOp implements BufferedImageOp, RasterOp { case BufferedImage.TYPE_3BYTE_BGR: { channels = 3; - srcStride = src.getWidth()*3; - dstStride = dst.getWidth()*3; + srcStride = src.getWidth() * 3; + dstStride = dst.getWidth() * 3; break; } - case BufferedImage.TYPE_USHORT_GRAY: // TODO - could be done in native code? + case BufferedImage.TYPE_USHORT_GRAY: // TODO - could be done in + // native code? case BufferedImage.TYPE_USHORT_565_RGB: case BufferedImage.TYPE_USHORT_555_RGB: case BufferedImage.TYPE_BYTE_BINARY: { @@ -391,34 +390,29 @@ public class AffineTransformOp implements BufferedImageOp, RasterOp { SampleModel srcSM = src.getSampleModel(); SampleModel dstSM = dst.getSampleModel(); - if ( - srcSM instanceof PixelInterleavedSampleModel && - dstSM instanceof PixelInterleavedSampleModel - ) { + if (srcSM instanceof PixelInterleavedSampleModel + && dstSM instanceof PixelInterleavedSampleModel) { // Check PixelInterleavedSampleModel - if ( - srcSM.getDataType() != DataBuffer.TYPE_BYTE || - dstSM.getDataType() != DataBuffer.TYPE_BYTE - ) { + if (srcSM.getDataType() != DataBuffer.TYPE_BYTE + || dstSM.getDataType() != DataBuffer.TYPE_BYTE) { return slowFilter(src, dst); } - channels = srcSM.getNumBands(); // Have IPP functions for 1, 3 and 4 channels + channels = srcSM.getNumBands(); // Have IPP functions for 1, + // 3 and 4 channels if (channels != 1 && channels != 3 && channels != 4) { return slowFilter(src, dst); } int dataTypeSize = DataBuffer.getDataTypeSize(srcSM.getDataType()) / 8; - srcStride = ((ComponentSampleModel) srcSM).getScanlineStride() * dataTypeSize; - dstStride = ((ComponentSampleModel) dstSM).getScanlineStride() * dataTypeSize; - } else if ( - srcSM instanceof SinglePixelPackedSampleModel && - dstSM instanceof SinglePixelPackedSampleModel - ) { + srcStride = ((ComponentSampleModel)srcSM).getScanlineStride() * dataTypeSize; + dstStride = ((ComponentSampleModel)dstSM).getScanlineStride() * dataTypeSize; + } else if (srcSM instanceof SinglePixelPackedSampleModel + && dstSM instanceof SinglePixelPackedSampleModel) { // Check SinglePixelPackedSampleModel - SinglePixelPackedSampleModel sppsm1 = (SinglePixelPackedSampleModel) srcSM; - SinglePixelPackedSampleModel sppsm2 = (SinglePixelPackedSampleModel) dstSM; + SinglePixelPackedSampleModel sppsm1 = (SinglePixelPackedSampleModel)srcSM; + SinglePixelPackedSampleModel sppsm2 = (SinglePixelPackedSampleModel)dstSM; // No IPP function for this type if (sppsm1.getDataType() == DataBuffer.TYPE_USHORT) { @@ -432,15 +426,13 @@ public class AffineTransformOp implements BufferedImageOp, RasterOp { } // Check compatibility of sample models - if ( - sppsm1.getDataType() != sppsm2.getDataType() || - !Arrays.equals(sppsm1.getBitOffsets(), sppsm2.getBitOffsets()) || - !Arrays.equals(sppsm1.getBitMasks(), sppsm2.getBitMasks()) - ) { + if (sppsm1.getDataType() != sppsm2.getDataType() + || !Arrays.equals(sppsm1.getBitOffsets(), sppsm2.getBitOffsets()) + || !Arrays.equals(sppsm1.getBitMasks(), sppsm2.getBitMasks())) { return slowFilter(src, dst); } - for (int i=0; i> 8; int py = sy >> 8; if (px >= minSrcX && py >= minSrcY && px < maxSrcX && py < maxSrcY) { - Object val = src.getDataElements(px , py , null); + Object val = src.getDataElements(px, py, null); dst.setDataElements(x, y, val); } sx += hx; @@ -585,33 +573,46 @@ public class AffineTransformOp implements BufferedImageOp, RasterOp { /** * Ipp affine transform. * - * @param m00 the m00 - * @param m01 the m01 - * @param m02 the m02 - * @param m10 the m10 - * @param m11 the m11 - * @param m12 the m12 - * @param src the src - * @param srcWidth the src width - * @param srcHeight the src height - * @param srcStride the src stride - * @param dst the dst - * @param dstWidth the dst width - * @param dstHeight the dst height - * @param dstStride the dst stride - * @param iType the i type - * @param channels the channels - * @param skipChannel the skip channel - * @param offsets the offsets - * - * @return the int + * @param m00 + * the m00. + * @param m01 + * the m01. + * @param m02 + * the m02. + * @param m10 + * the m10. + * @param m11 + * the m11. + * @param m12 + * the m12. + * @param src + * the src. + * @param srcWidth + * the src width. + * @param srcHeight + * the src height. + * @param srcStride + * the src stride. + * @param dst + * the dst. + * @param dstWidth + * the dst width. + * @param dstHeight + * the dst height. + * @param dstStride + * the dst stride. + * @param iType + * the i type. + * @param channels + * the channels. + * @param skipChannel + * the skip channel. + * @param offsets + * the offsets. + * @return the int. */ - private native int ippAffineTransform( - double m00, double m01, - double m02, double m10, - double m11, double m12, - Object src, int srcWidth, int srcHeight, int srcStride, - Object dst, int dstWidth, int dstHeight, int dstStride, - int iType, int channels, boolean skipChannel, - int offsets[]); + private native int ippAffineTransform(double m00, double m01, double m02, double m10, + double m11, double m12, Object src, int srcWidth, int srcHeight, int srcStride, + Object dst, int dstWidth, int dstHeight, int dstStride, int iType, int channels, + boolean skipChannel, int offsets[]); } \ No newline at end of file diff --git a/awt/java/awt/image/AreaAveragingScaleFilter.java b/awt/java/awt/image/AreaAveragingScaleFilter.java index f4933db67b19c..7fb138e7fa225 100644 --- a/awt/java/awt/image/AreaAveragingScaleFilter.java +++ b/awt/java/awt/image/AreaAveragingScaleFilter.java @@ -18,72 +18,101 @@ * @author Igor V. Stolyarov * @version $Revision$ */ + package java.awt.image; import java.util.Arrays; - /** - * The AreaAveragingScaleFilter class scales the source image using - * area averaging algorithm. This algorithm provides a source image - * with a new image containing the resampled image. + * The AreaAveragingScaleFilter class scales the source image using area + * averaging algorithm. This algorithm provides a source image with a new image + * containing the resampled image. + * + * @since Android 1.0 */ public class AreaAveragingScaleFilter extends ReplicateScaleFilter { - /** The Constant rgbCM. */ + /** + * The Constant rgbCM. + */ private static final ColorModel rgbCM = ColorModel.getRGBdefault(); - - /** The Constant averagingFlags. */ - private static final int averagingFlags = (ImageConsumer.TOPDOWNLEFTRIGHT | - ImageConsumer.COMPLETESCANLINES); - - /** The reset. */ - private boolean reset = true; // Flag for used superclass filter - - /** The inited. */ + + /** + * The Constant averagingFlags. + */ + private static final int averagingFlags = (ImageConsumer.TOPDOWNLEFTRIGHT | ImageConsumer.COMPLETESCANLINES); + + /** + * The reset. + */ + private boolean reset = true; // Flag for used superclass filter + + /** + * The inited. + */ private boolean inited = false; // All data inited - /** The sum_r. */ + /** + * The sum_r. + */ private int sum_r[]; // Array for average Red samples - - /** The sum_g. */ + + /** + * The sum_g. + */ private int sum_g[]; // Array for average Green samples - - /** The sum_b. */ + + /** + * The sum_b. + */ private int sum_b[]; // Array for average Blue samples - - /** The sum_a. */ + + /** + * The sum_a. + */ private int sum_a[]; // Array for average Alpha samples - /** The buff. */ - private int buff[]; // Stride buffer - - /** The avg factor. */ - private int avgFactor; // Global averaging factor - - /** The cached dy. */ - private int cachedDY; // Cached number of the destination scanline - - /** The cached dv rest. */ - private int cachedDVRest; // Cached value of rest src scanlines for sum - // pixel samples - // Because data if transfering by whole scanlines - // we are caching only Y coordinate values - /** - * Instantiates a new AreaAveragingScaleFilter object which scales - * a source image with the specified width and height. + * The buff. + */ + private int buff[]; // Stride buffer + + /** + * The avg factor. + */ + private int avgFactor; // Global averaging factor + + /** + * The cached dy. + */ + private int cachedDY; // Cached number of the destination scanline + + /** + * The cached dv rest. + */ + private int cachedDVRest; // Cached value of rest src scanlines for sum + + // pixel samples + // Because data if transferring by whole scanlines + // we are caching only Y coordinate values + + /** + * Instantiates a new AreaAveragingScaleFilter object which scales a source + * image with the specified width and height. * - * @param width the scaled width of the image. - * @param height the scaled height of the image. + * @param width + * the scaled width of the image. + * @param height + * the scaled height of the image. */ public AreaAveragingScaleFilter(int width, int height) { super(width, height); } @Override - public void setPixels(int x, int y, int w, int h, ColorModel model, int[] pixels, int off, int scansize) { - if(reset) { + public void setPixels(int x, int y, int w, int h, ColorModel model, int[] pixels, int off, + int scansize) { + if (reset) { super.setPixels(x, y, w, h, model, pixels, off, scansize); } else { setFilteredPixels(x, y, w, h, model, pixels, off, scansize); @@ -91,8 +120,9 @@ public class AreaAveragingScaleFilter extends ReplicateScaleFilter { } @Override - public void setPixels(int x, int y, int w, int h, ColorModel model, byte[] pixels, int off, int scansize) { - if(reset) { + public void setPixels(int x, int y, int w, int h, ColorModel model, byte[] pixels, int off, + int scansize) { + if (reset) { super.setPixels(x, y, w, h, model, pixels, off, scansize); } else { setFilteredPixels(x, y, w, h, model, pixels, off, scansize); @@ -106,37 +136,44 @@ public class AreaAveragingScaleFilter extends ReplicateScaleFilter { } /** - * This method implements the Area Averaging Scale filter. - * The description of algorithm is presented in Java API Specification. - * - * Arrays sum_r, sum_g, sum_b, sum_a have length equals width of destination - * image. In each array's element is accumulating pixel's component values, - * proportional to the area which source pixels will occupy in destination - * image. Then that values will divide by Global averaging - * factor (area of the destination image) for receiving - * average values of destination pixels. + * This method implements the Area Averaging Scale filter. The description + * of algorithm is presented in Java API Specification. Arrays sum_r, sum_g, + * sum_b, sum_a have length equals width of destination image. In each + * array's element is accumulating pixel's component values, proportional to + * the area which source pixels will occupy in destination image. Then that + * values will divide by Global averaging factor (area of the destination + * image) for receiving average values of destination pixels. * - * @param x - Src pixels X coordinate - * @param y - Src pixels Y coordinate - * @param w - width of the area of Src pixels - * @param h - height of the area of Src pixels - * @param model - Color Model of Src pixels - * @param pixels - array of Src pixels - * @param off - offset into the Src pixels array - * @param scansize - length of scanline in the pixels array + * @param x + * the source pixels X coordinate. + * @param y + * the source pixels Y coordinate. + * @param w + * the width of the area of the source pixels. + * @param h + * the height of the area of the source pixels. + * @param model + * the color model of the source pixels. + * @param pixels + * the array of source pixels. + * @param off + * the offset into the source pixels array. + * @param scansize + * the length of scanline in the pixels array. */ - private void setFilteredPixels(int x, int y, int w, int h, ColorModel model, Object pixels, int off, int scansize){ - if(!inited){ + private void setFilteredPixels(int x, int y, int w, int h, ColorModel model, Object pixels, + int off, int scansize) { + if (!inited) { initialize(); } int srcX, srcY, dx, dy; int svRest, dvRest, shRest, dhRest, vDif, hDif; - if(y == 0){ + if (y == 0) { dy = 0; dvRest = srcHeight; - }else{ + } else { dy = cachedDY; dvRest = cachedDVRest; } @@ -166,9 +203,9 @@ public class AreaAveragingScaleFilter extends ReplicateScaleFilter { int rgb, pix; if (pixels instanceof int[]) { - pix = ((int[]) pixels)[srcOff + srcX]; + pix = ((int[])pixels)[srcOff + srcX]; } else { - pix = ((byte[]) pixels)[srcOff + srcX] & 0xff; + pix = ((byte[])pixels)[srcOff + srcX] & 0xff; } rgb = model.getRGB(pix); @@ -208,7 +245,7 @@ public class AreaAveragingScaleFilter extends ReplicateScaleFilter { if (dvRest == 0) { // averaging destination pixel's values - for(int i = 0; i < destWidth; i++){ + for (int i = 0; i < destWidth; i++) { int a = (sum_a[i] / avgFactor) & 0xff; int r = (sum_r[i] / avgFactor) & 0xff; int g = (sum_g[i] / avgFactor) & 0xff; @@ -216,8 +253,7 @@ public class AreaAveragingScaleFilter extends ReplicateScaleFilter { int frgb = (a << 24) | (r << 16) | (g << 8) | b; buff[i] = frgb; } - consumer.setPixels(0, dy, destWidth, 1, rgbCM, buff, 0, - destWidth); + consumer.setPixels(0, dy, destWidth, 1, rgbCM, buff, 0, destWidth); dy++; dvRest = srcHeight; Arrays.fill(sum_a, 0); @@ -236,18 +272,17 @@ public class AreaAveragingScaleFilter extends ReplicateScaleFilter { /** * Initialization of the auxiliary data. */ - private void initialize(){ + private void initialize() { - sum_a = new int[destWidth]; - sum_r = new int[destWidth]; - sum_g = new int[destWidth]; - sum_b = new int[destWidth]; + sum_a = new int[destWidth]; + sum_r = new int[destWidth]; + sum_g = new int[destWidth]; + sum_b = new int[destWidth]; - buff = new int[destWidth]; + buff = new int[destWidth]; outpixbuf = buff; - avgFactor = srcWidth * srcHeight; + avgFactor = srcWidth * srcHeight; inited = true; } } - diff --git a/awt/java/awt/image/AwtImageBackdoorAccessorImpl.java b/awt/java/awt/image/AwtImageBackdoorAccessorImpl.java index ce85ddda4b2d0..6dffee88f61d5 100644 --- a/awt/java/awt/image/AwtImageBackdoorAccessorImpl.java +++ b/awt/java/awt/image/AwtImageBackdoorAccessorImpl.java @@ -20,6 +20,7 @@ * Created on 23.11.2005 * */ + package java.awt.image; import java.awt.Image; @@ -40,41 +41,43 @@ import org.apache.harmony.awt.internal.nls.Messages; /** * This class not part of public API. It useful for receiving package private * data from other packages. + * + * @since Android 1.0 */ class AwtImageBackdoorAccessorImpl extends AwtImageBackdoorAccessor { - static void init(){ + static void init() { inst = new AwtImageBackdoorAccessorImpl(); } @Override public Surface getImageSurface(Image image) { - if (image instanceof BufferedImage){ + if (image instanceof BufferedImage) { return ((BufferedImage)image).getImageSurface(); - } else if (image instanceof GLVolatileImage){ + } else if (image instanceof GLVolatileImage) { return ((GLVolatileImage)image).getImageSurface(); } return null; } @Override - public boolean isGrayPallete(IndexColorModel icm){ + public boolean isGrayPallete(IndexColorModel icm) { return icm.isGrayPallete(); } @Override public Object getData(DataBuffer db) { - if (db instanceof DataBufferByte){ + if (db instanceof DataBufferByte) { return ((DataBufferByte)db).getData(); - } else if (db instanceof DataBufferUShort){ + } else if (db instanceof DataBufferUShort) { return ((DataBufferUShort)db).getData(); - } else if (db instanceof DataBufferShort){ + } else if (db instanceof DataBufferShort) { return ((DataBufferShort)db).getData(); - } else if (db instanceof DataBufferInt){ + } else if (db instanceof DataBufferInt) { return ((DataBufferInt)db).getData(); - } else if (db instanceof DataBufferFloat){ + } else if (db instanceof DataBufferFloat) { return ((DataBufferFloat)db).getData(); - } else if (db instanceof DataBufferDouble){ + } else if (db instanceof DataBufferDouble) { return ((DataBufferDouble)db).getData(); } else { // awt.235=Wrong Data Buffer type : {0} @@ -85,7 +88,7 @@ class AwtImageBackdoorAccessorImpl extends AwtImageBackdoorAccessor { @Override public int[] getDataInt(DataBuffer db) { - if (db instanceof DataBufferInt){ + if (db instanceof DataBufferInt) { return ((DataBufferInt)db).getData(); } return null; @@ -93,7 +96,7 @@ class AwtImageBackdoorAccessorImpl extends AwtImageBackdoorAccessor { @Override public byte[] getDataByte(DataBuffer db) { - if (db instanceof DataBufferByte){ + if (db instanceof DataBufferByte) { return ((DataBufferByte)db).getData(); } return null; @@ -101,7 +104,7 @@ class AwtImageBackdoorAccessorImpl extends AwtImageBackdoorAccessor { @Override public short[] getDataShort(DataBuffer db) { - if (db instanceof DataBufferShort){ + if (db instanceof DataBufferShort) { return ((DataBufferShort)db).getData(); } return null; @@ -109,7 +112,7 @@ class AwtImageBackdoorAccessorImpl extends AwtImageBackdoorAccessor { @Override public short[] getDataUShort(DataBuffer db) { - if (db instanceof DataBufferUShort){ + if (db instanceof DataBufferUShort) { return ((DataBufferUShort)db).getData(); } return null; @@ -117,7 +120,7 @@ class AwtImageBackdoorAccessorImpl extends AwtImageBackdoorAccessor { @Override public double[] getDataDouble(DataBuffer db) { - if (db instanceof DataBufferDouble){ + if (db instanceof DataBufferDouble) { return ((DataBufferDouble)db).getData(); } return null; @@ -125,7 +128,7 @@ class AwtImageBackdoorAccessorImpl extends AwtImageBackdoorAccessor { @Override public float[] getDataFloat(DataBuffer db) { - if (db instanceof DataBufferFloat){ + if (db instanceof DataBufferFloat) { return ((DataBufferFloat)db).getData(); } return null; diff --git a/awt/java/awt/image/BandCombineOp.java b/awt/java/awt/image/BandCombineOp.java index cd77a21ff8286..da2cc8944df84 100644 --- a/awt/java/awt/image/BandCombineOp.java +++ b/awt/java/awt/image/BandCombineOp.java @@ -32,82 +32,124 @@ import org.apache.harmony.awt.gl.AwtImageBackdoorAccessor; import org.apache.harmony.awt.internal.nls.Messages; /** - * The BandCombineOp class translates coordinates from - * coordinates in the source Raster to coordinates in - * the destination Raster by an arbitrary linear combination - * of the bands in a source Raster, using a specified matrix. - * The number of bands in the matrix should equal to - * the number of bands in the source Raster plus 1. + * The BandCombineOp class translates coordinates from coordinates in the source + * Raster to coordinates in the destination Raster by an arbitrary linear + * combination of the bands in a source Raster, using a specified matrix. The + * number of bands in the matrix should equal to the number of bands in the + * source Raster plus 1. + * + * @since Android 1.0 */ public class BandCombineOp implements RasterOp { - - /** The Constant offsets3c. */ - static final int offsets3c[] = {16, 8, 0}; - - /** The Constant offsets4ac. */ - static final int offsets4ac[] = {16, 8, 0, 24}; - - /** The Constant masks3c. */ - static final int masks3c[] = {0xFF0000, 0xFF00, 0xFF}; - - /** The Constant masks4ac. */ - static final int masks4ac[] = {0xFF0000, 0xFF00, 0xFF, 0xFF000000}; - - /** The Constant piOffsets. */ - private static final int piOffsets[] = {0, 1, 2}; - - /** The Constant piInvOffsets. */ - private static final int piInvOffsets[] = {2, 1, 0}; - - /** The Constant TYPE_BYTE3C. */ + + /** + * The Constant offsets3c. + */ + static final int offsets3c[] = { + 16, 8, 0 + }; + + /** + * The Constant offsets4ac. + */ + static final int offsets4ac[] = { + 16, 8, 0, 24 + }; + + /** + * The Constant masks3c. + */ + static final int masks3c[] = { + 0xFF0000, 0xFF00, 0xFF + }; + + /** + * The Constant masks4ac. + */ + static final int masks4ac[] = { + 0xFF0000, 0xFF00, 0xFF, 0xFF000000 + }; + + /** + * The Constant piOffsets. + */ + private static final int piOffsets[] = { + 0, 1, 2 + }; + + /** + * The Constant piInvOffsets. + */ + private static final int piInvOffsets[] = { + 2, 1, 0 + }; + + /** + * The Constant TYPE_BYTE3C. + */ private static final int TYPE_BYTE3C = 0; - - /** The Constant TYPE_BYTE4AC. */ + + /** + * The Constant TYPE_BYTE4AC. + */ private static final int TYPE_BYTE4AC = 1; - - /** The Constant TYPE_USHORT3C. */ + + /** + * The Constant TYPE_USHORT3C. + */ private static final int TYPE_USHORT3C = 2; - - /** The Constant TYPE_SHORT3C. */ + + /** + * The Constant TYPE_SHORT3C. + */ private static final int TYPE_SHORT3C = 3; - /** The mx width. */ + /** + * The mx width. + */ private int mxWidth; - - /** The mx height. */ + + /** + * The mx height. + */ private int mxHeight; - - /** The matrix. */ + + /** + * The matrix. + */ private float matrix[][]; - - /** The r hints. */ + + /** + * The r hints. + */ private RenderingHints rHints; static { // XXX - todo - //System.loadLibrary("imageops"); + // System.loadLibrary("imageops"); } /** - * Instantiates a new BandCombineOp object with the specified - * matrix. + * Instantiates a new BandCombineOp object with the specified matrix. * - * @param matrix the specified matrix for band combining. - * @param hints the RenderingHints. + * @param matrix + * the specified matrix for band combining. + * @param hints + * the RenderingHints. */ public BandCombineOp(float matrix[][], RenderingHints hints) { this.mxHeight = matrix.length; this.mxWidth = matrix[0].length; this.matrix = new float[mxHeight][mxWidth]; - for (int i=0; i= dstInfo.channelsOrder.length) { continue; } - for (int i=0; i= srcInfo.channelsOrder.length) { break; } - reorderedMatrix[dstInfo.channelsOrder[j]*rmxWidth + srcInfo.channelsOrder[i]] = - matrix[j][i]; + reorderedMatrix[dstInfo.channelsOrder[j] * rmxWidth + srcInfo.channelsOrder[i]] = matrix[j][i]; } if (mxWidth == rmxWidth) { - reorderedMatrix[(dstInfo.channelsOrder[j]+1)*rmxWidth - 1] = matrix[j][mxWidth-1]; + reorderedMatrix[(dstInfo.channelsOrder[j] + 1) * rmxWidth - 1] = matrix[j][mxWidth - 1]; } } @@ -311,11 +365,9 @@ public class BandCombineOp implements RasterOp { return -1; // Unknown data buffer type } - simpleCombineBands( - srcData, src.getWidth(), src.getHeight(), srcInfo.stride, srcInfo.channels, - dstData, dstInfo.stride, dstInfo.channels, - reorderedMatrix, offsets - ); + simpleCombineBands(srcData, src.getWidth(), src.getHeight(), srcInfo.stride, + srcInfo.channels, dstData, dstInfo.stride, dstInfo.channels, reorderedMatrix, + offsets); return res; } @@ -323,10 +375,11 @@ public class BandCombineOp implements RasterOp { /** * Very slow filter. * - * @param src the src - * @param dst the dst - * - * @return the int + * @param src + * the src. + * @param dst + * the dst. + * @return the int. */ private int verySlowFilter(Raster src, WritableRaster dst) { int numBands = src.getNumBands(); @@ -337,33 +390,35 @@ public class BandCombineOp implements RasterOp { int dstMinX = dst.getMinX(); int dstY = dst.getMinY(); - int dX = src.getWidth();//< dst.getWidth() ? src.getWidth() : dst.getWidth(); - int dY = src.getHeight();//< dst.getHeight() ? src.getHeight() : dst.getHeight(); + int dX = src.getWidth();// < dst.getWidth() ? src.getWidth() : + // dst.getWidth(); + int dY = src.getHeight();// < dst.getHeight() ? src.getHeight() : + // dst.getHeight(); float sample; - int srcPixels[] = new int[numBands*dX*dY]; - int dstPixels[] = new int[mxHeight*dX*dY]; + int srcPixels[] = new int[numBands * dX * dY]; + int dstPixels[] = new int[mxHeight * dX * dY]; srcPixels = src.getPixels(srcMinX, srcY, dX, dY, srcPixels); if (numBands == mxWidth) { - for (int i=0, j=0; i numBands) { - // awt.64=The number of the bands in the subset is greater than the number of bands in the sample model + // awt.64=The number of the bands in the subset is greater than the + // number of bands in the sample model throw new RasterFormatException(Messages.getString("awt.64")); //$NON-NLS-1$ } @@ -141,94 +151,93 @@ public final class BandedSampleModel extends ComponentSampleModel { offsets[i] = bandOffsets[bands[i]]; } - return new BandedSampleModel(dataType, width, height, scanlineStride, - indices, offsets); + return new BandedSampleModel(dataType, width, height, scanlineStride, indices, offsets); } @Override public Object getDataElements(int x, int y, Object obj, DataBuffer data) { switch (dataType) { - case DataBuffer.TYPE_BYTE: { - byte bdata[]; + case DataBuffer.TYPE_BYTE: { + byte bdata[]; - if (obj == null) { - bdata = new byte[numBands]; - } else { - bdata = (byte[]) obj; - } + if (obj == null) { + bdata = new byte[numBands]; + } else { + bdata = (byte[])obj; + } - for (int i = 0; i < numBands; i++) { - bdata[i] = (byte) getSample(x, y, i, data); - } + for (int i = 0; i < numBands; i++) { + bdata[i] = (byte)getSample(x, y, i, data); + } - obj = bdata; - break; - } - case DataBuffer.TYPE_SHORT: - case DataBuffer.TYPE_USHORT: { - short sdata[]; - - if (obj == null) { - sdata = new short[numBands]; - } else { - sdata = (short[]) obj; + obj = bdata; + break; } + case DataBuffer.TYPE_SHORT: + case DataBuffer.TYPE_USHORT: { + short sdata[]; + + if (obj == null) { + sdata = new short[numBands]; + } else { + sdata = (short[])obj; + } - for (int i = 0; i < numBands; i++) { - sdata[i] = (short) getSample(x, y, i, data); + for (int i = 0; i < numBands; i++) { + sdata[i] = (short)getSample(x, y, i, data); + } + + obj = sdata; + break; } + case DataBuffer.TYPE_INT: { + int idata[]; - obj = sdata; - break; - } - case DataBuffer.TYPE_INT: { - int idata[]; + if (obj == null) { + idata = new int[numBands]; + } else { + idata = (int[])obj; + } - if (obj == null) { - idata = new int[numBands]; - } else { - idata = (int[]) obj; - } + for (int i = 0; i < numBands; i++) { + idata[i] = getSample(x, y, i, data); + } - for (int i = 0; i < numBands; i++) { - idata[i] = getSample(x, y, i, data); + obj = idata; + break; } + case DataBuffer.TYPE_FLOAT: { + float fdata[]; - obj = idata; - break; - } - case DataBuffer.TYPE_FLOAT: { - float fdata[]; + if (obj == null) { + fdata = new float[numBands]; + } else { + fdata = (float[])obj; + } - if (obj == null) { - fdata = new float[numBands]; - } else { - fdata = (float[]) obj; - } + for (int i = 0; i < numBands; i++) { + fdata[i] = getSampleFloat(x, y, i, data); + } - for (int i = 0; i < numBands; i++) { - fdata[i] = getSampleFloat(x, y, i, data); + obj = fdata; + break; } + case DataBuffer.TYPE_DOUBLE: { + double ddata[]; - obj = fdata; - break; - } - case DataBuffer.TYPE_DOUBLE: { - double ddata[]; + if (obj == null) { + ddata = new double[numBands]; + } else { + ddata = (double[])obj; + } - if (obj == null) { - ddata = new double[numBands]; - } else { - ddata = (double[]) obj; - } + for (int i = 0; i < numBands; i++) { + ddata[i] = getSampleDouble(x, y, i, data); + } - for (int i = 0; i < numBands; i++) { - ddata[i] = getSampleDouble(x, y, i, data); + obj = ddata; + break; } - - obj = ddata; - break; - } } return obj; @@ -257,8 +266,7 @@ public final class BandedSampleModel extends ComponentSampleModel { throw new ArrayIndexOutOfBoundsException(Messages.getString("awt.63")); //$NON-NLS-1$ } - return data.getElem(bankIndices[b], y * scanlineStride + x + - bandOffsets[b]); + return data.getElem(bankIndices[b], y * scanlineStride + x + bandOffsets[b]); } @Override @@ -268,8 +276,7 @@ public final class BandedSampleModel extends ComponentSampleModel { throw new ArrayIndexOutOfBoundsException(Messages.getString("awt.63")); //$NON-NLS-1$ } - return data.getElemDouble(bankIndices[b], y * scanlineStride + x + - bandOffsets[b]); + return data.getElemDouble(bankIndices[b], y * scanlineStride + x + bandOffsets[b]); } @Override @@ -279,13 +286,11 @@ public final class BandedSampleModel extends ComponentSampleModel { throw new ArrayIndexOutOfBoundsException(Messages.getString("awt.63")); //$NON-NLS-1$ } - return data.getElemFloat(bankIndices[b], y * scanlineStride + x + - bandOffsets[b]); + return data.getElemFloat(bankIndices[b], y * scanlineStride + x + bandOffsets[b]); } @Override - public int[] getSamples(int x, int y, int w, int h, int b, int iArray[], - DataBuffer data) { + public int[] getSamples(int x, int y, int w, int h, int b, int iArray[], DataBuffer data) { int samples[]; int idx = 0; @@ -317,41 +322,41 @@ public final class BandedSampleModel extends ComponentSampleModel { @Override public void setDataElements(int x, int y, Object obj, DataBuffer data) { switch (dataType) { - case DataBuffer.TYPE_BYTE: - byte bdata[] = (byte[]) obj; - for (int i = 0; i < numBands; i++) { - setSample(x, y, i, bdata[i] & 0xff, data); - } - break; + case DataBuffer.TYPE_BYTE: + byte bdata[] = (byte[])obj; + for (int i = 0; i < numBands; i++) { + setSample(x, y, i, bdata[i] & 0xff, data); + } + break; - case DataBuffer.TYPE_SHORT: - case DataBuffer.TYPE_USHORT: - short sdata[] = (short[]) obj; - for (int i = 0; i < numBands; i++) { - setSample(x, y, i, sdata[i] & 0xffff, data); - } - break; + case DataBuffer.TYPE_SHORT: + case DataBuffer.TYPE_USHORT: + short sdata[] = (short[])obj; + for (int i = 0; i < numBands; i++) { + setSample(x, y, i, sdata[i] & 0xffff, data); + } + break; - case DataBuffer.TYPE_INT: - int idata[] = (int[]) obj; - for (int i = 0; i < numBands; i++) { - setSample(x, y, i, idata[i], data); - } - break; + case DataBuffer.TYPE_INT: + int idata[] = (int[])obj; + for (int i = 0; i < numBands; i++) { + setSample(x, y, i, idata[i], data); + } + break; - case DataBuffer.TYPE_FLOAT: - float fdata[] = (float[]) obj; - for (int i = 0; i < numBands; i++) { - setSample(x, y, i, fdata[i], data); - } - break; + case DataBuffer.TYPE_FLOAT: + float fdata[] = (float[])obj; + for (int i = 0; i < numBands; i++) { + setSample(x, y, i, fdata[i], data); + } + break; - case DataBuffer.TYPE_DOUBLE: - double ddata[] = (double[]) obj; - for (int i = 0; i < numBands; i++) { - setSample(x, y, i, ddata[i], data); - } - break; + case DataBuffer.TYPE_DOUBLE: + double ddata[] = (double[])obj; + for (int i = 0; i < numBands; i++) { + setSample(x, y, i, ddata[i], data); + } + break; } } @@ -363,8 +368,7 @@ public final class BandedSampleModel extends ComponentSampleModel { } @Override - public void setPixels(int x, int y, int w, int h, int iArray[], - DataBuffer data) { + public void setPixels(int x, int y, int w, int h, int iArray[], DataBuffer data) { int idx = 0; for (int i = y; i < y + h; i++) { @@ -383,8 +387,7 @@ public final class BandedSampleModel extends ComponentSampleModel { throw new ArrayIndexOutOfBoundsException(Messages.getString("awt.63")); //$NON-NLS-1$ } - data.setElemDouble(bankIndices[b], y * scanlineStride + x + - bandOffsets[b], s); + data.setElemDouble(bankIndices[b], y * scanlineStride + x + bandOffsets[b], s); } @Override @@ -394,8 +397,7 @@ public final class BandedSampleModel extends ComponentSampleModel { throw new ArrayIndexOutOfBoundsException(Messages.getString("awt.63")); //$NON-NLS-1$ } - data.setElemFloat(bankIndices[b], y * scanlineStride + x + - bandOffsets[b], s); + data.setElemFloat(bankIndices[b], y * scanlineStride + x + bandOffsets[b], s); } @Override @@ -405,13 +407,11 @@ public final class BandedSampleModel extends ComponentSampleModel { throw new ArrayIndexOutOfBoundsException(Messages.getString("awt.63")); //$NON-NLS-1$ } - data.setElem(bankIndices[b], y * scanlineStride + x + - bandOffsets[b], s); + data.setElem(bankIndices[b], y * scanlineStride + x + bandOffsets[b], s); } @Override - public void setSamples(int x, int y, int w, int h, int b, int iArray[], - DataBuffer data) { + public void setSamples(int x, int y, int w, int h, int b, int iArray[], DataBuffer data) { int idx = 0; for (int i = y; i < y + h; i++) { @@ -423,4 +423,3 @@ public final class BandedSampleModel extends ComponentSampleModel { } } - diff --git a/awt/java/awt/image/BufferStrategy.java b/awt/java/awt/image/BufferStrategy.java index e0508f0cf1e59..3c8779dac990c 100644 --- a/awt/java/awt/image/BufferStrategy.java +++ b/awt/java/awt/image/BufferStrategy.java @@ -18,35 +18,37 @@ * @author Igor V. Stolyarov * @version $Revision$ */ + package java.awt.image; import java.awt.BufferCapabilities; import java.awt.Graphics; /** - * The BufferStrategy abstract class provides an opportunity - * to organize the buffers for a Canvas or Window. The BufferStrategy - * implementation depends on hardware and software limitations. - * These limitations are detectible through the capabilities - * object which can be obtained by the GraphicsConfiguration of the Canvas - * or Window. + * The BufferStrategy abstract class provides an opportunity to organize the + * buffers for a Canvas or Window. The BufferStrategy implementation depends on + * hardware and software limitations. These limitations are detectable through + * the capabilities object which can be obtained by the GraphicsConfiguration of + * the Canvas or Window. + * + * @since Android 1.0 */ public abstract class BufferStrategy { /** - * Returns true if the drawing buffer was lost since the last call - * of getDrawGraphics. + * Returns true if the drawing buffer was lost since the last call of + * getDrawGraphics. * - * @return true if the drawing buffer was lost since the last call - * of getDrawGraphics, false otherwise. + * @return true if the drawing buffer was lost since the last call of + * getDrawGraphics, false otherwise. */ public abstract boolean contentsLost(); /** - * Returns true if the drawing buffer is restored from a lost state. + * Returns true if the drawing buffer is restored from a lost state. * - * @return true if the drawing buffer is restored from a lost state, - * false otherwise. + * @return true if the drawing buffer is restored from a lost state, false + * otherwise. */ public abstract boolean contentsRestored(); diff --git a/awt/java/awt/image/BufferedImage.java b/awt/java/awt/image/BufferedImage.java index d305d660b946d..c9d58d97f2635 100644 --- a/awt/java/awt/image/BufferedImage.java +++ b/awt/java/awt/image/BufferedImage.java @@ -18,6 +18,7 @@ * @author Igor V. Stolyarov * @version $Revision$ */ + package java.awt.image; import com.android.internal.awt.AndroidGraphics2D; @@ -39,184 +40,215 @@ import org.apache.harmony.awt.gl.Surface; import org.apache.harmony.awt.gl.image.BufferedImageSource; import org.apache.harmony.awt.internal.nls.Messages; - /** - * The BufferedImage class describes an Image which contains a buffer - * of image data and includes a ColorModel and a Raster for this data. - * This class provides methods for obtaining and setting the Raster - * and for manipulating the ColorModel parameters. + * The BufferedImage class describes an Image which contains a buffer of image + * data and includes a ColorModel and a Raster for this data. This class + * provides methods for obtaining and setting the Raster and for manipulating + * the ColorModel parameters. + * + * @since Android 1.0 */ -public class BufferedImage extends -Image implements WritableRenderedImage, Transparency{ +public class BufferedImage extends Image implements WritableRenderedImage, Transparency { - /** - * The Constant TYPE_CUSTOM indicates that Image type - * is unknown. + /** + * The Constant TYPE_CUSTOM indicates that Image type is unknown. */ public static final int TYPE_CUSTOM = 0; - /** - * The Constant TYPE_INT_RGB indicates an image with - * 8 bit RGB color components, it has a DirectColorModel - * without alpha. + /** + * The Constant TYPE_INT_RGB indicates an image with 8 bit RGB color + * components, it has a DirectColorModel without alpha. */ public static final int TYPE_INT_RGB = 1; - /** - * The Constant TYPE_INT_ARGB indicates an image with - * 8 bit RGBA color components, it has a DirectColorModel - * with alpha. + /** + * The Constant TYPE_INT_ARGB indicates an image with 8 bit RGBA color + * components, it has a DirectColorModel with alpha. */ public static final int TYPE_INT_ARGB = 2; - /** - * The Constant TYPE_INT_ARGB_PRE indicates an image with - * 8 bit RGBA color components, it has a DirectColorModel - * with alpha, and image data is premultiplied by alpha. + /** + * The Constant TYPE_INT_ARGB_PRE indicates an image with 8 bit RGBA color + * components, it has a DirectColorModel with alpha, and image data is + * pre-multiplied by alpha. */ public static final int TYPE_INT_ARGB_PRE = 3; - /** - * The Constant TYPE_INT_BGR indicates an image with - * 8 bit RGB color components, BGR color model - * (with the colors Blue, Green, and Red). There is no - * alpha. The image has a DirectColorModel. + /** + * The Constant TYPE_INT_BGR indicates an image with 8 bit RGB color + * components, BGR color model (with the colors Blue, Green, and Red). There + * is no alpha. The image has a DirectColorModel. */ public static final int TYPE_INT_BGR = 4; - /** - * The Constant TYPE_3BYTE_BGR indicates an image with - * 8 bit RGB color components, BGR color model - * (with the colors Blue, Green, and Red stored in 3 bytes). - * There is no alpha. The image has a ComponentColorModel. + /** + * The Constant TYPE_3BYTE_BGR indicates an image with 8 bit RGB color + * components, BGR color model (with the colors Blue, Green, and Red stored + * in 3 bytes). There is no alpha. The image has a ComponentColorModel. */ public static final int TYPE_3BYTE_BGR = 5; - /** - * The Constant TYPE_4BYTE_ABGR indicates an image with - * 8 bit RGBA color components stored in 3 bytes and 1 byte of alpha. - * It has a ComponentColorModel with alpha. + /** + * The Constant TYPE_4BYTE_ABGR indicates an image with 8 bit RGBA color + * components stored in 3 bytes and 1 byte of alpha. It has a + * ComponentColorModel with alpha. */ public static final int TYPE_4BYTE_ABGR = 6; - /** - * The Constant TYPE_4BYTE_ABGR_PRE indicates an image with - * 8 bit RGBA color components stored in 3 bytes and 1 byte - * for alpha. The image has a ComponentColorModel with alpha. - * The color data is premultiplied with alpha. + /** + * The Constant TYPE_4BYTE_ABGR_PRE indicates an image with 8 bit RGBA color + * components stored in 3 bytes and 1 byte for alpha. The image has a + * ComponentColorModel with alpha. The color data is pre-multiplied with + * alpha. */ public static final int TYPE_4BYTE_ABGR_PRE = 7; - /** - * The Constant TYPE_USHORT_565_RGB indicates an image with - * 565 RGB color components (5-bits red, 6-bits green, 5-bits blue) - * with no alpha. This image has a DirectColorModel. + /** + * The Constant TYPE_USHORT_565_RGB indicates an image with 565 RGB color + * components (5-bits red, 6-bits green, 5-bits blue) with no alpha. This + * image has a DirectColorModel. */ public static final int TYPE_USHORT_565_RGB = 8; - /** - * The Constant TYPE_USHORT_555_RGB indicates an image with - * 555 RGB color components (5-bits red, 5-bits green, 5-bits blue) - * with no alpha. This image has a DirectColorModel. + /** + * The Constant TYPE_USHORT_555_RGB indicates an image with 555 RGB color + * components (5-bits red, 5-bits green, 5-bits blue) with no alpha. This + * image has a DirectColorModel. */ public static final int TYPE_USHORT_555_RGB = 9; - /** - * The Constant TYPE_BYTE_GRAY indicates a unsigned byte - * image. This image has a ComponentColorModel with - * a CS_GRAY ColorSpace. + /** + * The Constant TYPE_BYTE_GRAY indicates a unsigned byte image. This image + * has a ComponentColorModel with a CS_GRAY ColorSpace. */ public static final int TYPE_BYTE_GRAY = 10; - /** - * The Constant TYPE_USHORT_GRAY indicates an unsigned short - * image. This image has a ComponentColorModel with a CS_GRAY - * ColorSpace. + /** + * The Constant TYPE_USHORT_GRAY indicates an unsigned short image. This + * image has a ComponentColorModel with a CS_GRAY ColorSpace. */ public static final int TYPE_USHORT_GRAY = 11; - /** - * The Constant TYPE_BYTE_BINARY indicates an opaque byte-packed - * 1, 2 or 4 bit image. The image has an IndexColorModel without - * alpha. + /** + * The Constant TYPE_BYTE_BINARY indicates an opaque byte-packed 1, 2 or 4 + * bit image. The image has an IndexColorModel without alpha. */ public static final int TYPE_BYTE_BINARY = 12; - /** - * The Constant TYPE_BYTE_INDEXED indicates an indexed byte image. + /** + * The Constant TYPE_BYTE_INDEXED indicates an indexed byte image. */ public static final int TYPE_BYTE_INDEXED = 13; - /** The Constant ALPHA_MASK. */ + /** + * The Constant ALPHA_MASK. + */ private static final int ALPHA_MASK = 0xff000000; - /** The Constant RED_MASK. */ + /** + * The Constant RED_MASK. + */ private static final int RED_MASK = 0x00ff0000; - /** The Constant GREEN_MASK. */ + /** + * The Constant GREEN_MASK. + */ private static final int GREEN_MASK = 0x0000ff00; - /** The Constant BLUE_MASK. */ + /** + * The Constant BLUE_MASK. + */ private static final int BLUE_MASK = 0x000000ff; - /** The Constant RED_BGR_MASK. */ + /** + * The Constant RED_BGR_MASK. + */ private static final int RED_BGR_MASK = 0x000000ff; - /** The Constant GREEN_BGR_MASK. */ + /** + * The Constant GREEN_BGR_MASK. + */ private static final int GREEN_BGR_MASK = 0x0000ff00; - /** The Constant BLUE_BGR_MASK. */ + /** + * The Constant BLUE_BGR_MASK. + */ private static final int BLUE_BGR_MASK = 0x00ff0000; - /** The Constant RED_565_MASK. */ + /** + * The Constant RED_565_MASK. + */ private static final int RED_565_MASK = 0xf800; - /** The Constant GREEN_565_MASK. */ + /** + * The Constant GREEN_565_MASK. + */ private static final int GREEN_565_MASK = 0x07e0; - /** The Constant BLUE_565_MASK. */ + /** + * The Constant BLUE_565_MASK. + */ private static final int BLUE_565_MASK = 0x001f; - /** The Constant RED_555_MASK. */ + /** + * The Constant RED_555_MASK. + */ private static final int RED_555_MASK = 0x7c00; - /** The Constant GREEN_555_MASK. */ + /** + * The Constant GREEN_555_MASK. + */ private static final int GREEN_555_MASK = 0x03e0; - /** The Constant BLUE_555_MASK. */ + /** + * The Constant BLUE_555_MASK. + */ private static final int BLUE_555_MASK = 0x001f; - /** The cm. */ + /** + * The cm. + */ private ColorModel cm; - /** The raster. */ + /** + * The raster. + */ private final WritableRaster raster; - /** The image type. */ + /** + * The image type. + */ private final int imageType; - /** The properties. */ + /** + * The properties. + */ private Hashtable properties; - // Surface of the Buffered Image - used for blitting one Buffered Image + // Surface of the Buffered Image - used for blitting one Buffered Image // on the other one or on the Component - /** The image surf. */ + /** + * The image surf. + */ private final ImageSurface imageSurf; /** - * Instantiates a new BufferedImage with the specified ColorModel, - * and WritableRaster objects. The Raster data can be - * be divided or multiplied by alpha. It depends on the - * alphaPremultiplied state in the ColorModel. + * Instantiates a new BufferedImage with the specified ColorModel, and + * WritableRaster objects. The Raster data can be be divided or multiplied + * by alpha. It depends on the alphaPremultiplied state in the ColorModel. * - * @param cm the ColorModel of the new image. - * @param raster the WritableRaster of the new image. - * @param isRasterPremultiplied if true the data of the specified - * Raster is premultiplied by alpha. - * @param properties the properties of new Image. - */ - public BufferedImage(ColorModel cm, WritableRaster raster, - boolean isRasterPremultiplied, Hashtable properties) { + * @param cm + * the ColorModel of the new image. + * @param raster + * the WritableRaster of the new image. + * @param isRasterPremultiplied + * if true the data of the specified Raster is pre-multiplied by + * alpha. + * @param properties + * the properties of new Image. + */ + public BufferedImage(ColorModel cm, WritableRaster raster, boolean isRasterPremultiplied, + Hashtable properties) { if (!cm.isCompatibleRaster(raster)) { // awt.4D=The raster is incompatible with this ColorModel throw new IllegalArgumentException(Messages.getString("awt.4D")); //$NON-NLS-1$ @@ -227,7 +259,7 @@ Image implements WritableRenderedImage, Transparency{ throw new IllegalArgumentException(Messages.getString("awt.228")); //$NON-NLS-1$ } - this.cm = cm; + this.cm = cm; this.raster = raster; this.properties = properties; @@ -240,47 +272,52 @@ Image implements WritableRenderedImage, Transparency{ /** * Instantiates a new BufferedImage with the specified width, height - * predefined image type (TYPE_BYTE_BINARY or TYPE_BYTE_INDEXED) - * and the specified IndexColorModel. + * predefined image type (TYPE_BYTE_BINARY or TYPE_BYTE_INDEXED) and the + * specified IndexColorModel. * - * @param width the width of new image. - * @param height the height of new image. - * @param imageType the predefined image type. - * @param cm the specified IndexColorModel. + * @param width + * the width of new image. + * @param height + * the height of new image. + * @param imageType + * the predefined image type. + * @param cm + * the specified IndexColorModel. */ - public BufferedImage(int width, int height, int imageType, - IndexColorModel cm) { + public BufferedImage(int width, int height, int imageType, IndexColorModel cm) { switch (imageType) { - case TYPE_BYTE_BINARY: - if (cm.hasAlpha()) { - // awt.227=This image type can't have alpha - throw new IllegalArgumentException(Messages.getString("awt.227")); //$NON-NLS-1$ - } - int pixel_bits = 0; - int mapSize = cm.getMapSize(); - if (mapSize <= 2) { - pixel_bits = 1; - } else if (mapSize <= 4) { - pixel_bits = 2; - } else if (mapSize <= 16) { - pixel_bits = 4; - } else { - // awt.221=The imageType is TYPE_BYTE_BINARY and the color map has more than 16 entries - throw new IllegalArgumentException(Messages.getString("awt.221")); //$NON-NLS-1$ - } + case TYPE_BYTE_BINARY: + if (cm.hasAlpha()) { + // awt.227=This image type can't have alpha + throw new IllegalArgumentException(Messages.getString("awt.227")); //$NON-NLS-1$ + } + int pixel_bits = 0; + int mapSize = cm.getMapSize(); + if (mapSize <= 2) { + pixel_bits = 1; + } else if (mapSize <= 4) { + pixel_bits = 2; + } else if (mapSize <= 16) { + pixel_bits = 4; + } else { + // awt.221=The imageType is TYPE_BYTE_BINARY and the color + // map has more than 16 entries + throw new IllegalArgumentException(Messages.getString("awt.221")); //$NON-NLS-1$ + } - raster = Raster.createPackedRaster(DataBuffer.TYPE_BYTE, width, - height, 1, pixel_bits, null); - break; + raster = Raster.createPackedRaster(DataBuffer.TYPE_BYTE, width, height, 1, + pixel_bits, null); + break; - case TYPE_BYTE_INDEXED: - raster = Raster.createInterleavedRaster(DataBuffer.TYPE_BYTE, - width, height, 1, null); - break; + case TYPE_BYTE_INDEXED: + raster = Raster.createInterleavedRaster(DataBuffer.TYPE_BYTE, width, height, 1, + null); + break; - default: - // awt.222=The imageType is not TYPE_BYTE_BINARY or TYPE_BYTE_INDEXED - throw new IllegalArgumentException(Messages.getString("awt.222")); //$NON-NLS-1$ + default: + // awt.222=The imageType is not TYPE_BYTE_BINARY or + // TYPE_BYTE_INDEXED + throw new IllegalArgumentException(Messages.getString("awt.222")); //$NON-NLS-1$ } @@ -296,187 +333,159 @@ Image implements WritableRenderedImage, Transparency{ } /** - * Instantiates a new BufferedImage with the specified width, height - * and predefined image type. + * Instantiates a new BufferedImage with the specified width, height and + * predefined image type. * - * @param width the width of new image. - * @param height the height of new image. - * @param imageType the predefined image type. + * @param width + * the width of new image. + * @param height + * the height of new image. + * @param imageType + * the predefined image type. */ public BufferedImage(int width, int height, int imageType) { switch (imageType) { - case TYPE_INT_RGB: - cm = new DirectColorModel(24, RED_MASK, GREEN_MASK, BLUE_MASK); - raster = cm.createCompatibleWritableRaster(width, height); - break; - - case TYPE_INT_ARGB: - cm = ColorModel.getRGBdefault(); - raster = cm.createCompatibleWritableRaster(width, height); - break; - - case TYPE_INT_ARGB_PRE: - cm = new DirectColorModel( - ColorSpace.getInstance(ColorSpace.CS_sRGB), - 32, - RED_MASK, - GREEN_MASK, - BLUE_MASK, - ALPHA_MASK, - true, - DataBuffer.TYPE_INT); - - raster = cm.createCompatibleWritableRaster(width, height); - break; - - case TYPE_INT_BGR: - cm = new DirectColorModel(24, - RED_BGR_MASK, - GREEN_BGR_MASK, - BLUE_BGR_MASK); - - raster = cm.createCompatibleWritableRaster(width, height); - break; - - case TYPE_3BYTE_BGR: { - int bits[] = { 8, 8, 8 }; - int bandOffsets[] = { 2, 1, 0 }; - cm = new ComponentColorModel( - ColorSpace.getInstance(ColorSpace.CS_sRGB), - bits, - false, - false, - Transparency.OPAQUE, - DataBuffer.TYPE_BYTE); - - raster = Raster.createInterleavedRaster(DataBuffer.TYPE_BYTE, - width, height, width * 3, 3, bandOffsets, null); + case TYPE_INT_RGB: + cm = new DirectColorModel(24, RED_MASK, GREEN_MASK, BLUE_MASK); + raster = cm.createCompatibleWritableRaster(width, height); + break; + + case TYPE_INT_ARGB: + cm = ColorModel.getRGBdefault(); + raster = cm.createCompatibleWritableRaster(width, height); + break; + + case TYPE_INT_ARGB_PRE: + cm = new DirectColorModel(ColorSpace.getInstance(ColorSpace.CS_sRGB), 32, RED_MASK, + GREEN_MASK, BLUE_MASK, ALPHA_MASK, true, DataBuffer.TYPE_INT); + + raster = cm.createCompatibleWritableRaster(width, height); + break; + + case TYPE_INT_BGR: + cm = new DirectColorModel(24, RED_BGR_MASK, GREEN_BGR_MASK, BLUE_BGR_MASK); + + raster = cm.createCompatibleWritableRaster(width, height); + break; + + case TYPE_3BYTE_BGR: { + int bits[] = { + 8, 8, 8 + }; + int bandOffsets[] = { + 2, 1, 0 + }; + cm = new ComponentColorModel(ColorSpace.getInstance(ColorSpace.CS_sRGB), bits, + false, false, Transparency.OPAQUE, DataBuffer.TYPE_BYTE); + + raster = Raster.createInterleavedRaster(DataBuffer.TYPE_BYTE, width, height, + width * 3, 3, bandOffsets, null); } - break; - - case TYPE_4BYTE_ABGR: { - int bits[] = { 8, 8, 8, 8 }; - int bandOffsets[] = { 3, 2, 1, 0 }; - cm = new ComponentColorModel( - ColorSpace.getInstance(ColorSpace.CS_sRGB), - bits, - true, - false, - Transparency.TRANSLUCENT, - DataBuffer.TYPE_BYTE); - - raster = Raster.createInterleavedRaster(DataBuffer.TYPE_BYTE, - width, height, width * 4, 4, bandOffsets, null); + break; + + case TYPE_4BYTE_ABGR: { + int bits[] = { + 8, 8, 8, 8 + }; + int bandOffsets[] = { + 3, 2, 1, 0 + }; + cm = new ComponentColorModel(ColorSpace.getInstance(ColorSpace.CS_sRGB), bits, + true, false, Transparency.TRANSLUCENT, DataBuffer.TYPE_BYTE); + + raster = Raster.createInterleavedRaster(DataBuffer.TYPE_BYTE, width, height, + width * 4, 4, bandOffsets, null); } - break; - - case TYPE_4BYTE_ABGR_PRE: { - int bits[] = { 8, 8, 8, 8 }; - int bandOffsets[] = { 3, 2, 1, 0 }; - cm = new ComponentColorModel( - ColorSpace.getInstance(ColorSpace.CS_sRGB), - bits, - true, - true, - Transparency.TRANSLUCENT, DataBuffer.TYPE_BYTE); - - raster = Raster.createInterleavedRaster(DataBuffer.TYPE_BYTE, - width, height, width * 4, 4, bandOffsets, null); + break; + + case TYPE_4BYTE_ABGR_PRE: { + int bits[] = { + 8, 8, 8, 8 + }; + int bandOffsets[] = { + 3, 2, 1, 0 + }; + cm = new ComponentColorModel(ColorSpace.getInstance(ColorSpace.CS_sRGB), bits, + true, true, Transparency.TRANSLUCENT, DataBuffer.TYPE_BYTE); + + raster = Raster.createInterleavedRaster(DataBuffer.TYPE_BYTE, width, height, + width * 4, 4, bandOffsets, null); } - break; - - case TYPE_USHORT_565_RGB: - cm = new DirectColorModel( - ColorSpace.getInstance(ColorSpace.CS_sRGB), - 16, - RED_565_MASK, - GREEN_565_MASK, - BLUE_565_MASK, - 0, - false, - DataBuffer.TYPE_USHORT); - - raster = cm.createCompatibleWritableRaster(width, height); - break; - - case TYPE_USHORT_555_RGB: - cm = new DirectColorModel( - ColorSpace.getInstance(ColorSpace.CS_sRGB), - 15, - RED_555_MASK, - GREEN_555_MASK, - BLUE_555_MASK, - 0, - false, - DataBuffer.TYPE_USHORT); - - raster = cm.createCompatibleWritableRaster(width, height); - break; - - case TYPE_BYTE_GRAY: { - int bits[] = { 8 }; - cm = new ComponentColorModel( - ColorSpace.getInstance(ColorSpace.CS_GRAY), - bits, - false, - false, - Transparency.OPAQUE, - DataBuffer.TYPE_BYTE); - - raster = cm.createCompatibleWritableRaster(width, height); + break; + + case TYPE_USHORT_565_RGB: + cm = new DirectColorModel(ColorSpace.getInstance(ColorSpace.CS_sRGB), 16, + RED_565_MASK, GREEN_565_MASK, BLUE_565_MASK, 0, false, + DataBuffer.TYPE_USHORT); + + raster = cm.createCompatibleWritableRaster(width, height); + break; + + case TYPE_USHORT_555_RGB: + cm = new DirectColorModel(ColorSpace.getInstance(ColorSpace.CS_sRGB), 15, + RED_555_MASK, GREEN_555_MASK, BLUE_555_MASK, 0, false, + DataBuffer.TYPE_USHORT); + + raster = cm.createCompatibleWritableRaster(width, height); + break; + + case TYPE_BYTE_GRAY: { + int bits[] = { + 8 + }; + cm = new ComponentColorModel(ColorSpace.getInstance(ColorSpace.CS_GRAY), bits, + false, false, Transparency.OPAQUE, DataBuffer.TYPE_BYTE); + + raster = cm.createCompatibleWritableRaster(width, height); } - break; - - case TYPE_USHORT_GRAY: { - int bits[] = { 16 }; - cm = new ComponentColorModel( - ColorSpace.getInstance(ColorSpace.CS_GRAY), - bits, - false, - false, - Transparency.OPAQUE, - DataBuffer.TYPE_USHORT); - raster = cm.createCompatibleWritableRaster(width, height); + break; + + case TYPE_USHORT_GRAY: { + int bits[] = { + 16 + }; + cm = new ComponentColorModel(ColorSpace.getInstance(ColorSpace.CS_GRAY), bits, + false, false, Transparency.OPAQUE, DataBuffer.TYPE_USHORT); + raster = cm.createCompatibleWritableRaster(width, height); } - break; + break; - case TYPE_BYTE_BINARY: { - int colorMap[] = { 0, 0xffffff }; - cm = new IndexColorModel(1, 2, colorMap, 0, false, -1, - DataBuffer.TYPE_BYTE); + case TYPE_BYTE_BINARY: { + int colorMap[] = { + 0, 0xffffff + }; + cm = new IndexColorModel(1, 2, colorMap, 0, false, -1, DataBuffer.TYPE_BYTE); - raster = Raster.createPackedRaster(DataBuffer.TYPE_BYTE, width, - height, 1, 1, null); + raster = Raster.createPackedRaster(DataBuffer.TYPE_BYTE, width, height, 1, 1, null); } - break; - - case TYPE_BYTE_INDEXED: { - int colorMap[] = new int[256]; - int i = 0; - for (int r = 0; r < 256; r += 51) { - for (int g = 0; g < 256; g += 51) { - for (int b = 0; b < 256; b += 51) { - colorMap[i] = (r << 16) | (g << 8) | b; - i++; + break; + + case TYPE_BYTE_INDEXED: { + int colorMap[] = new int[256]; + int i = 0; + for (int r = 0; r < 256; r += 51) { + for (int g = 0; g < 256; g += 51) { + for (int b = 0; b < 256; b += 51) { + colorMap[i] = (r << 16) | (g << 8) | b; + i++; + } } } - } - int gray = 0x12; - for (; i < 256; i++, gray += 6) { - colorMap[i] = (gray << 16) | (gray << 8) | gray; - } - cm = new IndexColorModel(8, 256, colorMap, 0, false, -1, - DataBuffer.TYPE_BYTE); - raster = Raster.createInterleavedRaster(DataBuffer.TYPE_BYTE, - width, height, 1, null); + int gray = 0x12; + for (; i < 256; i++, gray += 6) { + colorMap[i] = (gray << 16) | (gray << 8) | gray; + } + cm = new IndexColorModel(8, 256, colorMap, 0, false, -1, DataBuffer.TYPE_BYTE); + raster = Raster.createInterleavedRaster(DataBuffer.TYPE_BYTE, width, height, 1, + null); } - break; - default: - // awt.224=Unknown image type - throw new IllegalArgumentException(Messages.getString("awt.224")); //$NON-NLS-1$ + break; + default: + // awt.224=Unknown image type + throw new IllegalArgumentException(Messages.getString("awt.224")); //$NON-NLS-1$ } this.imageType = imageType; imageSurf = createImageSurface(imageType); @@ -488,7 +497,7 @@ Image implements WritableRenderedImage, Transparency{ } public Object getProperty(String name) { - if(name == null) { + if (name == null) { // awt.225=Property name is null throw new NullPointerException(Messages.getString("awt.225")); //$NON-NLS-1$ } @@ -504,9 +513,8 @@ Image implements WritableRenderedImage, Transparency{ public WritableRaster copyData(WritableRaster outRaster) { if (outRaster == null) { - outRaster = Raster.createWritableRaster(raster.getSampleModel(), - new Point(raster.getSampleModelTranslateX(), - raster.getSampleModelTranslateY())); + outRaster = Raster.createWritableRaster(raster.getSampleModel(), new Point(raster + .getSampleModelTranslateX(), raster.getSampleModelTranslateY())); } int w = outRaster.getWidth(); @@ -530,8 +538,7 @@ Image implements WritableRenderedImage, Transparency{ SampleModel sm = raster.getSampleModel(); SampleModel nsm = sm.createCompatibleSampleModel(w, h); - WritableRaster outr = Raster.createWritableRaster(nsm, - rect.getLocation()); + WritableRaster outr = Raster.createWritableRaster(nsm, rect.getLocation()); Object data = null; data = raster.getDataElements(minX, minY, w, h, data); @@ -550,7 +557,7 @@ Image implements WritableRenderedImage, Transparency{ Vector v = new Vector(); for (Enumeration e = properties.keys(); e.hasMoreElements();) { try { - v.add((String) e.nextElement()); + v.add((String)e.nextElement()); } catch (ClassCastException ex) { } } @@ -573,7 +580,7 @@ Image implements WritableRenderedImage, Transparency{ @Override public String toString() { return "BufferedImage@" + Integer.toHexString(hashCode()) + //$NON-NLS-1$ - ": type = " + imageType + " " + cm + " " + raster; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + ": type = " + imageType + " " + cm + " " + raster; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ } public WritableRaster getWritableTile(int tileX, int tileY) { @@ -590,13 +597,12 @@ Image implements WritableRenderedImage, Transparency{ } /** - * Gets a WritableRaster object which contains the alpha channel of - * BufferedImage object with ColorModel objects that supports - * a separate alpha channel such as ComponentColorModel - * or DirectColorModel. + * Gets a WritableRaster object which contains the alpha channel of + * BufferedImage object with ColorModel objects that supports a separate + * alpha channel such as ComponentColorModel or DirectColorModel. * - * @return the WritableRaster object which contains the alpha - * channel of this BufferedImage. + * @return the WritableRaster object which contains the alpha channel of + * this BufferedImage. */ public WritableRaster getAlphaRaster() { return cm.getAlphaRaster(raster); @@ -643,10 +649,8 @@ Image implements WritableRenderedImage, Transparency{ int minX = raster.getMinX(); int minY = raster.getMinY(); - WritableRaster outr = Raster.createWritableRaster( - raster.getSampleModel(), - new Point(raster.getSampleModelTranslateX(), - raster.getSampleModelTranslateY())); + WritableRaster outr = Raster.createWritableRaster(raster.getSampleModel(), new Point(raster + .getSampleModelTranslateX(), raster.getSampleModelTranslateY())); Object data = null; @@ -678,11 +682,14 @@ Image implements WritableRenderedImage, Transparency{ /** * Gets the rectangular area of this BufferedImage as a subimage. * - * @param x the x coordinate. - * @param y the y coordinate. - * @param w the width of the subimage. - * @param h the height of the subimage. - * + * @param x + * the x coordinate. + * @param y + * the y coordinate. + * @param w + * the width of the subimage. + * @param h + * the height of the subimage. * @return the BufferedImage. */ public BufferedImage getSubimage(int x, int y, int w, int h) { @@ -697,18 +704,17 @@ Image implements WritableRenderedImage, Transparency{ } /** - * Creates the Graphics2D object which allows to draw into - * this BufferedImage. + * Creates the Graphics2D object which allows to draw into this + * BufferedImage. * * @return the graphics2D object. */ public Graphics2D createGraphics() { - GraphicsEnvironment ge = - GraphicsEnvironment.getLocalGraphicsEnvironment(); - //return ge.createGraphics(this); - //???AWT hack, FIXME - //return AndroidGraphics2D.getInstance(); - //throw new RuntimeException("Not implemented!"); + GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); + // return ge.createGraphics(this); + // ???AWT hack, FIXME + // return AndroidGraphics2D.getInstance(); + // throw new RuntimeException("Not implemented!"); return null; } @@ -718,38 +724,44 @@ Image implements WritableRenderedImage, Transparency{ } /** - * Coerces the data to achieve the state which is specified by - * the isAlphaPremultiplied variable. + * Coerces the data to achieve the state which is specified by the + * isAlphaPremultiplied variable. * - * @param isAlphaPremultiplied the is alpha premultiplied state. + * @param isAlphaPremultiplied + * the is alpha pre-multiplied state. */ public void coerceData(boolean isAlphaPremultiplied) { - if (cm.hasAlpha() && - cm.isAlphaPremultiplied() != isAlphaPremultiplied) { + if (cm.hasAlpha() && cm.isAlphaPremultiplied() != isAlphaPremultiplied) { cm = cm.coerceData(raster, isAlphaPremultiplied); } } /** - * Gets an array of colors in the TYPE_INT_ARGB color model and - * default sRGB colorspace of the specified area of this - * BufferedImage. The result array is composed by the following - * algirithm: - *

    - * pixel = rgbArray[offset + (y-startY)*scansize + (x-startX)] - * - * @param startX the start X area coordinate. - * @param startY the start Y area coordinate. - * @param w the width of the area. - * @param h the height of the area. - * @param rgbArray the result array will be stored to this array. - * @param offset the offset of the rgbArray array. - * @param scansize the scanline stride for the rgbArray. + * Gets an array of colors in the TYPE_INT_ARGB color model and default sRGB + * color space of the specified area of this BufferedImage. The result array + * is composed by the following algorithm: + *

    + * pixel = rgbArray[offset + (y-startY)*scansize + (x-startX)] + *

    * + * @param startX + * the start X area coordinate. + * @param startY + * the start Y area coordinate. + * @param w + * the width of the area. + * @param h + * the height of the area. + * @param rgbArray + * the result array will be stored to this array. + * @param offset + * the offset of the rgbArray array. + * @param scansize + * the scanline stride for the rgbArray. * @return an array of colors for the specified area. */ - public int[] getRGB(int startX, int startY, int w, int h, int[] rgbArray, - int offset, int scansize) { + public int[] getRGB(int startX, int startY, int w, int h, int[] rgbArray, int offset, + int scansize) { if (rgbArray == null) { rgbArray = new int[offset + h * scansize]; } @@ -765,38 +777,47 @@ Image implements WritableRenderedImage, Transparency{ } /** - * Sets RGB values from the specified array to the specified - * BufferedImage area. The pixels are in the default RGB color model - * (TYPE_INT_ARGB) and default sRGB color space. + * Sets RGB values from the specified array to the specified BufferedImage + * area. The pixels are in the default RGB color model (TYPE_INT_ARGB) and + * default sRGB color space. * - * @param startX the start X coordinate. - * @param startY the start Y coordinate. - * @param w the width of the BufferedImage area. - * @param h the height of the BufferedImage area. - * @param rgbArray the array of RGB values. - * @param offset the offset of the rgbArray array. - * @param scansize the scanline stride for the rgbArray. - */ - public void setRGB(int startX, int startY, int w, int h, int[] rgbArray, - int offset, int scansize) { + * @param startX + * the start X coordinate. + * @param startY + * the start Y coordinate. + * @param w + * the width of the BufferedImage area. + * @param h + * the height of the BufferedImage area. + * @param rgbArray + * the array of RGB values. + * @param offset + * the offset of the rgbArray array. + * @param scansize + * the scanline stride for the rgbArray. + */ + public void setRGB(int startX, int startY, int w, int h, int[] rgbArray, int offset, + int scansize) { int off = offset; for (int y = startY; y < startY + h; y++, off += scansize) { int i = off; for (int x = startX; x < startX + w; x++, i++) { - raster.setDataElements(x, y, - cm.getDataElements(rgbArray[i], null)); + raster.setDataElements(x, y, cm.getDataElements(rgbArray[i], null)); } } } /** - * Sets a the specified RGB value to the specified pixel of - * this BufferedImage. The pixel should be in the default - * RGB color model (TYPE_INT_ARGB) and default sRGB color space. - * - * @param x the X coordinate of the pixel. - * @param y the Y coordinate of the pixel. - * @param rgb the RGB value to be set. + * Sets a the specified RGB value to the specified pixel of this + * BufferedImage. The pixel should be in the default RGB color model + * (TYPE_INT_ARGB) and default sRGB color space. + * + * @param x + * the X coordinate of the pixel. + * @param y + * the Y coordinate of the pixel. + * @param rgb + * the RGB value to be set. */ public synchronized void setRGB(int x, int y, int rgb) { raster.setDataElements(x, y, cm.getDataElements(rgb, null)); @@ -814,25 +835,26 @@ Image implements WritableRenderedImage, Transparency{ } /** - * Gets a color in the TYPE_INT_ARGB color model and default - * sRGB colorspace of the specified pixel. - * - * @param x the X coordinate of the pixel. - * @param y the Y coordinate of the pixel. + * Gets a color in the TYPE_INT_ARGB color model and default sRGB color + * space of the specified pixel. * - * @return the color of the specified pixel in the TYPE_INT_ARGB - * color model and default sRGB colorspace. + * @param x + * the X coordinate of the pixel. + * @param y + * the Y coordinate of the pixel. + * @return the color of the specified pixel in the TYPE_INT_ARGB color model + * and default sRGB color space. */ public int getRGB(int x, int y) { return cm.getRGB(raster.getDataElements(x, y, null)); } /** - * Returnes true if alpha is premultiplied, - * false if alpha is not premultiplied or there is no alpha. + * Returns true if alpha is pre-multiplied, false if alpha is not + * pre-multiplied or there is no alpha. * - * @return true if alpha is premultiplied, - * false if alpha is not premultiplied or there is no alpha. + * @return true if alpha is pre-multiplied, false if alpha is not + * pre-multiplied or there is no alpha. */ public boolean isAlphaPremultiplied() { return cm.isAlphaPremultiplied(); @@ -907,9 +929,9 @@ Image implements WritableRenderedImage, Transparency{ /** * Creates the image surface. * - * @param type the type - * - * @return the image surface + * @param type + * the type. + * @return the image surface. */ private ImageSurface createImageSurface(int type) { return new ImageSurface(getColorModel(), getRaster(), type); @@ -918,7 +940,7 @@ Image implements WritableRenderedImage, Transparency{ /** * Gets the image surface. * - * @return the image surface + * @return the image surface. */ ImageSurface getImageSurface() { return imageSurf; @@ -928,4 +950,3 @@ Image implements WritableRenderedImage, Transparency{ return cm.getTransparency(); } } - diff --git a/awt/java/awt/image/BufferedImageFilter.java b/awt/java/awt/image/BufferedImageFilter.java index 44b3c2ed2ab69..8b6fcf0465054 100644 --- a/awt/java/awt/image/BufferedImageFilter.java +++ b/awt/java/awt/image/BufferedImageFilter.java @@ -27,49 +27,72 @@ import org.apache.harmony.awt.gl.AwtImageBackdoorAccessor; import org.apache.harmony.awt.internal.nls.Messages; /** - * The BufferedImageFilter class provides filtering operations to - * the BufferedImage objects using operators which implement - * BufferedImageOp interface. + * The BufferedImageFilter class provides filtering operations to the + * BufferedImage objects using operators which implement BufferedImageOp + * interface. + * + * @since Android 1.0 */ public class BufferedImageFilter extends ImageFilter implements Cloneable { - - /** The Constant accessor. */ + + /** + * The Constant accessor. + */ private static final AwtImageBackdoorAccessor accessor = AwtImageBackdoorAccessor.getInstance(); - /** The op. */ + /** + * The op. + */ private BufferedImageOp op; - /** The raster. */ + /** + * The raster. + */ private WritableRaster raster; - /** The i data. */ + /** + * The i data. + */ private int iData[]; - - /** The b data. */ + + /** + * The b data. + */ private byte bData[]; - /** The width. */ + /** + * The width. + */ private int width; - - /** The height. */ + + /** + * The height. + */ private int height; - /** The cm. */ + /** + * The cm. + */ private ColorModel cm; - /** The forced rgb. */ + /** + * The forced rgb. + */ private boolean forcedRGB = false; - - /** The transfer type. */ + + /** + * The transfer type. + */ private int transferType = DataBuffer.TYPE_UNDEFINED; /** - * Instantiates a new BufferedImageFilter with the specified - * BufferedImageOp operator. + * Instantiates a new BufferedImageFilter with the specified BufferedImageOp + * operator. * - * @param op the specified BufferedImageOp operator. - * - * @throws NullPointerException if BufferedImageOp is null. + * @param op + * the specified BufferedImageOp operator. + * @throws NullPointerException + * if BufferedImageOp is null. */ public BufferedImageFilter(BufferedImageOp op) { if (op == null) { @@ -79,11 +102,11 @@ public class BufferedImageFilter extends ImageFilter implements Cloneable { } /** - * Gets the BufferedImageOp operator associated with this + * Gets the BufferedImageOp operator associated with this * BufferedImageFilter object. * - * @return the BufferedImageOp associated with this - * BufferedImageFilter object. + * @return the BufferedImageOp associated with this BufferedImageFilter + * object. */ public BufferedImageOp getBufferedImageOp() { return op; @@ -110,22 +133,14 @@ public class BufferedImageFilter extends ImageFilter implements Cloneable { } @Override - public void setPixels( - int x, int y, int - w, int h, - ColorModel model, byte[] pixels, - int off, int scansize - ) { + public void setPixels(int x, int y, int w, int h, ColorModel model, byte[] pixels, int off, + int scansize) { setPixels(x, y, w, h, model, pixels, off, scansize, true); } @Override - public void setPixels( - int x, int y, - int w, int h, - ColorModel model, int[] pixels, - int off, int scansize - ) { + public void setPixels(int x, int y, int w, int h, ColorModel model, int[] pixels, int off, + int scansize) { setPixels(x, y, w, h, model, pixels, off, scansize, false); } @@ -163,22 +178,27 @@ public class BufferedImageFilter extends ImageFilter implements Cloneable { /** * Sets the pixels. * - * @param x the x - * @param y the y - * @param w the w - * @param h the h - * @param model the model - * @param pixels the pixels - * @param off the off - * @param scansize the scansize - * @param isByteData the is byte data + * @param x + * the x. + * @param y + * the y. + * @param w + * the w. + * @param h + * the h. + * @param model + * the model. + * @param pixels + * the pixels. + * @param off + * the off. + * @param scansize + * the scansize. + * @param isByteData + * the is byte data. */ - private void setPixels( - int x, int y, - int w, int h, - ColorModel model, Object pixels, - int off, int scansize, boolean isByteData - ) { + private void setPixels(int x, int y, int w, int h, ColorModel model, Object pixels, int off, + int scansize, boolean isByteData) { // Check bounds // Need to copy only the pixels that will fit into the destination area if (x < 0) { @@ -216,23 +236,24 @@ public class BufferedImageFilter extends ImageFilter implements Cloneable { boolean canArraycopy; // Process pixels - switch(transferType) { + switch (transferType) { case DataBuffer.TYPE_UNDEFINED: { if (isByteData) { transferType = DataBuffer.TYPE_BYTE; createRaster(transferType); - //bData = new byte[width*height]; + // bData = new byte[width*height]; canArraycopy = !forcedRGB; break; } transferType = DataBuffer.TYPE_INT; createRaster(transferType); - //iData = new int[width*height]; + // iData = new int[width*height]; canArraycopy = !forcedRGB || model.equals(ColorModel.getRGBdefault()); break; } // And proceed to copy the pixels case DataBuffer.TYPE_INT: { - if (isByteData) { // There are int data already but the new data are bytes + if (isByteData) { // There are int data already but the new data + // are bytes forceRGB(); canArraycopy = false; break; @@ -250,7 +271,8 @@ public class BufferedImageFilter extends ImageFilter implements Cloneable { // RGB conversion canArraycopy = false; break; - } default: { + } + default: { throw new IllegalStateException(Messages.getString("awt.06")); //$NON-NLS-1$ } } @@ -260,7 +282,7 @@ public class BufferedImageFilter extends ImageFilter implements Cloneable { int dstOffset = x + y * width; if (canArraycopy) { - Object dstArray = isByteData ? (Object) bData : (Object) iData; + Object dstArray = isByteData ? (Object)bData : (Object)iData; for (; off < maxOffset; off += scansize, dstOffset += width) { System.arraycopy(pixels, off, dstArray, dstOffset, w); } @@ -271,11 +293,8 @@ public class BufferedImageFilter extends ImageFilter implements Cloneable { int dstPos = dstOffset; int maxDstPos = dstOffset + w; for (; dstPos < maxDstPos; dstPos++, srcPos++) { - iData[dstPos] = model.getRGB( - isByteData ? - ((byte[])pixels)[srcPos] : - ((int[])pixels)[srcPos] - ); + iData[dstPos] = model.getRGB(isByteData ? ((byte[])pixels)[srcPos] + : ((int[])pixels)[srcPos]); } } } @@ -287,22 +306,24 @@ public class BufferedImageFilter extends ImageFilter implements Cloneable { private void forceRGB() { if (!forcedRGB) { forcedRGB = true; - int size = width*height; + int size = width * height; int rgbData[] = new int[size]; if (bData != null) { - for (int i=0; i profiles = new ArrayList(10); - ArrayList sequence = new ArrayList(10); + ArrayList sequence = new ArrayList(10); // We need this profile anyway ICC_Profile xyzProfile = ICC_Profile.getInstance(ColorSpace.CS_CIEXYZ); @@ -149,41 +168,42 @@ public class ColorConvertOp implements BufferedImageOp, RasterOp { int conversionLength = conversionSequence.length; if (conversionLength > 0) { conversionFirst = conversionSequence[0]; - conversionLast = conversionSequence[conversionLength-1]; + conversionLast = conversionSequence[conversionLength - 1]; } boolean iccSequenceStarted = false; - + if (src != conversionFirst && src != null) { if (src instanceof ICC_Profile) { profiles.add(src); iccSequenceStarted = true; } else { profiles.add(xyzProfile); - sequence.add(src); // Add non-ICC color space to the sequence - } + sequence.add(src); // Add non-ICC color space to the + // sequence + } } else { profiles.add(xyzProfile); } - - for (int i=0; i 1) { @@ -192,109 +212,111 @@ public class ColorConvertOp implements BufferedImageOp, RasterOp { // Add non-ICC color space to the sequence sequence.add(conversionSequence[i]); } - + profiles.clear(); profiles.add(xyzProfile); - iccSequenceStarted = false; // Sequence of ICC profiles is processed + iccSequenceStarted = false; // Sequence of ICC profiles is + // processed } else { // Add non-ICC color space to the sequence - sequence.add(conversionSequence[i]); - } + sequence.add(conversionSequence[i]); + } } - - if (dst != conversionLast && dst != null) { // Add last profile if needed + + if (dst != conversionLast && dst != null) { // Add last profile if + // needed if (dst instanceof ICC_Profile) { profiles.add(dst); iccSequenceStarted = true; } else if (iccSequenceStarted) { profiles.add(xyzProfile); } else { - sequence.add(dst); // Add last non-ICC color space to the sequence + sequence.add(dst); // Add last non-ICC color space to the + // sequence } } - + if (iccSequenceStarted) { // Make last transform if needed sequence.add(new ICC_Transform(profiles.toArray(new ICC_Profile[0]))); if (dst != null && !(dst instanceof ICC_Profile)) { sequence.add(dst); // Add last non-ICC color space to the - // sequence + // sequence } } // Calculate max number of components // This number will be used for memory allocation maxComponents = 0; - Object o; - for (int i=0, size = sequence.size(); i t.getNumInputChannels() + 1) ? - maxComponents : - t.getNumInputChannels() + 1; - maxComponents = - (maxComponents > t.getNumOutputChannels() + 1) ? - maxComponents : - t.getNumOutputChannels() + 1; + ICC_Transform t = (ICC_Transform)o; + maxComponents = (maxComponents > t.getNumInputChannels() + 1) ? maxComponents + : t.getNumInputChannels() + 1; + maxComponents = (maxComponents > t.getNumOutputChannels() + 1) ? maxComponents + : t.getNumOutputChannels() + 1; } else { - ColorSpace cs = (ColorSpace) o; - maxComponents = - (maxComponents > cs.getNumComponents() + 1) ? - maxComponents : - cs.getNumComponents() + 1; - } + ColorSpace cs = (ColorSpace)o; + maxComponents = (maxComponents > cs.getNumComponents() + 1) ? maxComponents + : cs.getNumComponents() + 1; + } } - + return sequence.toArray(); } } - + /** - * Instantiates a new ColorConvertOp object using two specified - * ColorSpace objects. + * Instantiates a new ColorConvertOp object using two specified ColorSpace + * objects. * - * @param srcCS the source ColorSpace. - * @param dstCS the destination ColorSpace. - * @param hints the RenderingHints object used for - * the color conversion, or null. + * @param srcCS + * the source ColorSpace. + * @param dstCS + * the destination ColorSpace. + * @param hints + * the RenderingHints object used for the color conversion, or + * null. */ public ColorConvertOp(ColorSpace srcCS, ColorSpace dstCS, RenderingHints hints) { if (srcCS == null || dstCS == null) { throw new NullPointerException(Messages.getString("awt.25B")); //$NON-NLS-1$ } - + renderingHints = hints; - + boolean srcICC = srcCS instanceof ICC_ColorSpace; boolean dstICC = dstCS instanceof ICC_ColorSpace; - + if (srcICC && dstICC) { conversionSequence = new ICC_Profile[2]; } else { conversionSequence = new Object[2]; isICC = false; } - + if (srcICC) { - conversionSequence[0] = ((ICC_ColorSpace) srcCS).getProfile(); + conversionSequence[0] = ((ICC_ColorSpace)srcCS).getProfile(); } else { conversionSequence[0] = srcCS; } - + if (dstICC) { - conversionSequence[1] = ((ICC_ColorSpace) dstCS).getProfile(); + conversionSequence[1] = ((ICC_ColorSpace)dstCS).getProfile(); } else { conversionSequence[1] = dstCS; } } /** - * Instantiates a new ColorConvertOp object from the specified - * ICC_Profile objects. + * Instantiates a new ColorConvertOp object from the specified ICC_Profile + * objects. * - * @param profiles the array of ICC_Profile objects. - * @param hints the RenderingHints object used for - * the color conversion, or null. + * @param profiles + * the array of ICC_Profile objects. + * @param hints + * the RenderingHints object used for the color conversion, or + * null. */ public ColorConvertOp(ICC_Profile profiles[], RenderingHints hints) { if (profiles == null) { @@ -302,37 +324,39 @@ public class ColorConvertOp implements BufferedImageOp, RasterOp { } renderingHints = hints; - + // This array is not used in the program logic, so don't need to copy it // Store it only to return back - midProfiles = profiles; - + midProfiles = profiles; + conversionSequence = new ICC_Profile[midProfiles.length]; - + // Add profiles to the conversion sequence - for (int i=0, length=midProfiles.length; i Transparency.TRANSLUCENT) { + if (transparency < Transparency.OPAQUE || transparency > Transparency.TRANSLUCENT) { // awt.270=The transparency is not a valid value throw new IllegalArgumentException(Messages.getString("awt.270")); //$NON-NLS-1$ } @@ -148,11 +181,12 @@ public abstract class ColorModel implements Transparency { } /** - * Instantiates a new color model with the specified pixel bit depth. - * The transferType is chosen based on the pixel bits, and the other - * data fields are given default values. + * Instantiates a new color model with the specified pixel bit depth. The + * transferType is chosen based on the pixel bits, and the other data fields + * are given default values. * - * @param bits the array of component masks + * @param bits + * the array of component masks. */ public ColorModel(int bits) { @@ -178,14 +212,17 @@ public abstract class ColorModel implements Transparency { * Gets the data elements from the specified component array, transforming * them according to rules of the color model. * - * @param components the components - * @param offset the offset in the normComponents array - * @param obj the array that the result is written to: an array of values - * whose length must be the number of components used by the color model and - * whose type depends on the transfer type (based on the pixel bit depth), - * or null to have the appropriate array created - * - * @return the array of data elements + * @param components + * the components. + * @param offset + * the offset in the normComponents array. + * @param obj + * the array that the result is written to: an array of values + * whose length must be the number of components used by the + * color model and whose type depends on the transfer type (based + * on the pixel bit depth), or null to have the appropriate array + * created. + * @return the array of data elements. */ public Object getDataElements(int[] components, int offset, Object obj) { throw new UnsupportedOperationException("This method is not " + //$NON-NLS-1$ @@ -195,33 +232,36 @@ public abstract class ColorModel implements Transparency { /** * Gets the data elements from the specified array of normalized components. * - * @param normComponents the array normalized components - * @param normOffset the offset in the normComponents array - * @param obj the array that the result is written to: an array of values - * whose length must be the number of components used by the color model and - * whose type depends on the transfer type (based on the pixel bit depth), - * or null to have the appropriate array created - * - * @return the array of data elements - */ - public Object getDataElements(float[] normComponents, int normOffset, - Object obj) { - int unnormComponents[] = getUnnormalizedComponents(normComponents, - normOffset, null, 0); + * @param normComponents + * the array normalized components. + * @param normOffset + * the offset in the normComponents array. + * @param obj + * the array that the result is written to: an array of values + * whose length must be the number of components used by the + * color model and whose type depends on the transfer type (based + * on the pixel bit depth), or null to have the appropriate array + * created. + * @return the array of data elements. + */ + public Object getDataElements(float[] normComponents, int normOffset, Object obj) { + int unnormComponents[] = getUnnormalizedComponents(normComponents, normOffset, null, 0); return getDataElements(unnormComponents, 0, obj); } /** - * Gets the data elements corresponding to the pixel determined by the - * RGB data. - * - * @param rgb the rgb int that defines the pixel - * @param pixel the array that the result is written to: an array of values - * whose length must be the number of components used by the color model and - * whose type depends on the transfer type (based on the pixel bit depth), - * or null to have the appropriate array created + * Gets the data elements corresponding to the pixel determined by the RGB + * data. * - * @return the array of data elements + * @param rgb + * the RGB integer value that defines the pixel. + * @param pixel + * the array that the result is written to: an array of values + * whose length must be the number of components used by the + * color model and whose type depends on the transfer type (based + * on the pixel bit depth), or null to have the appropriate array + * created. + * @return the array of data elements. */ public Object getDataElements(int rgb, Object pixel) { throw new UnsupportedOperationException("This method is not " + //$NON-NLS-1$ @@ -229,38 +269,38 @@ public abstract class ColorModel implements Transparency { } /** - * Gets the child raster corresponding to the alpha channel of the - * specified writable raster, or null if alpha is not supported. + * Gets the child raster corresponding to the alpha channel of the specified + * writable raster, or null if alpha is not supported. * - * @param raster the raster - * - * @return the alpha raster + * @param raster + * the raster. + * @return the alpha raster. */ public WritableRaster getAlphaRaster(WritableRaster raster) { return null; } /** - * Creates a new color model by coercing the data in the writable raster - * in accordance with the alpha strategy of this color model. - * - * @param raster the raster - * @param isAlphaPremultiplied whether the alpha is premultiplied in this - * color model + * Creates a new color model by coercing the data in the writable raster in + * accordance with the alpha strategy of this color model. * - * @return the new color model + * @param raster + * the raster. + * @param isAlphaPremultiplied + * whether the alpha is pre-multiplied in this color model + * @return the new color model. */ - public ColorModel coerceData(WritableRaster raster, - boolean isAlphaPremultiplied) { + public ColorModel coerceData(WritableRaster raster, boolean isAlphaPremultiplied) { throw new UnsupportedOperationException("This method is not " + //$NON-NLS-1$ "supported by this ColorModel"); //$NON-NLS-1$ } @Override public String toString() { - // The output format based on 1.5 release behaviour. + // The output format based on 1.5 release behavior. // It could be reveled such way: - // ColorModel cm = new ComponentColorModel(ColorSpace.getInstance(ColorSpace.CS_sRGB, + // ColorModel cm = new + // ComponentColorModel(ColorSpace.getInstance(ColorSpace.CS_sRGB, // false, false, Transparency.OPAQUE, DataBuffer.TYPE_BYTE); // System.out.println(cm.toString()); return "ColorModel: Color Space = " + cs.toString() + "; has alpha = " //$NON-NLS-1$ //$NON-NLS-2$ @@ -274,15 +314,17 @@ public abstract class ColorModel implements Transparency { /** * Gets the components of the pixel determined by the data array. * - * @param pixel the data array that defines the pixel (whose - * primitive type corresponds to the pixel length in bits, + * @param pixel + * the data array that defines the pixel (whose primitive type + * corresponds to the pixel length in bits. * @see ColorModel#getTransferType() - * @param components the the array where the resulting components - * are written (or null to prompt the method to create the return array) - * @param offset the offset that tells where the results should be written - * in the return array - * - * @return the array of components + * @param components + * the the array where the resulting components are written (or + * null to prompt the method to create the return array). + * @param offset + * the offset that tells where the results should be written in + * the return array. + * @return the array of components. */ public int[] getComponents(Object pixel, int[] components, int offset) { throw new UnsupportedOperationException("This method is not " + //$NON-NLS-1$ @@ -292,18 +334,20 @@ public abstract class ColorModel implements Transparency { /** * Gets the normalized components of the pixel determined by the data array. * - * @param pixel the data array that defines the pixel (whose - * primitive type corresponds to the pixel length in bits, + * @param pixel + * the data array that defines the pixel (whose primitive type + * corresponds to the pixel length in bits. * @see ColorModel#getTransferType() - * @param normComponents the array where the resulting normalised components - * are written (or null to prompt the method to create the return array) - * @param normOffset the offset that tells where the results should be written - * in the return array - * - * @return the array of normalized components + * @param normComponents + * the array where the resulting normalized components are + * written (or null to prompt the method to create the return + * array). + * @param normOffset + * the offset that tells where the results should be written in + * the return array. + * @return the array of normalized components. */ - public float[] getNormalizedComponents(Object pixel, - float[] normComponents, int normOffset) { + public float[] getNormalizedComponents(Object pixel, float[] normComponents, int normOffset) { if (pixel == null) { // awt.294=pixel is null @@ -311,8 +355,7 @@ public abstract class ColorModel implements Transparency { } int unnormComponents[] = getComponents(pixel, null, 0); - return getNormalizedComponents(unnormComponents, 0, normComponents, - normOffset); + return getNormalizedComponents(unnormComponents, 0, normComponents, normOffset); } @Override @@ -320,54 +363,52 @@ public abstract class ColorModel implements Transparency { if (!(obj instanceof ColorModel)) { return false; } - ColorModel cm = (ColorModel) obj; + ColorModel cm = (ColorModel)obj; - return (pixel_bits == cm.getPixelSize() && - transferType == cm.getTransferType() && - cs.getType() == cm.getColorSpace().getType() && - hasAlpha == cm.hasAlpha() && - isAlphaPremultiplied == cm.isAlphaPremultiplied() && - transparency == cm.getTransparency() && - numColorComponents == cm.getNumColorComponents() && - numComponents == cm.getNumComponents() && - Arrays.equals(bits, cm.getComponentSize())); + return (pixel_bits == cm.getPixelSize() && transferType == cm.getTransferType() + && cs.getType() == cm.getColorSpace().getType() && hasAlpha == cm.hasAlpha() + && isAlphaPremultiplied == cm.isAlphaPremultiplied() + && transparency == cm.getTransparency() + && numColorComponents == cm.getNumColorComponents() + && numComponents == cm.getNumComponents() && Arrays.equals(bits, cm + .getComponentSize())); } /** * Gets the red component of the pixel determined by the data array. * - * @param inData the data array that defines the pixel (whose - * primitive type corresponds to the pixel length in bits, + * @param inData + * the data array that defines the pixel (whose primitive type + * corresponds to the pixel length in bits. * @see ColorModel#getTransferType() - * - * @return the red + * @return the red. */ public int getRed(Object inData) { return getRed(constructPixel(inData)); } /** - * Gets the RGB int corresponding to the pixel defined by the data array. + * Gets the RGB integer value corresponding to the pixel defined by the data + * array. * - * @param inData the data array that defines the pixel (whose - * primitive type corresponds to the pixel length in bits, + * @param inData + * the data array that defines the pixel (whose primitive type + * corresponds to the pixel length in bits. * @see ColorModel#getTransferType() - * - * @return the int that gives the pixel's colors in RGB format + * @return the integer value that gives the pixel's colors in RGB format. */ public int getRGB(Object inData) { - return (getAlpha(inData) << 24 | getRed(inData) << 16 | - getGreen(inData) << 8 | getBlue(inData)); + return (getAlpha(inData) << 24 | getRed(inData) << 16 | getGreen(inData) << 8 | getBlue(inData)); } /** * Gets the green component of the pixel defined by the data array. * - * @param inData the data array that defines the pixel (whose - * primitive type corresponds to the pixel length in bits, + * @param inData + * the data array that defines the pixel (whose primitive type + * corresponds to the pixel length in bits. * @see ColorModel#getTransferType() - * - * @return the green + * @return the green. */ public int getGreen(Object inData) { return getGreen(constructPixel(inData)); @@ -376,11 +417,11 @@ public abstract class ColorModel implements Transparency { /** * Gets the blue component of the pixel defined by the data array. * - * @param inData the data array that defines the pixel (whose - * primitive type corresponds to the pixel length in bits, + * @param inData + * the data array that defines the pixel (whose primitive type + * corresponds to the pixel length in bits. * @see ColorModel#getTransferType() - * - * @return the blue + * @return the blue. */ public int getBlue(Object inData) { return getBlue(constructPixel(inData)); @@ -389,11 +430,11 @@ public abstract class ColorModel implements Transparency { /** * Gets the alpha component of the pixel defined by the data array. * - * @param inData the data array that defines the pixel (whose - * primitive type corresponds to the pixel length in bits, + * @param inData + * the data array that defines the pixel (whose primitive type + * corresponds to the pixel length in bits. * @see ColorModel#getTransferType() - * - * @return the alpha + * @return the alpha. */ public int getAlpha(Object inData) { return getAlpha(constructPixel(inData)); @@ -402,10 +443,11 @@ public abstract class ColorModel implements Transparency { /** * Creates a compatible writable raster. * - * @param w the width of the desired writable raster - * @param h the height of the desired writable raster - * - * @return the writable raster + * @param w + * the width of the desired writable raster. + * @param h + * the height of the desired writable raster. + * @return the writable raster. */ public WritableRaster createCompatibleWritableRaster(int w, int h) { throw new UnsupportedOperationException("This method is not " + //$NON-NLS-1$ @@ -415,9 +457,9 @@ public abstract class ColorModel implements Transparency { /** * Checks if the sample model is compatible with this color model. * - * @param sm the sample model - * - * @return true, if the sample model is compatible with this color model + * @param sm + * the sample model. + * @return true, if the sample model is compatible with this color model. */ public boolean isCompatibleSampleModel(SampleModel sm) { throw new UnsupportedOperationException("This method is not " + //$NON-NLS-1$ @@ -427,10 +469,11 @@ public abstract class ColorModel implements Transparency { /** * Creates the compatible sample model. * - * @param w the width of the desired sample model - * @param h the height of the desired sample model - * - * @return the sample model + * @param w + * the width of the desired sample model. + * @param h + * the height of the desired sample model. + * @return the sample model. */ public SampleModel createCompatibleSampleModel(int w, int h) { throw new UnsupportedOperationException("This method is not " + //$NON-NLS-1$ @@ -440,9 +483,9 @@ public abstract class ColorModel implements Transparency { /** * Checks if the specified raster is compatible with this color model. * - * @param raster the raster to inspect - * - * @return true, if the raster is compatible with this color model + * @param raster + * the raster to inspect. + * @return true, if the raster is compatible with this color model. */ public boolean isCompatibleRaster(Raster raster) { throw new UnsupportedOperationException("This method is not " + //$NON-NLS-1$ @@ -452,28 +495,32 @@ public abstract class ColorModel implements Transparency { /** * Gets the color space of this color model. * - * @return the color space + * @return the color space. */ public final ColorSpace getColorSpace() { return cs; } /** - * Gets the normalized components corresponding to the specified + * Gets the normalized components corresponding to the specified * unnormalized components. * - * @param components the array of unnormalized components - * @param offset the offset where the components should be read - * from the array of unnormalized components - * @param normComponents the array where the resulting normalised components - * are written (or null to prompt the method to create the return array) - * @param normOffset the offset that tells where the results should be written - * in the return array - * - * @return the normalized components - */ - public float[] getNormalizedComponents(int[] components, int offset, - float normComponents[], int normOffset) { + * @param components + * the array of unnormalized components. + * @param offset + * the offset where the components should be read from the array + * of unnormalized components. + * @param normComponents + * the array where the resulting normalized components are + * written (or null to prompt the method to create the return + * array). + * @param normOffset + * the offset that tells where the results should be written in + * the return array. + * @return the normalized components. + */ + public float[] getNormalizedComponents(int[] components, int offset, float normComponents[], + int normOffset) { if (bits == null) { // awt.26C=bits is null throw new UnsupportedOperationException(Messages.getString("awt.26C")); //$NON-NLS-1$ @@ -484,14 +531,12 @@ public abstract class ColorModel implements Transparency { } if (hasAlpha && isAlphaPremultiplied) { - float normAlpha = - (float) components[offset + numColorComponents] / - maxValues[numColorComponents]; + float normAlpha = (float)components[offset + numColorComponents] + / maxValues[numColorComponents]; if (normAlpha != 0.0f) { for (int i = 0; i < numColorComponents; i++) { - normComponents[normOffset + i] = - components[offset + i] / - (normAlpha * maxValues[i]); + normComponents[normOffset + i] = components[offset + i] + / (normAlpha * maxValues[i]); } normComponents[normOffset + numColorComponents] = normAlpha; } else { @@ -501,9 +546,7 @@ public abstract class ColorModel implements Transparency { } } else { for (int i = 0; i < numComponents; i++) { - normComponents[normOffset + i] = - (float) components[offset + i] / - maxValues[i]; + normComponents[normOffset + i] = (float)components[offset + i] / maxValues[i]; } } @@ -513,11 +556,12 @@ public abstract class ColorModel implements Transparency { /** * Gets the data element corresponding to the unnormalized components. * - * @param components the components - * @param offset the offset to start reading the components from the - * array of components - * - * @return the data element + * @param components + * the components. + * @param offset + * the offset to start reading the components from the array of + * components. + * @return the data element. */ public int getDataElement(int[] components, int offset) { throw new UnsupportedOperationException("This method is not " + //$NON-NLS-1$ @@ -525,21 +569,25 @@ public abstract class ColorModel implements Transparency { } /** - * Gets the unnormalized components corresponding to the specified + * Gets the unnormalized components corresponding to the specified * normalized components. * - * @param normComponents the array of normalized components - * @param normOffset the offset where the components should be read - * from the array of normalized components - * @param components the array where the resulting unnormalised components - * are written (or null to prompt the method to create the return array) - * @param offset the offset that tells where the results should be written - * in the return array - * - * @return the unnormalized components - */ - public int[] getUnnormalizedComponents(float normComponents[], - int normOffset, int components[], int offset) { + * @param normComponents + * the array of normalized components. + * @param normOffset + * the offset where the components should be read from the array + * of normalized components. + * @param components + * the array where the resulting unnormalized components are + * written (or null to prompt the method to create the return + * array). + * @param offset + * the offset that tells where the results should be written in + * the return array. + * @return the unnormalized components. + */ + public int[] getUnnormalizedComponents(float normComponents[], int normOffset, + int components[], int offset) { if (bits == null) { // awt.26C=bits is null @@ -547,7 +595,8 @@ public abstract class ColorModel implements Transparency { } if (normComponents.length - normOffset < numComponents) { - // awt.273=The length of normComponents minus normOffset is less than numComponents + // awt.273=The length of normComponents minus normOffset is less + // than numComponents throw new IllegalArgumentException(Messages.getString("awt.273")); //$NON-NLS-1$ } @@ -555,7 +604,8 @@ public abstract class ColorModel implements Transparency { components = new int[numComponents + offset]; } else { if (components.length - offset < numComponents) { - // awt.272=The length of components minus offset is less than numComponents + // awt.272=The length of components minus offset is less than + // numComponents throw new IllegalArgumentException(Messages.getString("awt.272")); //$NON-NLS-1$ } } @@ -563,17 +613,15 @@ public abstract class ColorModel implements Transparency { if (hasAlpha && isAlphaPremultiplied) { float alpha = normComponents[normOffset + numColorComponents]; for (int i = 0; i < numColorComponents; i++) { - components[offset + i] = (int) (normComponents[normOffset + i] - * maxValues[i] * alpha + 0.5f); + components[offset + i] = (int)(normComponents[normOffset + i] * maxValues[i] + * alpha + 0.5f); } - components[offset + numColorComponents] = - (int) (normComponents[normOffset + numColorComponents] * - maxValues[numColorComponents] + 0.5f); + components[offset + numColorComponents] = (int)(normComponents[normOffset + + numColorComponents] + * maxValues[numColorComponents] + 0.5f); } else { for (int i = 0; i < numComponents; i++) { - components[offset + i] = - (int) (normComponents[normOffset + i] * - maxValues[i] + 0.5f); + components[offset + i] = (int)(normComponents[normOffset + i] * maxValues[i] + 0.5f); } } @@ -583,30 +631,32 @@ public abstract class ColorModel implements Transparency { /** * Gets the data element corresponding to the normalized components. * - * @param normComponents the normalized components - * @param normOffset the offset where the normalized components should - * be read from the normalized component array - * - * @return the data element + * @param normComponents + * the normalized components. + * @param normOffset + * the offset where the normalized components should be read from + * the normalized component array. + * @return the data element. */ public int getDataElement(float normComponents[], int normOffset) { - int unnormComponents[] = getUnnormalizedComponents(normComponents, - normOffset, null, 0); + int unnormComponents[] = getUnnormalizedComponents(normComponents, normOffset, null, 0); return getDataElement(unnormComponents, 0); } /** - * Takes a pixel whose data is defined by an int, and writes the - * corresponding components into the components array, starting - * from the index offset. + * Takes a pixel whose data is defined by an integer, and writes the + * corresponding components into the components array, starting from the + * index offset. * - * @param pixel the pixel data - * @param components the data array to write the components to (or - * null to have the method create the return array) - * @param offset the offset that determines where the results are - * written in the components array - * - * @return the array of components corresponding to the pixel + * @param pixel + * the pixel data. + * @param components + * the data array to write the components to (or null to have the + * method create the return array). + * @param offset + * the offset that determines where the results are written in + * the components array. + * @return the array of components corresponding to the pixel. */ public int[] getComponents(int pixel, int components[], int offset) { throw new UnsupportedOperationException("This method is not " + //$NON-NLS-1$ @@ -616,45 +666,45 @@ public abstract class ColorModel implements Transparency { /** * Gets the red component of the pixel determined by the pixel data. * - * @param pixel the pixel data - * - * @return the red component of the pixel + * @param pixel + * the pixel. + * @return the red component of the given pixel. */ public abstract int getRed(int pixel); /** - * Takes the pixel data and returns the int corresponding - * to the pixel's color in RGB format. - * - * @param pixel the pixel data + * Takes the pixel data and returns the integer value corresponding to the + * pixel's color in RGB format. * - * @return the corresponding RGB int + * @param pixel + * the pixel data. + * @return the corresponding RGB integer value. */ public int getRGB(int pixel) { - return (getAlpha(pixel) << 24 | getRed(pixel) << 16 - | getGreen(pixel) << 8 | getBlue(pixel)); + return (getAlpha(pixel) << 24 | getRed(pixel) << 16 | getGreen(pixel) << 8 | getBlue(pixel)); } /** * Gets the green component of the pixel determined by the pixel data. * - * @param pixel the pixel data - * - * @return the green component of the pixel + * @param pixel + * the pixel. + * @return the green component of the given pixel. */ public abstract int getGreen(int pixel); /** * Gets the size of the desired component of this color model. * - * @param componentIdx the index that determines which component size to get - * - * @return the component size corresponding to the index - * - * @throws NullPointerException if this color model doesn't support - * an array of separate components. - * @throws ArrayIndexOutOfBoundsException if the index is negative or - * greater than or equal to the number of components + * @param componentIdx + * the index that determines which component size to get. + * @return the component size corresponding to the index. + * @throws NullPointerException + * if this color model doesn't support an array of separate + * components. + * @throws ArrayIndexOutOfBoundsException + * if the index is negative or greater than or equal to the + * number of components. */ public int getComponentSize(int componentIdx) { if (bits == null) { @@ -663,7 +713,8 @@ public abstract class ColorModel implements Transparency { } if (componentIdx < 0 || componentIdx >= bits.length) { - // awt.274=componentIdx is greater than the number of components or less than zero + // awt.274=componentIdx is greater than the number of components or + // less than zero throw new ArrayIndexOutOfBoundsException(Messages.getString("awt.274")); //$NON-NLS-1$ } @@ -673,25 +724,25 @@ public abstract class ColorModel implements Transparency { /** * Gets the blue component of the pixel determined by the pixel data. * - * @param pixel the pixel - * - * @return the blue component of the pixel + * @param pixel + * the pixel. + * @return the blue component of the given pixel. */ public abstract int getBlue(int pixel); /** * Gets the alpha component of the pixel determined by the pixel data. * - * @param pixel the pixel - * - * @return the alpha component of the pixel + * @param pixel + * the pixel. + * @return the alpha component of the given pixel. */ public abstract int getAlpha(int pixel); /** * Gets the array of sizes of the different components. * - * @return the array of sizes of the different components + * @return the array of sizes of the different components. */ public int[] getComponentSize() { if (bits != null) { @@ -701,9 +752,9 @@ public abstract class ColorModel implements Transparency { } /** - * Checks if the alpha component is premultiplied. + * Checks if the alpha component is pre-multiplied. * - * @return true, if the alpha component is premultiplied + * @return true, if the alpha component is pre-multiplied. */ public final boolean isAlphaPremultiplied() { return isAlphaPremultiplied; @@ -712,7 +763,7 @@ public abstract class ColorModel implements Transparency { /** * Checks whether this color model supports alpha. * - * @return true, if this color model has alpha + * @return true, if this color model has alpha. */ public final boolean hasAlpha() { return hasAlpha; @@ -776,12 +827,12 @@ public abstract class ColorModel implements Transparency { } /** - * Gets the transfer type, which is the type of Java primitive - * value that corresponds to the bit length per pixel: either - * {@link DataBuffer#TYPE_BYTE}, {@link DataBuffer#TYPE_USHORT}, + * Gets the transfer type, which is the type of Java primitive value that + * corresponds to the bit length per pixel: either + * {@link DataBuffer#TYPE_BYTE}, {@link DataBuffer#TYPE_USHORT}, * {@link DataBuffer#TYPE_INT}, or {@link DataBuffer#TYPE_UNDEFINED}. * - * @return the transfer type + * @return the transfer type. */ public final int getTransferType() { return transferType; @@ -790,7 +841,7 @@ public abstract class ColorModel implements Transparency { /** * Gets the pixel size in bits. * - * @return the pixel size + * @return the pixel size. */ public int getPixelSize() { return pixel_bits; @@ -799,7 +850,7 @@ public abstract class ColorModel implements Transparency { /** * Gets the number of components of this color model. * - * @return the number of components + * @return the number of components. */ public int getNumComponents() { return numComponents; @@ -808,7 +859,7 @@ public abstract class ColorModel implements Transparency { /** * Gets the number of color components of this color model. * - * @return the number color components + * @return the number color components. */ public int getNumColorComponents() { return numColorComponents; @@ -817,12 +868,11 @@ public abstract class ColorModel implements Transparency { /** * Gets the default RGB color model. * - * @return the default RGB color model + * @return the default RGB color model. */ public static ColorModel getRGBdefault() { if (RGBdefault == null) { - RGBdefault = new DirectColorModel(32, 0x00ff0000, 0x0000ff00, - 0x000000ff, 0xff000000); + RGBdefault = new DirectColorModel(32, 0x00ff0000, 0x0000ff00, 0x000000ff, 0xff000000); } return RGBdefault; } @@ -830,66 +880,69 @@ public abstract class ColorModel implements Transparency { /* * Construct INT pixel representation from Object * @param obj - * * @return */ /** * Construct pixel. * - * @param obj the obj - * - * @return the int + * @param obj + * the obj. + * @return the int. */ private int constructPixel(Object obj) { int pixel = 0; switch (getTransferType()) { - case DataBuffer.TYPE_BYTE: - byte[] bPixel = (byte[]) obj; - if(bPixel.length > 1) { - // awt.275=This pixel representation is not suuported by tis Color Model - throw new UnsupportedOperationException(Messages.getString("awt.275")); //$NON-NLS-1$ - } - pixel = bPixel[0] & 0xff; - break; - - case DataBuffer.TYPE_USHORT: - short[] sPixel = (short[]) obj; - if(sPixel.length > 1) { - // awt.275=This pixel representation is not suuported by tis Color Model - throw new UnsupportedOperationException(Messages.getString("awt.275")); //$NON-NLS-1$ - } - pixel = sPixel[0] & 0xffff; - break; - - case DataBuffer.TYPE_INT: - int[] iPixel = (int[]) obj; - if(iPixel.length > 1) { - // awt.275=This pixel representation is not suuported by tis Color Model - throw new UnsupportedOperationException(Messages.getString("awt.275")); //$NON-NLS-1$ - } - pixel = iPixel[0]; - break; + case DataBuffer.TYPE_BYTE: + byte[] bPixel = (byte[])obj; + if (bPixel.length > 1) { + // awt.275=This pixel representation is not suuported by tis + // Color Model + throw new UnsupportedOperationException(Messages.getString("awt.275")); //$NON-NLS-1$ + } + pixel = bPixel[0] & 0xff; + break; + + case DataBuffer.TYPE_USHORT: + short[] sPixel = (short[])obj; + if (sPixel.length > 1) { + // awt.275=This pixel representation is not suuported by tis + // Color Model + throw new UnsupportedOperationException(Messages.getString("awt.275")); //$NON-NLS-1$ + } + pixel = sPixel[0] & 0xffff; + break; + + case DataBuffer.TYPE_INT: + int[] iPixel = (int[])obj; + if (iPixel.length > 1) { + // awt.275=This pixel representation is not suuported by tis + // Color Model + throw new UnsupportedOperationException(Messages.getString("awt.275")); //$NON-NLS-1$ + } + pixel = iPixel[0]; + break; - default: - // awt.22D=This transferType ( {0} ) is not supported by this color model - throw new UnsupportedOperationException(Messages.getString("awt.22D", //$NON-NLS-1$ - transferType)); + default: + // awt.22D=This transferType ( {0} ) is not supported by this + // color model + throw new UnsupportedOperationException(Messages.getString("awt.22D", //$NON-NLS-1$ + transferType)); } return pixel; } /** - * Gets the transfer type, which is the type of Java primitive - * value that corresponds to the bit length per pixel: either - * {@link DataBuffer#TYPE_BYTE}, {@link DataBuffer#TYPE_USHORT}, + * Gets the transfer type, which is the type of Java primitive value that + * corresponds to the bit length per pixel: either + * {@link DataBuffer#TYPE_BYTE}, {@link DataBuffer#TYPE_USHORT}, * {@link DataBuffer#TYPE_INT}, or {@link DataBuffer#TYPE_UNDEFINED}. * - * @param bits the array of component masks - * - * @return the transfer type + * @param bits + * the array of component masks. + * @return the transfer type. */ static int getTransferType(int bits) { if (bits <= 8) { diff --git a/awt/java/awt/image/ComponentColorModel.java b/awt/java/awt/image/ComponentColorModel.java index a152f55a793f8..4328fd37e732a 100644 --- a/awt/java/awt/image/ComponentColorModel.java +++ b/awt/java/awt/image/ComponentColorModel.java @@ -18,6 +18,7 @@ * @author Igor V. Stolyarov * @version $Revision$ */ + package java.awt.image; import java.awt.color.ColorSpace; @@ -26,154 +27,202 @@ import org.apache.harmony.awt.gl.color.LUTColorConverter; import org.apache.harmony.awt.internal.nls.Messages; /** - * The Class ComponentColorModel represents a color model that is defined - * in terms of its components. + * The Class ComponentColorModel represents a color model that is defined in + * terms of its components. + * + * @since Android 1.0 */ public class ComponentColorModel extends ColorModel { - /** The signed. */ - private boolean signed; // Pixel samples are signed. - // Samples with TransferType DataBuffer.TYPE_BYTE, - // DataBuffer.TYPE_USHORT, DataBuffer.TYPE_INT - - // unsigned. Samples with others TransferType - - // signed. + /** + * The signed. + */ + private boolean signed; // Pixel samples are signed. + + // Samples with TransferType DataBuffer.TYPE_BYTE, + // DataBuffer.TYPE_USHORT, DataBuffer.TYPE_INT - + // unsigned. Samples with others TransferType - + // signed. - /** The integral. */ + /** + * The integral. + */ private boolean integral; // Pixel samples are integral. - // Samples with TransferType DataBuffer.TYPE_BYTE, - // DataBuffer.TYPE_USHORT, DataBuffer.Short and - // DataBuffer.TYPE_INT - integral. - /** The scale factors. */ - private float scaleFactors[]; // Array of factors for reduction components - // values into the form scaled from 0 to 255 + // Samples with TransferType DataBuffer.TYPE_BYTE, + // DataBuffer.TYPE_USHORT, DataBuffer.Short and + // DataBuffer.TYPE_INT - integral. - /** The donot support unnormalized. */ + /** + * The scale factors. + */ + private float scaleFactors[]; // Array of factors for reduction components + + // values into the form scaled from 0 to 255 + + /** + * The donot support unnormalized. + */ private boolean donotSupportUnnormalized; // This Color Model don't support - // unnormolized form - /** The need alpha divide. */ + // unnormolized form + + /** + * The need alpha divide. + */ private boolean needAlphaDivide; // hasAlpha && isAlphaPremultiplied - /** The calc value. */ - private boolean calcValue; // Value was culculated + /** + * The calc value. + */ + private boolean calcValue; // Value was culculated - /** The need scale. */ - private boolean needScale; // Normalized value need to scale + /** + * The need scale. + */ + private boolean needScale; // Normalized value need to scale - /** The min vals. */ - private float minVals[]; // Array of Min normalized values + /** + * The min vals. + */ + private float minVals[]; // Array of Min normalized values - /** The ranges. */ - private float ranges[]; // Array of range normalized values + /** + * The ranges. + */ + private float ranges[]; // Array of range normalized values - /** The alpha lut. */ - private byte alphaLUT[]; // Lookup table for scale alpha value + /** + * The alpha lut. + */ + private byte alphaLUT[]; // Lookup table for scale alpha value - /** The color lu ts. */ - private byte colorLUTs[][]; // Lookup tables for scale color values + /** + * The color lu ts. + */ + private byte colorLUTs[][]; // Lookup tables for scale color values - /** The from_ linea r_ rg b_ lut. */ - private byte from_LINEAR_RGB_LUT[]; // Lookup table for conversion from - // Linear RGB Color Space into sRGB + /** + * The from_ linea r_ rg b_ lut. + */ + private byte from_LINEAR_RGB_LUT[]; // Lookup table for conversion from + + // Linear RGB Color Space into sRGB + + /** + * The to_ linea r_8 rg b_ lut. + */ + private byte to_LINEAR_8RGB_LUT[]; // Lookup table for conversion from - /** The to_ linea r_8 rg b_ lut. */ - private byte to_LINEAR_8RGB_LUT[]; // Lookup table for conversion from - // sRGB Color Space into Linear RGB - // 8 bit + // sRGB Color Space into Linear RGB + // 8 bit - /** The to_ linea r_16 rg b_ lut. */ + /** + * The to_ linea r_16 rg b_ lut. + */ private short to_LINEAR_16RGB_LUT[]; // Lookup table for conversion from - // sRGB Color Space into Linear RGB - // 16 bit - /** The LINEA r_ rg b_ length. */ - private int LINEAR_RGB_Length; // Linear RGB bit length + // sRGB Color Space into Linear RGB + // 16 bit + + /** + * The LINEA r_ rg b_ length. + */ + private int LINEAR_RGB_Length; // Linear RGB bit length + + /** + * The factor. + */ + private float fFactor; // Scale factor - /** The factor. */ - private float fFactor; // Scale factor + /** + * The is_s rgb. + */ + private boolean is_sRGB; // ColorModel has sRGB ColorSpace - /** The is_s rgb. */ - private boolean is_sRGB; // ColorModel has sRGB ColorSpace + /** + * The is_ linea r_ rgb. + */ + private boolean is_LINEAR_RGB; // Color Model has Linear RGB Color - /** The is_ linea r_ rgb. */ - private boolean is_LINEAR_RGB; // Color Model has Linear RGB Color - // Space + // Space /** * Instantiates a new component color model. * - * @param colorSpace the color space - * @param bits the array of component masks - * @param hasAlpha whether the color model has alpha - * @param isAlphaPremultiplied whether the alpha is premultiplied - * @param transparency the transparency strategy, @see java.awt.Transparency - * @param transferType the transfer type (primitive java type - * to use for the components) + * @param colorSpace + * the color space. + * @param bits + * the array of component masks. + * @param hasAlpha + * whether the color model has alpha. + * @param isAlphaPremultiplied + * whether the alpha is pre-multiplied. + * @param transparency + * the transparency strategy, @see java.awt.Transparency. + * @param transferType + * the transfer type (primitive java type to use for the + * components). */ - public ComponentColorModel(ColorSpace colorSpace, int bits[], - boolean hasAlpha, boolean isAlphaPremultiplied, int transparency, - int transferType) { - super(createPixelBits(colorSpace, hasAlpha, transferType), - validateBits(bits, colorSpace, hasAlpha, transferType), - colorSpace, hasAlpha, isAlphaPremultiplied, transparency, + public ComponentColorModel(ColorSpace colorSpace, int bits[], boolean hasAlpha, + boolean isAlphaPremultiplied, int transparency, int transferType) { + super(createPixelBits(colorSpace, hasAlpha, transferType), validateBits(bits, colorSpace, + hasAlpha, transferType), colorSpace, hasAlpha, isAlphaPremultiplied, transparency, transferType); needScale = false; switch (transferType) { - case DataBuffer.TYPE_BYTE: - case DataBuffer.TYPE_USHORT: - case DataBuffer.TYPE_INT: - signed = false; - integral = true; - donotSupportUnnormalized = false; - scaleFactors = new float[numComponents]; - for (int i = 0; i < numColorComponents; i++) { - scaleFactors[i] = 1.0f / maxValues[i]; - if (cs.getMinValue(i) != 0.0f || cs.getMaxValue(i) != 1.0f) { - donotSupportUnnormalized = true; + case DataBuffer.TYPE_BYTE: + case DataBuffer.TYPE_USHORT: + case DataBuffer.TYPE_INT: + signed = false; + integral = true; + donotSupportUnnormalized = false; + scaleFactors = new float[numComponents]; + for (int i = 0; i < numColorComponents; i++) { + scaleFactors[i] = 1.0f / maxValues[i]; + if (cs.getMinValue(i) != 0.0f || cs.getMaxValue(i) != 1.0f) { + donotSupportUnnormalized = true; + } } - } - if (hasAlpha) { - maxValues[numColorComponents] = - (1 << bits[numColorComponents]) - 1; - scaleFactors[numColorComponents] = - 1.0f / maxValues[numColorComponents]; - } - break; - case DataBuffer.TYPE_SHORT: - signed = true; - integral = true; - donotSupportUnnormalized = true; - scaleFactors = new float[numComponents]; - for (int i = 0; i < numComponents; i++) { - maxValues[i] = Short.MAX_VALUE; - scaleFactors[i] = 1.0f / maxValues[i]; - if (cs.getMinValue(i) != 0.0f || cs.getMaxValue(i) != 1.0f) { - needScale = true; + if (hasAlpha) { + maxValues[numColorComponents] = (1 << bits[numColorComponents]) - 1; + scaleFactors[numColorComponents] = 1.0f / maxValues[numColorComponents]; } - } - if (needScale) { - minVals = new float[numColorComponents]; - ranges = new float[numColorComponents]; - for (int i = 0; i < numColorComponents; i++) { - minVals[i] = cs.getMinValue(i); - ranges[i] = cs.getMaxValue(i) - minVals[i]; + break; + case DataBuffer.TYPE_SHORT: + signed = true; + integral = true; + donotSupportUnnormalized = true; + scaleFactors = new float[numComponents]; + for (int i = 0; i < numComponents; i++) { + maxValues[i] = Short.MAX_VALUE; + scaleFactors[i] = 1.0f / maxValues[i]; + if (cs.getMinValue(i) != 0.0f || cs.getMaxValue(i) != 1.0f) { + needScale = true; + } } - } - break; - case DataBuffer.TYPE_FLOAT: - case DataBuffer.TYPE_DOUBLE: - signed = true; - integral = false; - donotSupportUnnormalized = true; - break; - default: - // awt.215=transferType is not one of DataBuffer.TYPE_BYTE, - // DataBuffer.TYPE_USHORT, DataBuffer.TYPE_INT, - // DataBuffer.TYPE_SHORT, DataBuffer.TYPE_FLOAT, or - // DataBuffer.TYPE_DOUBLE - throw new IllegalArgumentException(Messages.getString("awt.215")); //$NON-NLS-1$ + if (needScale) { + minVals = new float[numColorComponents]; + ranges = new float[numColorComponents]; + for (int i = 0; i < numColorComponents; i++) { + minVals[i] = cs.getMinValue(i); + ranges[i] = cs.getMaxValue(i) - minVals[i]; + } + } + break; + case DataBuffer.TYPE_FLOAT: + case DataBuffer.TYPE_DOUBLE: + signed = true; + integral = false; + donotSupportUnnormalized = true; + break; + default: + // awt.215=transferType is not one of DataBuffer.TYPE_BYTE, + // DataBuffer.TYPE_USHORT, DataBuffer.TYPE_INT, + // DataBuffer.TYPE_SHORT, DataBuffer.TYPE_FLOAT, or + // DataBuffer.TYPE_DOUBLE + throw new IllegalArgumentException(Messages.getString("awt.215")); //$NON-NLS-1$ } needAlphaDivide = hasAlpha && isAlphaPremultiplied; @@ -183,36 +232,40 @@ public class ComponentColorModel extends ColorModel { /** * Instantiates a new component color model. * - * @param colorSpace the color space - * @param hasAlpha whether the color model has alpha - * @param isAlphaPremultiplied whether the alpha is premultiplied - * @param transparency the transparency strategy, @see java.awt.Transparency - * @param transferType the transfer type (primitive java type - * to use for the components) + * @param colorSpace + * the color space. + * @param hasAlpha + * whether the color model has alpha. + * @param isAlphaPremultiplied + * whether the alpha is pre-multiplied. + * @param transparency + * the transparency strategy, @see java.awt.Transparency. + * @param transferType + * the transfer type (primitive java type to use for the + * components). */ public ComponentColorModel(ColorSpace colorSpace, boolean hasAlpha, boolean isAlphaPremultiplied, int transparency, int transferType) { - - this(colorSpace, - createPixelBitsArray(colorSpace, hasAlpha, transferType), - hasAlpha, - isAlphaPremultiplied, - transparency, - transferType); + + this(colorSpace, createPixelBitsArray(colorSpace, hasAlpha, transferType), hasAlpha, + isAlphaPremultiplied, transparency, transferType); } /** * Validate bits. * - * @param bits the bits - * @param colorSpace the color space - * @param hasAlpha the has alpha - * @param transferType the transfer type - * - * @return the int[] + * @param bits + * the bits. + * @param colorSpace + * the color space. + * @param hasAlpha + * the has alpha. + * @param transferType + * the transfer type. + * @return the int[]. */ - private static int[] validateBits(int bits[], ColorSpace colorSpace, - boolean hasAlpha, int transferType) { + private static int[] validateBits(int bits[], ColorSpace colorSpace, boolean hasAlpha, + int transferType) { if (bits != null) { return bits; } @@ -235,14 +288,15 @@ public class ComponentColorModel extends ColorModel { /** * Creates the pixel bits. * - * @param colorSpace the color space - * @param hasAlpha the has alpha - * @param transferType the transfer type - * - * @return the int + * @param colorSpace + * the color space. + * @param hasAlpha + * the has alpha. + * @param transferType + * the transfer type. + * @return the int. */ - private static int createPixelBits(ColorSpace colorSpace, boolean hasAlpha, - int transferType) { + private static int createPixelBits(ColorSpace colorSpace, boolean hasAlpha, int transferType) { int numComponents = colorSpace.getNumComponents(); if (hasAlpha) { numComponents++; @@ -254,22 +308,24 @@ public class ComponentColorModel extends ColorModel { /** * Creates the pixel bits array. * - * @param colorSpace the color space - * @param hasAlpha the has alpha - * @param transferType the transfer type - * - * @return the int[] + * @param colorSpace + * the color space. + * @param hasAlpha + * the has alpha. + * @param transferType + * the transfer type. + * @return the int[]. */ - private static int[] createPixelBitsArray(ColorSpace colorSpace, - boolean hasAlpha, int transferType) { - + private static int[] createPixelBitsArray(ColorSpace colorSpace, boolean hasAlpha, + int transferType) { + int numComponents = colorSpace.getNumComponents(); if (hasAlpha) { numComponents++; } int bits[] = new int[numComponents]; - for(int i = 0; i < numComponents; i++){ + for (int i = 0; i < numComponents; i++) { bits[i] = DataBuffer.getDataTypeSize(transferType); } return bits; @@ -278,217 +334,200 @@ public class ComponentColorModel extends ColorModel { @Override public Object getDataElements(int components[], int offset, Object obj) { if (donotSupportUnnormalized) { - // awt.213=This ComponentColorModel does not support the unnormalized form + // awt.213=This ComponentColorModel does not support the + // unnormalized form throw new IllegalArgumentException(Messages.getString("awt.213")); //$NON-NLS-1$ } if (offset + numComponents > components.length) { - // awt.216=The components array is not large enough to hold all the color and alpha components + // awt.216=The components array is not large enough to hold all the + // color and alpha components throw new IllegalArgumentException(Messages.getString("awt.216")); //$NON-NLS-1$ } switch (transferType) { - case DataBuffer.TYPE_BYTE: - byte ba[]; - if (obj == null) { - ba = new byte[numComponents]; - } else { - ba = (byte[]) obj; - } - for (int i = 0, idx = offset; i < numComponents; i++, idx++) { - ba[i] = (byte) components[idx]; - } - return ba; - case DataBuffer.TYPE_USHORT: - short sa[]; - if (obj == null) { - sa = new short[numComponents]; - } else { - sa = (short[]) obj; - } - for (int i = 0, idx = offset; i < numComponents; i++, idx++) { - sa[i] = (short) components[idx]; - } - return sa; - case DataBuffer.TYPE_INT: - int ia[]; - if (obj == null) { - ia = new int[numComponents]; - } else { - ia = (int[]) obj; - } - for (int i = 0, idx = offset; i < numComponents; i++, idx++) { - ia[i] = components[idx]; - } - return ia; - default: - // awt.217=The transfer type of this ComponentColorModel is not one - // of the following transfer types: DataBuffer.TYPE_BYTE, - // DataBuffer.TYPE_USHORT, or DataBuffer.TYPE_INT - throw new UnsupportedOperationException(Messages - .getString("awt.217")); //$NON-NLS-1$ + case DataBuffer.TYPE_BYTE: + byte ba[]; + if (obj == null) { + ba = new byte[numComponents]; + } else { + ba = (byte[])obj; + } + for (int i = 0, idx = offset; i < numComponents; i++, idx++) { + ba[i] = (byte)components[idx]; + } + return ba; + case DataBuffer.TYPE_USHORT: + short sa[]; + if (obj == null) { + sa = new short[numComponents]; + } else { + sa = (short[])obj; + } + for (int i = 0, idx = offset; i < numComponents; i++, idx++) { + sa[i] = (short)components[idx]; + } + return sa; + case DataBuffer.TYPE_INT: + int ia[]; + if (obj == null) { + ia = new int[numComponents]; + } else { + ia = (int[])obj; + } + for (int i = 0, idx = offset; i < numComponents; i++, idx++) { + ia[i] = components[idx]; + } + return ia; + default: + // awt.217=The transfer type of this ComponentColorModel is not + // one + // of the following transfer types: DataBuffer.TYPE_BYTE, + // DataBuffer.TYPE_USHORT, or DataBuffer.TYPE_INT + throw new UnsupportedOperationException(Messages.getString("awt.217")); //$NON-NLS-1$ } } @Override - public Object getDataElements(float normComponents[], int normOffset, - Object obj) { + public Object getDataElements(float normComponents[], int normOffset, Object obj) { if (needScale) { for (int i = 0, idx = 0; i < numColorComponents; i++, idx++) { - normComponents[idx] = - (normComponents[idx] - minVals[i]) / ranges[i]; + normComponents[idx] = (normComponents[idx] - minVals[i]) / ranges[i]; } } switch (transferType) { - case DataBuffer.TYPE_BYTE: - byte ba[]; - if (obj == null) { - ba = new byte[numComponents]; - } else { - ba = (byte[]) obj; - } - - if (needAlphaDivide) { - float alpha = normComponents[normOffset + numColorComponents]; - for (int i = 0, idx = normOffset; i < numColorComponents; - i++, idx++) { - ba[i] = (byte) (normComponents[idx] * alpha * - maxValues[i] + 0.5f); - } - ba[numColorComponents] = - (byte) (normComponents[normOffset + numColorComponents] * - maxValues[numColorComponents] + 0.5f); - } else { - for (int i = 0, idx = normOffset; i < numComponents; - i++, idx++) { - ba[idx] = - (byte) (normComponents[idx] * maxValues[i] + 0.5f); + case DataBuffer.TYPE_BYTE: + byte ba[]; + if (obj == null) { + ba = new byte[numComponents]; + } else { + ba = (byte[])obj; } - } - return ba; - case DataBuffer.TYPE_USHORT: - short usa[]; - if (obj == null) { - usa = new short[numComponents]; - } else { - usa = (short[]) obj; - } - - if (needAlphaDivide) { - float alpha = normComponents[normOffset + numColorComponents]; - for (int i = 0, idx = 0; i < numColorComponents; i++, idx++) { - usa[i] = (short) (normComponents[idx] * alpha * - maxValues[i] + 0.5f); - } - usa[numColorComponents] = (short) (alpha * - maxValues[numColorComponents] + 0.5f); - } else { - for (int i = 0, idx = normOffset; i < numComponents; - i++, idx++) { - usa[i] = (short) (normComponents[idx] * - maxValues[i] + 0.5f); + if (needAlphaDivide) { + float alpha = normComponents[normOffset + numColorComponents]; + for (int i = 0, idx = normOffset; i < numColorComponents; i++, idx++) { + ba[i] = (byte)(normComponents[idx] * alpha * maxValues[i] + 0.5f); + } + ba[numColorComponents] = (byte)(normComponents[normOffset + numColorComponents] + * maxValues[numColorComponents] + 0.5f); + } else { + for (int i = 0, idx = normOffset; i < numComponents; i++, idx++) { + ba[idx] = (byte)(normComponents[idx] * maxValues[i] + 0.5f); + } } - } - return usa; + return ba; - case DataBuffer.TYPE_INT: - int ia[]; - if (obj == null) { - ia = new int[numComponents]; - } else { - ia = (int[]) obj; - } - - if (needAlphaDivide) { - float alpha = normComponents[normOffset + numColorComponents]; - for (int i = 0, idx = 0; i < numColorComponents; i++, idx++) { - ia[i] = (int) (normComponents[idx] * alpha * - maxValues[i] + 0.5f); - } - ia[numColorComponents] = (int) (alpha * - maxValues[numColorComponents] + 0.5f); - } else { - for (int i = 0, idx = normOffset; i < numComponents; - i++, idx++) { - ia[i] = (int) (normComponents[idx] * maxValues[i] + 0.5f); + case DataBuffer.TYPE_USHORT: + short usa[]; + if (obj == null) { + usa = new short[numComponents]; + } else { + usa = (short[])obj; } - } - return ia; - case DataBuffer.TYPE_SHORT: - short sa[]; - if (obj == null) { - sa = new short[numComponents]; - } else { - sa = (short[]) obj; - } + if (needAlphaDivide) { + float alpha = normComponents[normOffset + numColorComponents]; + for (int i = 0, idx = 0; i < numColorComponents; i++, idx++) { + usa[i] = (short)(normComponents[idx] * alpha * maxValues[i] + 0.5f); + } + usa[numColorComponents] = (short)(alpha * maxValues[numColorComponents] + 0.5f); + } else { + for (int i = 0, idx = normOffset; i < numComponents; i++, idx++) { + usa[i] = (short)(normComponents[idx] * maxValues[i] + 0.5f); + } + } + return usa; - if (needAlphaDivide) { - float alpha = normComponents[normOffset + numColorComponents]; - for (int i = 0, idx = 0; i < numColorComponents; i++, idx++) { - sa[i] = (short) (normComponents[idx] * alpha * - maxValues[i] + 0.5f); + case DataBuffer.TYPE_INT: + int ia[]; + if (obj == null) { + ia = new int[numComponents]; + } else { + ia = (int[])obj; } - sa[numColorComponents] = (short) (alpha * - maxValues[numColorComponents] + 0.5f); - } else { - for (int i = 0, idx = normOffset; i < numComponents; - i++, idx++) { - sa[i] = (short) (normComponents[idx] * - maxValues[i] + 0.5f); + + if (needAlphaDivide) { + float alpha = normComponents[normOffset + numColorComponents]; + for (int i = 0, idx = 0; i < numColorComponents; i++, idx++) { + ia[i] = (int)(normComponents[idx] * alpha * maxValues[i] + 0.5f); + } + ia[numColorComponents] = (int)(alpha * maxValues[numColorComponents] + 0.5f); + } else { + for (int i = 0, idx = normOffset; i < numComponents; i++, idx++) { + ia[i] = (int)(normComponents[idx] * maxValues[i] + 0.5f); + } } - } - return sa; + return ia; - case DataBuffer.TYPE_FLOAT: - float fa[]; - if (obj == null) { - fa = new float[numComponents]; - } else { - fa = (float[]) obj; - } + case DataBuffer.TYPE_SHORT: + short sa[]; + if (obj == null) { + sa = new short[numComponents]; + } else { + sa = (short[])obj; + } - if (needAlphaDivide) { - float alpha = normComponents[normOffset + numColorComponents]; - for (int i = 0, idx = 0; i < numColorComponents; i++, idx++) { - fa[i] = normComponents[idx] * alpha; + if (needAlphaDivide) { + float alpha = normComponents[normOffset + numColorComponents]; + for (int i = 0, idx = 0; i < numColorComponents; i++, idx++) { + sa[i] = (short)(normComponents[idx] * alpha * maxValues[i] + 0.5f); + } + sa[numColorComponents] = (short)(alpha * maxValues[numColorComponents] + 0.5f); + } else { + for (int i = 0, idx = normOffset; i < numComponents; i++, idx++) { + sa[i] = (short)(normComponents[idx] * maxValues[i] + 0.5f); + } } - fa[numColorComponents] = alpha; - } else { - for (int i = 0, idx = normOffset; i < numComponents; - i++, idx++) { - fa[i] = normComponents[idx]; + return sa; + + case DataBuffer.TYPE_FLOAT: + float fa[]; + if (obj == null) { + fa = new float[numComponents]; + } else { + fa = (float[])obj; } - } - return fa; - case DataBuffer.TYPE_DOUBLE: - double da[]; - if (obj == null) { - da = new double[numComponents]; - } else { - da = (double[]) obj; - } + if (needAlphaDivide) { + float alpha = normComponents[normOffset + numColorComponents]; + for (int i = 0, idx = 0; i < numColorComponents; i++, idx++) { + fa[i] = normComponents[idx] * alpha; + } + fa[numColorComponents] = alpha; + } else { + for (int i = 0, idx = normOffset; i < numComponents; i++, idx++) { + fa[i] = normComponents[idx]; + } + } + return fa; - if (needAlphaDivide) { - double alpha = normComponents[normOffset + numColorComponents]; - for (int i = 0, idx = 0; i < numColorComponents; i++, idx++) { - da[i] = normComponents[idx] * alpha; + case DataBuffer.TYPE_DOUBLE: + double da[]; + if (obj == null) { + da = new double[numComponents]; + } else { + da = (double[])obj; } - da[numColorComponents] = alpha; - } else { - for (int i = 0, idx = normOffset; i < numComponents; - i++, idx++) { - da[i] = normComponents[idx]; + + if (needAlphaDivide) { + double alpha = normComponents[normOffset + numColorComponents]; + for (int i = 0, idx = 0; i < numColorComponents; i++, idx++) { + da[i] = normComponents[idx] * alpha; + } + da[numColorComponents] = alpha; + } else { + for (int i = 0, idx = normOffset; i < numComponents; i++, idx++) { + da[i] = normComponents[idx]; + } } - } - return da; + return da; - default: - // awt.213=This ComponentColorModel does not support the unnormalized form - throw new IllegalArgumentException(Messages.getString("awt.213")); //$NON-NLS-1$ + default: + // awt.213=This ComponentColorModel does not support the + // unnormalized form + throw new IllegalArgumentException(Messages.getString("awt.213")); //$NON-NLS-1$ } } @@ -544,7 +583,7 @@ public class ComponentColorModel extends ColorModel { normComp[numColorComponents] = normAlpha; } } - if(hasAlpha && isAlphaPremultiplied){ + if (hasAlpha && isAlphaPremultiplied) { normComp[0] *= normComp[numColorComponents]; normComp[1] *= normComp[numColorComponents]; normComp[2] *= normComp[numColorComponents]; @@ -555,7 +594,7 @@ public class ComponentColorModel extends ColorModel { @Override public WritableRaster getAlphaRaster(WritableRaster raster) { - if(!hasAlpha) { + if (!hasAlpha) { return null; } @@ -564,13 +603,12 @@ public class ComponentColorModel extends ColorModel { int bandList[] = new int[1]; bandList[0] = raster.getNumBands() - 1; - return raster.createWritableChild(x, y, raster.getWidth(), - raster.getHeight(), x, y, bandList); + return raster.createWritableChild(x, y, raster.getWidth(), raster.getHeight(), x, y, + bandList); } @Override - public ColorModel coerceData(WritableRaster raster, - boolean isAlphaPremultiplied) { + public ColorModel coerceData(WritableRaster raster, boolean isAlphaPremultiplied) { if (!hasAlpha || this.isAlphaPremultiplied == isAlphaPremultiplied) { return this; } @@ -582,333 +620,311 @@ public class ComponentColorModel extends ColorModel { if (isAlphaPremultiplied) { switch (transferType) { - case DataBuffer.TYPE_BYTE: - case DataBuffer.TYPE_USHORT: - case DataBuffer.TYPE_INT: - float alphaFactor = maxValues[numColorComponents]; - int iComponents[] = null; - int iTransparentComponents[] = new int[numComponents]; - for (int i = 0; i < h; i++, minY++) { - for (int j = 0, x = minX; j < w; j++, x++) { - iComponents = raster.getPixel(x, minY, - iComponents); - if (iComponents[numColorComponents] == 0) { - raster.setPixel(x, minY, iTransparentComponents); - } else { - float alpha = - iComponents[numColorComponents] / - alphaFactor; - for (int n = 0; n < numColorComponents; n++) { - iComponents[n] = - (int) (alpha * iComponents[n] + 0.5f); + case DataBuffer.TYPE_BYTE: + case DataBuffer.TYPE_USHORT: + case DataBuffer.TYPE_INT: + float alphaFactor = maxValues[numColorComponents]; + int iComponents[] = null; + int iTransparentComponents[] = new int[numComponents]; + for (int i = 0; i < h; i++, minY++) { + for (int j = 0, x = minX; j < w; j++, x++) { + iComponents = raster.getPixel(x, minY, iComponents); + if (iComponents[numColorComponents] == 0) { + raster.setPixel(x, minY, iTransparentComponents); + } else { + float alpha = iComponents[numColorComponents] / alphaFactor; + for (int n = 0; n < numColorComponents; n++) { + iComponents[n] = (int)(alpha * iComponents[n] + 0.5f); + } + raster.setPixel(x, minY, iComponents); } - raster.setPixel(x, minY, iComponents); } - } - - } - break; - case DataBuffer.TYPE_SHORT: - float sAlphaFactor = maxValues[numColorComponents]; - short sComponents[] = null; - short sTransparentComponents[] = new short[numComponents]; - for (int i = 0; i < h; i++, minY++) { - for (int j = 0, x = minX; j < w; j++, x++) { - sComponents = (short[]) raster.getDataElements(x, minY, - sComponents); - if (sComponents[numColorComponents] == 0) { - raster.setDataElements(x, minY, - sTransparentComponents); - } else { - float alpha = - sComponents[numColorComponents] / - sAlphaFactor; - for (int n = 0; n < numColorComponents; n++) { - sComponents[n] = - (byte) (alpha * sComponents[n] + 0.5f); + } + break; + + case DataBuffer.TYPE_SHORT: + float sAlphaFactor = maxValues[numColorComponents]; + short sComponents[] = null; + short sTransparentComponents[] = new short[numComponents]; + for (int i = 0; i < h; i++, minY++) { + for (int j = 0, x = minX; j < w; j++, x++) { + sComponents = (short[])raster.getDataElements(x, minY, sComponents); + if (sComponents[numColorComponents] == 0) { + raster.setDataElements(x, minY, sTransparentComponents); + } else { + float alpha = sComponents[numColorComponents] / sAlphaFactor; + for (int n = 0; n < numColorComponents; n++) { + sComponents[n] = (byte)(alpha * sComponents[n] + 0.5f); + } + raster.setDataElements(x, minY, sComponents); } - raster.setDataElements(x, minY, sComponents); } - } - - } - break; - case DataBuffer.TYPE_FLOAT: - float fComponents[] = null; - float fTransparentComponents[] = new float[numComponents]; - for (int i = 0; i < h; i++, minY++) { - for (int j = 0, x = minX; j < w; j++, x++) { - fComponents = raster.getPixel(x, minY, fComponents); - if (fComponents[numColorComponents] == 0.0f) { - raster.setDataElements(x, minY, - fTransparentComponents); - } else { - float alpha = fComponents[numColorComponents]; - for (int n = 0; n < numColorComponents; n++) { - fComponents[n] = fComponents[n] * alpha; + } + break; + + case DataBuffer.TYPE_FLOAT: + float fComponents[] = null; + float fTransparentComponents[] = new float[numComponents]; + for (int i = 0; i < h; i++, minY++) { + for (int j = 0, x = minX; j < w; j++, x++) { + fComponents = raster.getPixel(x, minY, fComponents); + if (fComponents[numColorComponents] == 0.0f) { + raster.setDataElements(x, minY, fTransparentComponents); + } else { + float alpha = fComponents[numColorComponents]; + for (int n = 0; n < numColorComponents; n++) { + fComponents[n] = fComponents[n] * alpha; + } + raster.setPixel(x, minY, fComponents); } - raster.setPixel(x, minY, fComponents); } - } - } - break; - - case DataBuffer.TYPE_DOUBLE: - double dComponents[] = null; - double dTransparentComponents[] = new double[numComponents]; - for (int i = 0; i < h; i++, minY++) { - for (int j = 0, x = minX; j < w; j++, x++) { - dComponents = raster.getPixel(x, minY, dComponents); - if (dComponents[numColorComponents] == 0.0) { - raster.setPixel(x, minY, dTransparentComponents); - } else { - double alpha = dComponents[numColorComponents]; - for (int n = 0; n < numColorComponents; n++) { - dComponents[n] = dComponents[n] * alpha; + } + break; + + case DataBuffer.TYPE_DOUBLE: + double dComponents[] = null; + double dTransparentComponents[] = new double[numComponents]; + for (int i = 0; i < h; i++, minY++) { + for (int j = 0, x = minX; j < w; j++, x++) { + dComponents = raster.getPixel(x, minY, dComponents); + if (dComponents[numColorComponents] == 0.0) { + raster.setPixel(x, minY, dTransparentComponents); + } else { + double alpha = dComponents[numColorComponents]; + for (int n = 0; n < numColorComponents; n++) { + dComponents[n] = dComponents[n] * alpha; + } + raster.setPixel(x, minY, dComponents); } - raster.setPixel(x, minY, dComponents); } - } - } - break; + } + break; - default: - // awt.219=This transferType is not supported by this color model - throw new UnsupportedOperationException(Messages.getString("awt.219")); //$NON-NLS-1$ + default: + // awt.219=This transferType is not supported by this color + // model + throw new UnsupportedOperationException(Messages.getString("awt.219")); //$NON-NLS-1$ } } else { switch (transferType) { - case DataBuffer.TYPE_BYTE: - case DataBuffer.TYPE_USHORT: - case DataBuffer.TYPE_INT: - float alphaFactor = maxValues[numColorComponents]; - int iComponents[] = null; - int iTransparentComponents[] = new int[numComponents]; - for (int i = 0; i < h; i++, minY++) { - for (int j = 0, x = minX; j < w; j++, x++) { - iComponents = raster.getPixel(x, minY, - iComponents); - if (iComponents[numColorComponents] == 0) { - raster.setPixel(x, minY, iTransparentComponents); - } else { - float alpha = - iComponents[numColorComponents] / - alphaFactor; - for (int n = 0; n < numColorComponents; n++) { - iComponents[n] = - (int) (iComponents[n] / - alpha + 0.5f); + case DataBuffer.TYPE_BYTE: + case DataBuffer.TYPE_USHORT: + case DataBuffer.TYPE_INT: + float alphaFactor = maxValues[numColorComponents]; + int iComponents[] = null; + int iTransparentComponents[] = new int[numComponents]; + for (int i = 0; i < h; i++, minY++) { + for (int j = 0, x = minX; j < w; j++, x++) { + iComponents = raster.getPixel(x, minY, iComponents); + if (iComponents[numColorComponents] == 0) { + raster.setPixel(x, minY, iTransparentComponents); + } else { + float alpha = iComponents[numColorComponents] / alphaFactor; + for (int n = 0; n < numColorComponents; n++) { + iComponents[n] = (int)(iComponents[n] / alpha + 0.5f); + } + raster.setPixel(x, minY, iComponents); } - raster.setPixel(x, minY, iComponents); } - } - } - break; - - case DataBuffer.TYPE_SHORT: - float sAlphaFactor = maxValues[numColorComponents]; - short sComponents[] = null; - short sTransparentComponents[] = new short[numComponents]; - for (int i = 0; i < h; i++, minY++) { - for (int j = 0, x = minX; j < w; j++, x++) { - sComponents = (short[]) raster.getDataElements(x, minY, - sComponents); - if (sComponents[numColorComponents] == 0) { - raster.setDataElements(x, minY, - sTransparentComponents); - } else { - float alpha = - sComponents[numColorComponents] / - sAlphaFactor; - for (int n = 0; n < numColorComponents; n++) { - sComponents[n] = - (byte) (sComponents[n] / - alpha + 0.5f); + } + break; + + case DataBuffer.TYPE_SHORT: + float sAlphaFactor = maxValues[numColorComponents]; + short sComponents[] = null; + short sTransparentComponents[] = new short[numComponents]; + for (int i = 0; i < h; i++, minY++) { + for (int j = 0, x = minX; j < w; j++, x++) { + sComponents = (short[])raster.getDataElements(x, minY, sComponents); + if (sComponents[numColorComponents] == 0) { + raster.setDataElements(x, minY, sTransparentComponents); + } else { + float alpha = sComponents[numColorComponents] / sAlphaFactor; + for (int n = 0; n < numColorComponents; n++) { + sComponents[n] = (byte)(sComponents[n] / alpha + 0.5f); + } + raster.setDataElements(x, minY, sComponents); } - raster.setDataElements(x, minY, sComponents); } - } - } - break; - - case DataBuffer.TYPE_FLOAT: - float fComponents[] = null; - float fTransparentComponents[] = new float[numComponents]; - for (int i = 0; i < h; i++, minY++) { - for (int j = 0, x = minX; j < w; j++, x++) { - fComponents = raster.getPixel(x, minY, fComponents); - if (fComponents[numColorComponents] == 0.0f) { - raster.setDataElements(x, minY, - fTransparentComponents); - } else { - float alpha = fComponents[numColorComponents]; - for (int n = 0; n < numColorComponents; n++) { - fComponents[n] = fComponents[n] / alpha; + } + break; + + case DataBuffer.TYPE_FLOAT: + float fComponents[] = null; + float fTransparentComponents[] = new float[numComponents]; + for (int i = 0; i < h; i++, minY++) { + for (int j = 0, x = minX; j < w; j++, x++) { + fComponents = raster.getPixel(x, minY, fComponents); + if (fComponents[numColorComponents] == 0.0f) { + raster.setDataElements(x, minY, fTransparentComponents); + } else { + float alpha = fComponents[numColorComponents]; + for (int n = 0; n < numColorComponents; n++) { + fComponents[n] = fComponents[n] / alpha; + } + raster.setPixel(x, minY, fComponents); } - raster.setPixel(x, minY, fComponents); } - } - - } - break; - case DataBuffer.TYPE_DOUBLE: - double dComponents[] = null; - double dTransparentComponents[] = new double[numComponents]; - for (int i = 0; i < h; i++, minY++) { - for (int j = 0, x = minX; j < w; j++, x++) { - dComponents = raster.getPixel(x, minY, dComponents); - if (dComponents[numColorComponents] == 0.0) { - raster.setPixel(x, minY, dTransparentComponents); - } else { - double alpha = dComponents[numColorComponents]; - for (int n = 0; n < numColorComponents; n++) { - dComponents[n] = dComponents[n] / alpha; + } + break; + + case DataBuffer.TYPE_DOUBLE: + double dComponents[] = null; + double dTransparentComponents[] = new double[numComponents]; + for (int i = 0; i < h; i++, minY++) { + for (int j = 0, x = minX; j < w; j++, x++) { + dComponents = raster.getPixel(x, minY, dComponents); + if (dComponents[numColorComponents] == 0.0) { + raster.setPixel(x, minY, dTransparentComponents); + } else { + double alpha = dComponents[numColorComponents]; + for (int n = 0; n < numColorComponents; n++) { + dComponents[n] = dComponents[n] / alpha; + } + raster.setPixel(x, minY, dComponents); } - raster.setPixel(x, minY, dComponents); } - } - } - break; - default: - // awt.219=This transferType is not supported by this color model - throw new UnsupportedOperationException(Messages.getString("awt.219")); //$NON-NLS-1$ + } + break; + default: + // awt.219=This transferType is not supported by this color + // model + throw new UnsupportedOperationException(Messages.getString("awt.219")); //$NON-NLS-1$ } } if (!signed) { - return new ComponentColorModel(cs, bits, hasAlpha, - isAlphaPremultiplied, transparency, transferType); + return new ComponentColorModel(cs, bits, hasAlpha, isAlphaPremultiplied, transparency, + transferType); } - return new ComponentColorModel(cs, null, hasAlpha, - isAlphaPremultiplied, transparency, transferType); + return new ComponentColorModel(cs, null, hasAlpha, isAlphaPremultiplied, transparency, + transferType); } @Override public int[] getComponents(Object pixel, int[] components, int offset) { if (donotSupportUnnormalized) { - // awt.213=This ComponentColorModel does not support the unnormalized form + // awt.213=This ComponentColorModel does not support the + // unnormalized form throw new IllegalArgumentException(Messages.getString("awt.213")); //$NON-NLS-1$ } if (components == null) { components = new int[offset + numComponents]; } else if (offset + numComponents > components.length) { - // awt.218=The components array is not large enough to hold all the color and alpha components + // awt.218=The components array is not large enough to hold all the + // color and alpha components throw new IllegalArgumentException(Messages.getString("awt.218")); //$NON-NLS-1$ } switch (transferType) { - case DataBuffer.TYPE_BYTE: - byte ba[] = (byte[]) pixel; + case DataBuffer.TYPE_BYTE: + byte ba[] = (byte[])pixel; - for (int i = 0, idx = offset; i < numComponents; i++, idx++) { - components[idx] = ba[i] & 0xff; - } - return components; + for (int i = 0, idx = offset; i < numComponents; i++, idx++) { + components[idx] = ba[i] & 0xff; + } + return components; - case DataBuffer.TYPE_USHORT: - short sa[] = (short[]) pixel; - for (int i = 0, idx = offset; i < numComponents; i++, idx++) { - components[idx] = sa[i] & 0xffff; - } - return components; + case DataBuffer.TYPE_USHORT: + short sa[] = (short[])pixel; + for (int i = 0, idx = offset; i < numComponents; i++, idx++) { + components[idx] = sa[i] & 0xffff; + } + return components; - case DataBuffer.TYPE_INT: - int ia[] = (int[]) pixel; - for (int i = 0, idx = offset; i < numComponents; i++, idx++) { - components[idx] = ia[i]; - } - return components; - - default: - // awt.217=The transfer type of this ComponentColorModel is not one - // of the following transfer types: DataBuffer.TYPE_BYTE, - // DataBuffer.TYPE_USHORT, or DataBuffer.TYPE_INT - throw new UnsupportedOperationException(Messages - .getString("awt.217")); //$NON-NLS-1$ + case DataBuffer.TYPE_INT: + int ia[] = (int[])pixel; + for (int i = 0, idx = offset; i < numComponents; i++, idx++) { + components[idx] = ia[i]; + } + return components; + + default: + // awt.217=The transfer type of this ComponentColorModel is not + // one + // of the following transfer types: DataBuffer.TYPE_BYTE, + // DataBuffer.TYPE_USHORT, or DataBuffer.TYPE_INT + throw new UnsupportedOperationException(Messages.getString("awt.217")); //$NON-NLS-1$ } } @Override - public float[] getNormalizedComponents(Object pixel, - float normComponents[], int normOffset) { + public float[] getNormalizedComponents(Object pixel, float normComponents[], int normOffset) { if (normComponents == null) { normComponents = new float[numComponents + normOffset]; } switch (transferType) { - case DataBuffer.TYPE_BYTE: - byte ba[] = (byte[]) pixel; - for (int i = 0, idx = normOffset; i < numComponents; i++, idx++) { - normComponents[idx] = (ba[i] & 0xff) * scaleFactors[i]; - } - break; + case DataBuffer.TYPE_BYTE: + byte ba[] = (byte[])pixel; + for (int i = 0, idx = normOffset; i < numComponents; i++, idx++) { + normComponents[idx] = (ba[i] & 0xff) * scaleFactors[i]; + } + break; - case DataBuffer.TYPE_USHORT: - short usa[] = (short[]) pixel; - for (int i = 0, idx = normOffset; i < numComponents; i++, idx++) { - normComponents[idx] = (usa[i] & 0xffff) - * scaleFactors[i]; - } - break; + case DataBuffer.TYPE_USHORT: + short usa[] = (short[])pixel; + for (int i = 0, idx = normOffset; i < numComponents; i++, idx++) { + normComponents[idx] = (usa[i] & 0xffff) * scaleFactors[i]; + } + break; - case DataBuffer.TYPE_INT: - int ia[] = (int[]) pixel; - for (int i = 0, idx = normOffset; i < numComponents; i++, idx++) { - normComponents[idx] = ia[i] * scaleFactors[i]; - } - break; + case DataBuffer.TYPE_INT: + int ia[] = (int[])pixel; + for (int i = 0, idx = normOffset; i < numComponents; i++, idx++) { + normComponents[idx] = ia[i] * scaleFactors[i]; + } + break; - case DataBuffer.TYPE_SHORT: - short sa[] = (short[]) pixel; - for (int i = 0, idx = normOffset; i < numComponents; i++, idx++) { - normComponents[idx] = sa[i] * scaleFactors[i]; - } - break; + case DataBuffer.TYPE_SHORT: + short sa[] = (short[])pixel; + for (int i = 0, idx = normOffset; i < numComponents; i++, idx++) { + normComponents[idx] = sa[i] * scaleFactors[i]; + } + break; - case DataBuffer.TYPE_FLOAT: - float fa[] = (float[]) pixel; - for (int i = 0, idx = normOffset; i < numComponents; i++, idx++) { - normComponents[idx] = fa[i]; - } - break; + case DataBuffer.TYPE_FLOAT: + float fa[] = (float[])pixel; + for (int i = 0, idx = normOffset; i < numComponents; i++, idx++) { + normComponents[idx] = fa[i]; + } + break; - case DataBuffer.TYPE_DOUBLE: - double da[] = (double[]) pixel; - for (int i = 0, idx = normOffset; i < numComponents; i++, idx++) { - normComponents[idx] = (float) da[i]; - } - break; + case DataBuffer.TYPE_DOUBLE: + double da[] = (double[])pixel; + for (int i = 0, idx = normOffset; i < numComponents; i++, idx++) { + normComponents[idx] = (float)da[i]; + } + break; - default: - // awt.21A=This ComponentColorModel does not support this transferType - throw new IllegalArgumentException(Messages.getString("awt.21A")); //$NON-NLS-1$ + default: + // awt.21A=This ComponentColorModel does not support this + // transferType + throw new IllegalArgumentException(Messages.getString("awt.21A")); //$NON-NLS-1$ } if (needAlphaDivide) { float alpha = normComponents[normOffset + numColorComponents]; - for (int i = 0, idx = normOffset; i < numColorComponents; - i++, idx++) { + for (int i = 0, idx = normOffset; i < numColorComponents; i++, idx++) { normComponents[idx] /= alpha; } } if (needScale) { - for (int i = 0, idx = normOffset; i < numColorComponents; - i++, idx++) { - normComponents[idx] = minVals[i] + - ranges[i] * normComponents[idx]; + for (int i = 0, idx = normOffset; i < numColorComponents; i++, idx++) { + normComponents[idx] = minVals[i] + ranges[i] * normComponents[idx]; } } return normComponents; @@ -934,8 +950,7 @@ public class ComponentColorModel extends ColorModel { int gray = getRed(inData); return (alpha << 24 | gray << 16 | gray << 8 | gray); } - return (alpha << 24 | getRed(inData) << 16 | getGreen(inData) << 8 | - getBlue(inData)); + return (alpha << 24 | getRed(inData) << 16 | getGreen(inData) << 8 | getBlue(inData)); } @Override @@ -956,50 +971,50 @@ public class ComponentColorModel extends ColorModel { int alpha = 0; switch (transferType) { - case DataBuffer.TYPE_BYTE: { - byte ba[] = (byte[]) inData; - alpha = ba[numColorComponents] & 0xff; - if (bits[numColorComponents] != 8) { - return alphaLUT[alpha] & 0xff; + case DataBuffer.TYPE_BYTE: { + byte ba[] = (byte[])inData; + alpha = ba[numColorComponents] & 0xff; + if (bits[numColorComponents] != 8) { + return alphaLUT[alpha] & 0xff; + } + return alpha; } - return alpha; - } - case DataBuffer.TYPE_USHORT: { - short usa[] = (short[]) inData; - alpha = usa[numColorComponents] & 0xffff; - if (bits[numColorComponents] != 8) { - return alphaLUT[alpha] & 0xff; + case DataBuffer.TYPE_USHORT: { + short usa[] = (short[])inData; + alpha = usa[numColorComponents] & 0xffff; + if (bits[numColorComponents] != 8) { + return alphaLUT[alpha] & 0xff; + } + return alpha; } - return alpha; - } - case DataBuffer.TYPE_INT: { - int ia[] = (int[]) inData; - alpha = ia[numColorComponents]; - if (bits[numColorComponents] != 8) { - return alphaLUT[alpha] & 0xff; + case DataBuffer.TYPE_INT: { + int ia[] = (int[])inData; + alpha = ia[numColorComponents]; + if (bits[numColorComponents] != 8) { + return alphaLUT[alpha] & 0xff; + } + return alpha; } - return alpha; - } - case DataBuffer.TYPE_SHORT: { - short sa[] = (short[]) inData; - alpha = sa[numColorComponents]; - if (bits[numColorComponents] != 8) { - return alphaLUT[alpha] & 0xff; + case DataBuffer.TYPE_SHORT: { + short sa[] = (short[])inData; + alpha = sa[numColorComponents]; + if (bits[numColorComponents] != 8) { + return alphaLUT[alpha] & 0xff; + } + return alpha; + } + case DataBuffer.TYPE_FLOAT: { + float fa[] = (float[])inData; + return (int)(fa[numColorComponents] * 255.0f + 0.5f); + } + case DataBuffer.TYPE_DOUBLE: { + double da[] = (double[])inData; + return (int)(da[numColorComponents] * 255.0 + 0.5); + } + default: { + // awt.214=This Color Model doesn't support this transferType + throw new UnsupportedOperationException(Messages.getString("awt.214")); //$NON-NLS-1$ } - return alpha; - } - case DataBuffer.TYPE_FLOAT: { - float fa[] = (float[]) inData; - return (int) (fa[numColorComponents] * 255.0f + 0.5f); - } - case DataBuffer.TYPE_DOUBLE: { - double da[] = (double[]) inData; - return (int) (da[numColorComponents] * 255.0 + 0.5); - } - default: { - // awt.214=This Color Model doesn't support this transferType - throw new UnsupportedOperationException(Messages.getString("awt.214")); //$NON-NLS-1$ - } } } @@ -1032,14 +1047,14 @@ public class ComponentColorModel extends ColorModel { } switch (transferType) { - case DataBuffer.TYPE_BYTE: - case DataBuffer.TYPE_USHORT: - return new PixelInterleavedSampleModel(transferType, w, h, - numComponents, w * numComponents, bandOffsets); - - default: - return new ComponentSampleModel(transferType, w, h, numComponents, - w * numComponents, bandOffsets); + case DataBuffer.TYPE_BYTE: + case DataBuffer.TYPE_USHORT: + return new PixelInterleavedSampleModel(transferType, w, h, numComponents, w + * numComponents, bandOffsets); + + default: + return new ComponentSampleModel(transferType, w, h, numComponents, w + * numComponents, bandOffsets); } } @@ -1067,15 +1082,15 @@ public class ComponentColorModel extends ColorModel { } @Override - public float[] getNormalizedComponents(int components[], int offset, - float normComponents[], int normOffset) { + public float[] getNormalizedComponents(int components[], int offset, float normComponents[], + int normOffset) { if (donotSupportUnnormalized) { - // awt.213=This ComponentColorModel does not support the unnormalized form + // awt.213=This ComponentColorModel does not support the + // unnormalized form throw new IllegalArgumentException(Messages.getString("awt.213")); //$NON-NLS-1$ } - return super.getNormalizedComponents(components, offset, - normComponents, normOffset); + return super.getNormalizedComponents(components, offset, normComponents, normOffset); } @Override @@ -1085,28 +1100,30 @@ public class ComponentColorModel extends ColorModel { throw new IllegalArgumentException(Messages.getString("awt.212")); //$NON-NLS-1$ } if (donotSupportUnnormalized) { - // awt.213=This ComponentColorModel does not support the unnormalized form + // awt.213=This ComponentColorModel does not support the + // unnormalized form throw new IllegalArgumentException(Messages.getString("awt.213")); //$NON-NLS-1$ } return components[offset]; } @Override - public int[] getUnnormalizedComponents(float[] normComponents, - int normOffset, int[] components, int offset) { + public int[] getUnnormalizedComponents(float[] normComponents, int normOffset, + int[] components, int offset) { if (donotSupportUnnormalized) { - // awt.213=This ComponentColorModel does not support the unnormalized form + // awt.213=This ComponentColorModel does not support the + // unnormalized form throw new IllegalArgumentException(Messages.getString("awt.213")); //$NON-NLS-1$ } if (normComponents.length - normOffset < numComponents) { - // awt.21B=The length of normComponents minus normOffset is less than numComponents + // awt.21B=The length of normComponents minus normOffset is less + // than numComponents throw new IllegalArgumentException(Messages.getString("awt.21B")); //$NON-NLS-1$ } - return super.getUnnormalizedComponents(normComponents, normOffset, - components, offset); + return super.getUnnormalizedComponents(normComponents, normOffset, components, offset); } @Override @@ -1123,19 +1140,19 @@ public class ComponentColorModel extends ColorModel { Object pixel = getDataElements(normComponents, normOffset, null); switch (transferType) { - case DataBuffer.TYPE_BYTE: - byte ba[] = (byte[]) pixel; - return ba[0] & 0xff; - case DataBuffer.TYPE_USHORT: - short sa[] = (short[]) pixel; - return sa[0] & 0xffff; - case DataBuffer.TYPE_INT: - int ia[] = (int[]) pixel; - return ia[0]; - default: - // awt.211=Pixel values for this ColorModel are not conveniently - // representable as a single int - throw new IllegalArgumentException(Messages.getString("awt.211")); //$NON-NLS-1$ + case DataBuffer.TYPE_BYTE: + byte ba[] = (byte[])pixel; + return ba[0] & 0xff; + case DataBuffer.TYPE_USHORT: + short sa[] = (short[])pixel; + return sa[0] & 0xffff; + case DataBuffer.TYPE_INT: + int ia[] = (int[])pixel; + return ia[0]; + default: + // awt.211=Pixel values for this ColorModel are not conveniently + // representable as a single int + throw new IllegalArgumentException(Messages.getString("awt.211")); //$NON-NLS-1$ } } @@ -1146,7 +1163,8 @@ public class ComponentColorModel extends ColorModel { throw new IllegalArgumentException(Messages.getString("awt.212")); //$NON-NLS-1$ } if (donotSupportUnnormalized) { - // awt.213=This ComponentColorModel does not support the unnormalized form + // awt.213=This ComponentColorModel does not support the + // unnormalized form throw new IllegalArgumentException(Messages.getString("awt.213")); //$NON-NLS-1$ } @@ -1161,31 +1179,31 @@ public class ComponentColorModel extends ColorModel { @Override public int getRed(int pixel) { float rgb[] = toRGB(pixel); - return (int) (rgb[0] * 255.0f + 0.5f); + return (int)(rgb[0] * 255.0f + 0.5f); } @Override public int getRGB(int pixel) { - return (getAlpha(pixel) << 24) | (getRed(pixel) << 16) | - (getGreen(pixel) << 8) | getBlue(pixel); + return (getAlpha(pixel) << 24) | (getRed(pixel) << 16) | (getGreen(pixel) << 8) + | getBlue(pixel); } @Override public int getGreen(int pixel) { float rgb[] = toRGB(pixel); - return (int) (rgb[1] * 255.0f + 0.5f); + return (int)(rgb[1] * 255.0f + 0.5f); } @Override public int getBlue(int pixel) { float rgb[] = toRGB(pixel); - return (int) (rgb[2] * 255.0f + 0.5f); + return (int)(rgb[2] * 255.0f + 0.5f); } @Override public int getAlpha(int pixel) { - // This method throw IllegalArgumentException according to + // This method throw IllegalArgumentException according to // Java API Spacification if (signed) { // awt.210=The component value for this ColorModel is signed @@ -1210,24 +1228,19 @@ public class ComponentColorModel extends ColorModel { if (hasAlpha && bits[numColorComponents] != 8 && integral) { alphaLUT = new byte[maxValues[numColorComponents] + 1]; for (int i = 0; i <= maxValues[numColorComponents]; i++) { - alphaLUT[i] = (byte) (scaleFactors[numColorComponents] * i + - 0.5f); + alphaLUT[i] = (byte)(scaleFactors[numColorComponents] * i + 0.5f); } } if (is_LINEAR_RGB) { if (maxBitLength > 8) { LINEAR_RGB_Length = 16; - from_LINEAR_RGB_LUT = - LUTColorConverter.getFrom16lRGBtosRGB_LUT(); - to_LINEAR_16RGB_LUT = - LUTColorConverter.getFromsRGBto16lRGB_LUT(); + from_LINEAR_RGB_LUT = LUTColorConverter.getFrom16lRGBtosRGB_LUT(); + to_LINEAR_16RGB_LUT = LUTColorConverter.getFromsRGBto16lRGB_LUT(); } else { LINEAR_RGB_Length = 8; - from_LINEAR_RGB_LUT = - LUTColorConverter.getFrom8lRGBtosRGB_LUT(); - to_LINEAR_8RGB_LUT = - LUTColorConverter.getFromsRGBto8lRGB_LUT(); + from_LINEAR_RGB_LUT = LUTColorConverter.getFrom8lRGBtosRGB_LUT(); + to_LINEAR_8RGB_LUT = LUTColorConverter.getFromsRGBto8lRGB_LUT(); } fFactor = ((1 << LINEAR_RGB_Length) - 1); } else { @@ -1248,8 +1261,7 @@ public class ComponentColorModel extends ColorModel { } colorLUTs[i] = new byte[maxValues[i] + 1]; for (int j = 0; j <= maxValues[0]; j++) { - colorLUTs[i][j] = - (byte) (scaleFactors[i] * j + 0.5f); + colorLUTs[i][j] = (byte)(scaleFactors[i] * j + 0.5f); } } } @@ -1269,10 +1281,9 @@ public class ComponentColorModel extends ColorModel { for (int j = 0; j <= maxValues[0]; j++) { int idx; if (LINEAR_RGB_Length == 8) { - idx = (int) (scaleFactors[i] * j + 0.5f); + idx = (int)(scaleFactors[i] * j + 0.5f); } else { - idx = (int) (scaleFactors[i] * j * 257.0f + - 0.5f); + idx = (int)(scaleFactors[i] * j * 257.0f + 0.5f); } colorLUTs[i][j] = from_LINEAR_RGB_LUT[idx]; } @@ -1286,13 +1297,13 @@ public class ComponentColorModel extends ColorModel { /** * To rgb. * - * @param pixel - int representation of pixel - * - * @return - array of normalized sRGB components + * @param pixel + * the integer representation of the pixel. + * @return the array of normalized sRGB components. */ private float[] toRGB(int pixel) { - - // This method throw IllegalArgumentException according to + + // This method throw IllegalArgumentException according to // Java API Spacification if (signed) { // awt.210=The component value for this ColorModel is signed @@ -1307,23 +1318,23 @@ public class ComponentColorModel extends ColorModel { Object obj = null; switch (transferType) { - case DataBuffer.TYPE_BYTE: - byte ba[] = new byte[1]; - ba[0] = (byte) pixel; - obj = ba; - break; - - case DataBuffer.TYPE_USHORT: - short sa[] = new short[1]; - sa[0] = (short) pixel; - obj = sa; - break; - - case DataBuffer.TYPE_INT: - int ia[] = new int[1]; - ia[0] = pixel; - obj = ia; - break; + case DataBuffer.TYPE_BYTE: + byte ba[] = new byte[1]; + ba[0] = (byte)pixel; + obj = ba; + break; + + case DataBuffer.TYPE_USHORT: + short sa[] = new short[1]; + sa[0] = (short)pixel; + obj = sa; + break; + + case DataBuffer.TYPE_INT: + int ia[] = new int[1]; + ia[0] = pixel; + obj = ia; + break; } @@ -1331,12 +1342,13 @@ public class ComponentColorModel extends ColorModel { } /** - * Gets the rgb component. + * Gets the RGB component. * - * @param pixel - pixel - * @param idx - index of component - * - * @return - RGB value from 0 to 255 pixel's component + * @param pixel + * the pixel. + * @param idx + * the index of component. + * @return the RGB value from 0 to 255 pixel's component. */ private int getRGBComponent(Object pixel, int idx) { if (is_sRGB) { @@ -1355,117 +1367,116 @@ public class ComponentColorModel extends ColorModel { float normComp[] = getNormalizedComponents(pixel, null, 0); float rgbComp[] = cs.toRGB(normComp); - return (int) (rgbComp[idx] * 255.0f + 0.5f); + return (int)(rgbComp[idx] * 255.0f + 0.5f); } /** * Gets the def component. * - * @param pixel - pixel - * @param idx - index of component - * - * @return - tentative value of the pixel component + * @param pixel + * the pixel. + * @param idx + * the index of component. + * @return the tentative value of the pixel component. */ private int getDefComponent(Object pixel, int idx) { int comp = 0; calcValue = false; switch (transferType) { - case DataBuffer.TYPE_BYTE: - byte ba[] = (byte[]) pixel; - comp = ba[idx] & 0xff; - if (needAlphaDivide) { - int alpha = ba[numColorComponents] & 0xff; - if (alpha == 0) { - comp = 0; - } else { - float normAlpha = scaleFactors[numColorComponents] * alpha; - comp = (int) (comp * fFactor / normAlpha + 0.5f); + case DataBuffer.TYPE_BYTE: + byte ba[] = (byte[])pixel; + comp = ba[idx] & 0xff; + if (needAlphaDivide) { + int alpha = ba[numColorComponents] & 0xff; + if (alpha == 0) { + comp = 0; + } else { + float normAlpha = scaleFactors[numColorComponents] * alpha; + comp = (int)(comp * fFactor / normAlpha + 0.5f); + } + calcValue = true; } - calcValue = true; - } - return comp; - - case DataBuffer.TYPE_USHORT: - short usa[] = (short[]) pixel; - comp = usa[idx] & 0xffff; - if (needAlphaDivide) { - int alpha = usa[numColorComponents] & 0xffff; - if (alpha == 0) { - comp = 0; - } else { - float normAlpha = scaleFactors[numColorComponents] * alpha; - comp = (int) (comp * fFactor / normAlpha + 0.5f); + return comp; + + case DataBuffer.TYPE_USHORT: + short usa[] = (short[])pixel; + comp = usa[idx] & 0xffff; + if (needAlphaDivide) { + int alpha = usa[numColorComponents] & 0xffff; + if (alpha == 0) { + comp = 0; + } else { + float normAlpha = scaleFactors[numColorComponents] * alpha; + comp = (int)(comp * fFactor / normAlpha + 0.5f); + } + calcValue = true; } - calcValue = true; - } - return comp; - - case DataBuffer.TYPE_INT: - int ia[] = (int[]) pixel; - comp = ia[idx]; - if (needAlphaDivide) { - int alpha = ia[numColorComponents]; - if (alpha == 0) { - comp = 0; - } else { - float normAlpha = scaleFactors[numColorComponents] * alpha; - comp = (int) (comp * fFactor / normAlpha + 0.5f); + return comp; + + case DataBuffer.TYPE_INT: + int ia[] = (int[])pixel; + comp = ia[idx]; + if (needAlphaDivide) { + int alpha = ia[numColorComponents]; + if (alpha == 0) { + comp = 0; + } else { + float normAlpha = scaleFactors[numColorComponents] * alpha; + comp = (int)(comp * fFactor / normAlpha + 0.5f); + } + calcValue = true; } - calcValue = true; - } - return comp; - - case DataBuffer.TYPE_SHORT: - short sa[] = (short[]) pixel; - comp = sa[idx]; - if (needAlphaDivide) { - int alpha = sa[numColorComponents]; - if (alpha == 0) { - comp = 0; - } else { - float normAlpha = scaleFactors[numColorComponents] * alpha; - comp = (int) (comp * fFactor / normAlpha + 0.5f); + return comp; + + case DataBuffer.TYPE_SHORT: + short sa[] = (short[])pixel; + comp = sa[idx]; + if (needAlphaDivide) { + int alpha = sa[numColorComponents]; + if (alpha == 0) { + comp = 0; + } else { + float normAlpha = scaleFactors[numColorComponents] * alpha; + comp = (int)(comp * fFactor / normAlpha + 0.5f); + } + calcValue = true; } - calcValue = true; - } - return comp; - - case DataBuffer.TYPE_FLOAT: - float fa[] = (float[]) pixel; - if (needAlphaDivide) { - float alpha = fa[numColorComponents]; - if (fa[numColorComponents] == 0.0f) { - comp = 0; + return comp; + + case DataBuffer.TYPE_FLOAT: + float fa[] = (float[])pixel; + if (needAlphaDivide) { + float alpha = fa[numColorComponents]; + if (fa[numColorComponents] == 0.0f) { + comp = 0; + } else { + comp = (int)(fa[idx] * fFactor / alpha + 0.5f); + } } else { - comp = (int) (fa[idx] * fFactor / alpha + 0.5f); + comp = (int)(fa[idx] * fFactor + 0.5f); } - } else { - comp = (int) (fa[idx] * fFactor + 0.5f); - } - calcValue = true; - return comp; - - case DataBuffer.TYPE_DOUBLE: - double da[] = (double[]) pixel; - if (needAlphaDivide) { - if (da[numColorComponents] == 0.0) { - comp = 0; + calcValue = true; + return comp; + + case DataBuffer.TYPE_DOUBLE: + double da[] = (double[])pixel; + if (needAlphaDivide) { + if (da[numColorComponents] == 0.0) { + comp = 0; + } else { + comp = (int)(da[idx] * fFactor / da[numColorComponents] + 0.5); + } } else { - comp = (int) (da[idx] * fFactor / da[numColorComponents] + - 0.5); + comp = (int)(da[idx] * fFactor + 0.5); } - } else { - comp = (int) (da[idx] * fFactor + 0.5); - } - calcValue = true; - return comp; + calcValue = true; + return comp; - default: - // awt.214=This Color Model doesn't support this transferType - throw new UnsupportedOperationException(Messages.getString("awt.214")); //$NON-NLS-1$ + default: + // awt.214=This Color Model doesn't support this transferType + throw new UnsupportedOperationException(Messages.getString("awt.214")); //$NON-NLS-1$ } } } - diff --git a/awt/java/awt/image/ComponentSampleModel.java b/awt/java/awt/image/ComponentSampleModel.java index 2ff4f1a2b213a..7f8140918deab 100644 --- a/awt/java/awt/image/ComponentSampleModel.java +++ b/awt/java/awt/image/ComponentSampleModel.java @@ -18,6 +18,7 @@ * @author Igor V. Stolyarov * @version $Revision$ */ + package java.awt.image; import java.util.Arrays; @@ -25,55 +26,73 @@ import java.util.Arrays; import org.apache.harmony.awt.internal.nls.Messages; /** - * The ComponentSampleModel class represents a set of image data whose - * each element - the sample of a pixel - takes one data element of - * the DataBuffer. + * The ComponentSampleModel class represents a set of image data whose each + * element - the sample of a pixel - takes one data element of the DataBuffer. *

    - * The Bank indices denote the correspondence between the bank of data - * buffers and a band of image data. The Pixel stride is the number of data - * array elements between two samples for the same band on the same - * scanline. The pixel stride for a BandedSampleModel is one. The Scanline - * stride represents the number of data array elements between a - * specified sample and the corresponding sample in the same column in - * the next scanline. The array of band offsets gives the starting - * offsets within each data banks of the in the DataBuffer. The bank - * indices represents the indices within each bank of the DataBuffer - * corresponding to a band of image data. + * The Bank indices denote the correspondence between the bank of data buffers + * and a band of image data. The Pixel stride is the number of data array + * elements between two samples for the same band on the same scanline. The + * pixel stride for a BandedSampleModel is one. The scanline stride represents + * the number of data array elements between a specified sample and the + * corresponding sample in the same column in the next scanline. The array of + * band offsets gives the starting offsets within each data banks of the in the + * DataBuffer. The bank indices represents the indices within each bank of the + * DataBuffer corresponding to a band of image data. + * + * @since Android 1.0 */ public class ComponentSampleModel extends SampleModel { - /** The band offsets array of this ComponentSampleModel. */ + /** + * The band offsets array of this ComponentSampleModel. + */ protected int bandOffsets[]; - /** The bank indices array of this ComponentSampleModel. */ + /** + * The bank indices array of this ComponentSampleModel. + */ protected int bankIndices[]; - /** The number of bands in this ComponentSampleModel. */ + /** + * The number of bands in this ComponentSampleModel. + */ protected int numBands; - /** The number banks of this ComponentSampleModel. */ + /** + * The number banks of this ComponentSampleModel. + */ protected int numBanks; - /** The scanline stride of this ComponentSampleModel. */ + /** + * The scanline stride of this ComponentSampleModel. + */ protected int scanlineStride; - /** The pixel stride of this ComponentSampleModel. */ + /** + * The pixel stride of this ComponentSampleModel. + */ protected int pixelStride; /** - * Instantiates a new ComponentSampleModel with the specified - * properties. + * Instantiates a new ComponentSampleModel with the specified properties. * - * @param dataType the data type of samples. - * @param w the width of the image data. - * @param h the height of the image data. - * @param pixelStride the pixel stride of the image data. - * @param scanlineStride the scanline stride of the image data. - * @param bankIndices the array of the bank indices. - * @param bandOffsets the array of the band offsets. + * @param dataType + * the data type of samples. + * @param w + * the width of the image data. + * @param h + * the height of the image data. + * @param pixelStride + * the pixel stride of the image data. + * @param scanlineStride + * the scanline stride of the image data. + * @param bankIndices + * the array of the bank indices. + * @param bandOffsets + * the array of the band offsets. */ - public ComponentSampleModel(int dataType, int w, int h, int pixelStride, - int scanlineStride, int bankIndices[], int bandOffsets[]) { + public ComponentSampleModel(int dataType, int w, int h, int pixelStride, int scanlineStride, + int bankIndices[], int bandOffsets[]) { super(dataType, w, h, bandOffsets.length); @@ -113,18 +132,23 @@ public class ComponentSampleModel extends SampleModel { } /** - * Instantiates a new ComponentSampleModel with the specified - * properties. + * Instantiates a new ComponentSampleModel with the specified properties. * - * @param dataType the data type of the samples. - * @param w the width of the image data. - * @param h the height of the image data. - * @param pixelStride the pixel stride of the image data. - * @param scanlineStride the scanline stride of the image data. - * @param bandOffsets the band offsets. + * @param dataType + * the data type of the samples. + * @param w + * the width of the image data. + * @param h + * the height of the image data. + * @param pixelStride + * the pixel stride of the image data. + * @param scanlineStride + * the scanline stride of the image data. + * @param bandOffsets + * the band offsets. */ - public ComponentSampleModel(int dataType, int w, int h, int pixelStride, - int scanlineStride, int bandOffsets[]) { + public ComponentSampleModel(int dataType, int w, int h, int pixelStride, int scanlineStride, + int bandOffsets[]) { super(dataType, w, h, bandOffsets.length); if (pixelStride < 0) { @@ -156,81 +180,81 @@ public class ComponentSampleModel extends SampleModel { throw new ArrayIndexOutOfBoundsException(Messages.getString("awt.63")); //$NON-NLS-1$ } switch (dataType) { - case DataBuffer.TYPE_BYTE: - byte bdata[]; - if (obj == null) { - bdata = new byte[numBands]; - } else { - bdata = (byte[]) obj; - } + case DataBuffer.TYPE_BYTE: + byte bdata[]; + if (obj == null) { + bdata = new byte[numBands]; + } else { + bdata = (byte[])obj; + } - for (int i = 0; i < numBands; i++) { - bdata[i] = (byte) getSample(x, y, i, data); - } + for (int i = 0; i < numBands; i++) { + bdata[i] = (byte)getSample(x, y, i, data); + } - obj = bdata; - break; + obj = bdata; + break; - case DataBuffer.TYPE_SHORT: - case DataBuffer.TYPE_USHORT: - short sdata[]; - if (obj == null) { - sdata = new short[numBands]; - } else { - sdata = (short[]) obj; - } + case DataBuffer.TYPE_SHORT: + case DataBuffer.TYPE_USHORT: + short sdata[]; + if (obj == null) { + sdata = new short[numBands]; + } else { + sdata = (short[])obj; + } - for (int i = 0; i < numBands; i++) { - sdata[i] = (short) getSample(x, y, i, data); - } + for (int i = 0; i < numBands; i++) { + sdata[i] = (short)getSample(x, y, i, data); + } - obj = sdata; - break; + obj = sdata; + break; - case DataBuffer.TYPE_INT: - int idata[]; - if (obj == null) { - idata = new int[numBands]; - } else { - idata = (int[]) obj; - } + case DataBuffer.TYPE_INT: + int idata[]; + if (obj == null) { + idata = new int[numBands]; + } else { + idata = (int[])obj; + } - for (int i = 0; i < numBands; i++) { - idata[i] = getSample(x, y, i, data); - } + for (int i = 0; i < numBands; i++) { + idata[i] = getSample(x, y, i, data); + } - obj = idata; - break; + obj = idata; + break; - case DataBuffer.TYPE_FLOAT: - float fdata[]; - if (obj == null) { - fdata = new float[numBands]; - } else { - fdata = (float[]) obj; - } + case DataBuffer.TYPE_FLOAT: + float fdata[]; + if (obj == null) { + fdata = new float[numBands]; + } else { + fdata = (float[])obj; + } - for (int i = 0; i < numBands; i++) { - fdata[i] = getSampleFloat(x, y, i, data); - } + for (int i = 0; i < numBands; i++) { + fdata[i] = getSampleFloat(x, y, i, data); + } - obj = fdata; - break; + obj = fdata; + break; - case DataBuffer.TYPE_DOUBLE: - double ddata[]; - if (obj == null) { - ddata = new double[numBands]; - } else { - ddata = (double[]) obj; - } + case DataBuffer.TYPE_DOUBLE: + double ddata[]; + if (obj == null) { + ddata = new double[numBands]; + } else { + ddata = (double[])obj; + } - for (int i = 0; i < numBands; i++) { - ddata[i] = getSampleDouble(x, y, i, data); - } + for (int i = 0; i < numBands; i++) { + ddata[i] = getSampleDouble(x, y, i, data); + } - obj = ddata; - break; + obj = ddata; + break; } return obj; @@ -243,76 +267,75 @@ public class ComponentSampleModel extends SampleModel { throw new ArrayIndexOutOfBoundsException(Messages.getString("awt.63")); //$NON-NLS-1$ } switch (dataType) { - case DataBuffer.TYPE_BYTE: - byte barr[] = (byte[]) obj; - for (int i = 0; i < numBands; i++) { - setSample(x, y, i, barr[i] & 0xff, data); - } - break; + case DataBuffer.TYPE_BYTE: + byte barr[] = (byte[])obj; + for (int i = 0; i < numBands; i++) { + setSample(x, y, i, barr[i] & 0xff, data); + } + break; - case DataBuffer.TYPE_SHORT: - case DataBuffer.TYPE_USHORT: - short sarr[] = (short[]) obj; - for (int i = 0; i < numBands; i++) { - setSample(x, y, i, sarr[i] & 0xffff, data); - } - break; + case DataBuffer.TYPE_SHORT: + case DataBuffer.TYPE_USHORT: + short sarr[] = (short[])obj; + for (int i = 0; i < numBands; i++) { + setSample(x, y, i, sarr[i] & 0xffff, data); + } + break; - case DataBuffer.TYPE_INT: - int iarr[] = (int[]) obj; - for (int i = 0; i < numBands; i++) { - setSample(x, y, i, iarr[i], data); - } - break; + case DataBuffer.TYPE_INT: + int iarr[] = (int[])obj; + for (int i = 0; i < numBands; i++) { + setSample(x, y, i, iarr[i], data); + } + break; - case DataBuffer.TYPE_FLOAT: - float farr[] = (float[]) obj; - for (int i = 0; i < numBands; i++) { - setSample(x, y, i, farr[i], data); - } - break; + case DataBuffer.TYPE_FLOAT: + float farr[] = (float[])obj; + for (int i = 0; i < numBands; i++) { + setSample(x, y, i, farr[i], data); + } + break; - case DataBuffer.TYPE_DOUBLE: - double darr[] = (double[]) obj; - for (int i = 0; i < numBands; i++) { - setSample(x, y, i, darr[i], data); - } - break; + case DataBuffer.TYPE_DOUBLE: + double darr[] = (double[])obj; + for (int i = 0; i < numBands; i++) { + setSample(x, y, i, darr[i], data); + } + break; } } /** * Compares this ComponentSampleModel with the specified Object. * - * @param o the Object. - * - * @return true, if the object is a ComponentSampleModel with - * identical data values to this ComponentSampleModel, false otherwise. + * @param o + * the Object. + * @return true, if the object is a ComponentSampleModel with identical data + * values to this ComponentSampleModel, false otherwise. */ @Override public boolean equals(Object o) { if ((o == null) || !(o instanceof ComponentSampleModel)) { return false; } - ComponentSampleModel model = (ComponentSampleModel) o; - return this.width == model.width && this.height == model.height && - this.numBands == model.numBands && - this.dataType == model.dataType && - Arrays.equals(this.bandOffsets, model.bandOffsets) && - Arrays.equals(this.bankIndices, model.bankIndices) && - this.numBands == model.numBands && - this.numBanks == model.numBanks && - this.scanlineStride == model.scanlineStride && - this.pixelStride == model.pixelStride; + ComponentSampleModel model = (ComponentSampleModel)o; + return this.width == model.width && this.height == model.height + && this.numBands == model.numBands && this.dataType == model.dataType + && Arrays.equals(this.bandOffsets, model.bandOffsets) + && Arrays.equals(this.bankIndices, model.bankIndices) + && this.numBands == model.numBands && this.numBanks == model.numBanks + && this.scanlineStride == model.scanlineStride + && this.pixelStride == model.pixelStride; } - /** + /** * @see java.awt.image.SampleModel#createSubsetSampleModel(int[]) */ @Override public SampleModel createSubsetSampleModel(int bands[]) { if (bands.length > this.numBands) { - // awt.64=The number of the bands in the subset is greater than the number of bands in the sample model + // awt.64=The number of the bands in the subset is greater than the + // number of bands in the sample model throw new RasterFormatException(Messages.getString("awt.64")); //$NON-NLS-1$ } @@ -324,15 +347,15 @@ public class ComponentSampleModel extends SampleModel { offsets[i] = bandOffsets[bands[i]]; } - return new ComponentSampleModel(dataType, width, height, pixelStride, - scanlineStride, indices, offsets); + return new ComponentSampleModel(dataType, width, height, pixelStride, scanlineStride, + indices, offsets); } @Override public SampleModel createCompatibleSampleModel(int w, int h) { - return new ComponentSampleModel(dataType, w, h, pixelStride, - pixelStride * w, bankIndices, bandOffsets); + return new ComponentSampleModel(dataType, w, h, pixelStride, pixelStride * w, bankIndices, + bandOffsets); } @Override @@ -366,8 +389,7 @@ public class ComponentSampleModel extends SampleModel { throw new ArrayIndexOutOfBoundsException(Messages.getString("awt.63")); //$NON-NLS-1$ } - return data.getElem(bankIndices[b], y * scanlineStride + - x * pixelStride + bandOffsets[b]); + return data.getElem(bankIndices[b], y * scanlineStride + x * pixelStride + bandOffsets[b]); } @Override @@ -377,8 +399,8 @@ public class ComponentSampleModel extends SampleModel { throw new ArrayIndexOutOfBoundsException(Messages.getString("awt.63")); //$NON-NLS-1$ } - return data.getElemFloat(bankIndices[b], y * scanlineStride + - x * pixelStride + bandOffsets[b]); + return data.getElemFloat(bankIndices[b], y * scanlineStride + x * pixelStride + + bandOffsets[b]); } @Override @@ -388,15 +410,14 @@ public class ComponentSampleModel extends SampleModel { throw new ArrayIndexOutOfBoundsException(Messages.getString("awt.63")); //$NON-NLS-1$ } - return data.getElemDouble(bankIndices[b], y * scanlineStride + - x * pixelStride + bandOffsets[b]); + return data.getElemDouble(bankIndices[b], y * scanlineStride + x * pixelStride + + bandOffsets[b]); } @Override - public int[] getPixels(int x, int y, int w, int h, int iArray[], - DataBuffer data) { - if (x < 0 || y < 0 || x > this.width || x + w > this.width - || y > this.height || y + h > this.height) { + public int[] getPixels(int x, int y, int w, int h, int iArray[], DataBuffer data) { + if (x < 0 || y < 0 || x > this.width || x + w > this.width || y > this.height + || y + h > this.height) { // awt.63=Coordinates are not in bounds throw new ArrayIndexOutOfBoundsException(Messages.getString("awt.63")); //$NON-NLS-1$ } @@ -421,8 +442,7 @@ public class ComponentSampleModel extends SampleModel { } @Override - public void setPixels(int x, int y, int w, int h, int iArray[], - DataBuffer data) { + public void setPixels(int x, int y, int w, int h, int iArray[], DataBuffer data) { if (x < 0 || y < 0 || x + w > this.width || y + h > this.height) { // awt.63=Coordinates are not in bounds throw new ArrayIndexOutOfBoundsException(Messages.getString("awt.63")); //$NON-NLS-1$ @@ -444,13 +464,11 @@ public class ComponentSampleModel extends SampleModel { throw new ArrayIndexOutOfBoundsException(Messages.getString("awt.63")); //$NON-NLS-1$ } - data.setElem(bankIndices[b], y * scanlineStride + x * pixelStride - + bandOffsets[b], s); + data.setElem(bankIndices[b], y * scanlineStride + x * pixelStride + bandOffsets[b], s); } @Override - public int[] getSamples(int x, int y, int w, int h, int b, int iArray[], - DataBuffer data) { + public int[] getSamples(int x, int y, int w, int h, int b, int iArray[], DataBuffer data) { if (x < 0 || y < 0 || x + w > this.width || y + h > this.height) { // awt.63=Coordinates are not in bounds throw new ArrayIndexOutOfBoundsException(Messages.getString("awt.63")); //$NON-NLS-1$ @@ -463,7 +481,7 @@ public class ComponentSampleModel extends SampleModel { } else { samples = iArray; } - + if (data == null) { // awt.295=data is null throw new NullPointerException(Messages.getString("awt.295")); //$NON-NLS-1$ @@ -479,8 +497,7 @@ public class ComponentSampleModel extends SampleModel { } @Override - public void setSamples(int x, int y, int w, int h, int b, int iArray[], - DataBuffer data) { + public void setSamples(int x, int y, int w, int h, int b, int iArray[], DataBuffer data) { if (x < 0 || y < 0 || x + w > this.width || y + h > this.height) { // awt.63=Coordinates are not in bounds throw new ArrayIndexOutOfBoundsException(Messages.getString("awt.63")); //$NON-NLS-1$ @@ -500,8 +517,7 @@ public class ComponentSampleModel extends SampleModel { throw new ArrayIndexOutOfBoundsException(Messages.getString("awt.63")); //$NON-NLS-1$ } - data.setElemFloat(bankIndices[b], y * scanlineStride + - x * pixelStride + bandOffsets[b], s); + data.setElemFloat(bankIndices[b], y * scanlineStride + x * pixelStride + bandOffsets[b], s); } @Override @@ -511,8 +527,9 @@ public class ComponentSampleModel extends SampleModel { throw new ArrayIndexOutOfBoundsException(Messages.getString("awt.63")); //$NON-NLS-1$ } - data.setElemDouble(bankIndices[b], y * scanlineStride + - x * pixelStride + bandOffsets[b], s); + data + .setElemDouble(bankIndices[b], y * scanlineStride + x * pixelStride + + bandOffsets[b], s); } @Override @@ -525,28 +542,27 @@ public class ComponentSampleModel extends SampleModel { maxOffset = bandOffsets[i]; } } - int size = (height - 1) * scanlineStride + - (width - 1) * pixelStride + maxOffset + 1; + int size = (height - 1) * scanlineStride + (width - 1) * pixelStride + maxOffset + 1; switch (dataType) { - case DataBuffer.TYPE_BYTE: - data = new DataBufferByte(size, numBanks); - break; - case DataBuffer.TYPE_SHORT: - data = new DataBufferShort(size, numBanks); - break; - case DataBuffer.TYPE_USHORT: - data = new DataBufferUShort(size, numBanks); - break; - case DataBuffer.TYPE_INT: - data = new DataBufferInt(size, numBanks); - break; - case DataBuffer.TYPE_FLOAT: - data = new DataBufferFloat(size, numBanks); - break; - case DataBuffer.TYPE_DOUBLE: - data = new DataBufferDouble(size, numBanks); - break; + case DataBuffer.TYPE_BYTE: + data = new DataBufferByte(size, numBanks); + break; + case DataBuffer.TYPE_SHORT: + data = new DataBufferShort(size, numBanks); + break; + case DataBuffer.TYPE_USHORT: + data = new DataBufferUShort(size, numBanks); + break; + case DataBuffer.TYPE_INT: + data = new DataBufferInt(size, numBanks); + break; + case DataBuffer.TYPE_FLOAT: + data = new DataBufferFloat(size, numBanks); + break; + case DataBuffer.TYPE_DOUBLE: + data = new DataBufferDouble(size, numBanks); + break; } return data; @@ -556,10 +572,12 @@ public class ComponentSampleModel extends SampleModel { /** * Gets the offset of the specified band of the specified pixel. * - * @param x the X coordinate of the pixel. - * @param y the Y coordinate of the pixel. - * @param b the band. - * + * @param x + * the X coordinate of the pixel. + * @param y + * the Y coordinate of the pixel. + * @param b + * the band. * @return the offset of the specified band of the specified pixel. */ public int getOffset(int x, int y, int b) { @@ -569,9 +587,10 @@ public class ComponentSampleModel extends SampleModel { /** * Gets the offset of the first band of the specified pixel. * - * @param x the X coordinate of pixel. - * @param y the Y coordinate of pixel. - * + * @param x + * the X coordinate of pixel. + * @param y + * the Y coordinate of pixel. * @return the offset of the first band of the specified pixel. */ public int getOffset(int x, int y) { @@ -595,8 +614,7 @@ public class ComponentSampleModel extends SampleModel { } /** - * Gets an array of bank indices corresponding to this - * ComponentSampleModel. + * Gets an array of bank indices corresponding to this ComponentSampleModel. * * @return the array of bank indices. */ @@ -605,7 +623,7 @@ public class ComponentSampleModel extends SampleModel { } /** - * Gets an array of the band offsets corresponding to this + * Gets an array of the band offsets corresponding to this * ComponentSampleModel. * * @return the array of band offsets. @@ -673,7 +691,7 @@ public class ComponentSampleModel extends SampleModel { /** * Gets the pixel stride. * - * @return the pixel stride + * @return the pixel stride. */ public final int getPixelStride() { return pixelStride; @@ -685,6 +703,3 @@ public class ComponentSampleModel extends SampleModel { } } - - - diff --git a/awt/java/awt/image/ConvolveOp.java b/awt/java/awt/image/ConvolveOp.java index bb588bcdbbb24..6eb8909b81057 100644 --- a/awt/java/awt/image/ConvolveOp.java +++ b/awt/java/awt/image/ConvolveOp.java @@ -32,47 +32,57 @@ import org.apache.harmony.awt.gl.AwtImageBackdoorAccessor; import org.apache.harmony.awt.internal.nls.Messages; /** - * The ConvolveOp class convolves from the source data - * to the destination using a convolution kernel. - * Each output pixel is represented as the result of multiplying - * the kernel and the surround of the input pixel. + * The ConvolveOp class convolves from the source data to the destination using + * a convolution kernel. Each output pixel is represented as the result of + * multiplying the kernel and the surround of the input pixel. + * + * @since Android 1.0 */ public class ConvolveOp implements BufferedImageOp, RasterOp { - /** - * The Constant EDGE_ZERO_FILL indicates that pixels at the edge of - * the destination image are set to zero. + /** + * The Constant EDGE_ZERO_FILL indicates that pixels at the edge of the + * destination image are set to zero. */ public static final int EDGE_ZERO_FILL = 0; - /** - * The Constant EDGE_NO_OP indicates that pixels at the edge of - * the source image are converted to the edge pixels in the - * destination without modification. + /** + * The Constant EDGE_NO_OP indicates that pixels at the edge of the source + * image are converted to the edge pixels in the destination without + * modification. */ public static final int EDGE_NO_OP = 1; - /** The kernel. */ + /** + * The kernel. + */ private Kernel kernel; - - /** The edge cond. */ + + /** + * The edge cond. + */ private int edgeCond; - - /** The rhs. */ + + /** + * The rhs. + */ private RenderingHints rhs = null; static { // TODO - //System.loadLibrary("imageops"); + // System.loadLibrary("imageops"); } /** - * Instantiates a new ConvolveOp object with the specified Kernel - * and specified edges condition. + * Instantiates a new ConvolveOp object with the specified Kernel and + * specified edges condition. * - * @param kernel the specified Kernel. - * @param edgeCondition the specified edge condition. - * @param hints the RenderingHints object, or null. + * @param kernel + * the specified Kernel. + * @param edgeCondition + * the specified edge condition. + * @param hints + * the RenderingHints object, or null. */ public ConvolveOp(Kernel kernel, int edgeCondition, RenderingHints hints) { this.kernel = kernel; @@ -81,10 +91,11 @@ public class ConvolveOp implements BufferedImageOp, RasterOp { } /** - * Instantiates a new ConvolveOp object with the specified Kernel - * and EDGE_ZERO_FILL edge condition. + * Instantiates a new ConvolveOp object with the specified Kernel and + * EDGE_ZERO_FILL edge condition. * - * @param kernel the specified Kernel. + * @param kernel + * the specified Kernel. */ public ConvolveOp(Kernel kernel) { this.kernel = kernel; @@ -97,7 +108,7 @@ public class ConvolveOp implements BufferedImageOp, RasterOp { * @return the Kernel object of this ConvolveOp. */ public final Kernel getKernel() { - return (Kernel) kernel.clone(); + return (Kernel)kernel.clone(); } public final RenderingHints getRenderingHints() { @@ -143,17 +154,11 @@ public class ConvolveOp implements BufferedImageOp, RasterOp { dstCM = ColorModel.getRGBdefault(); } - WritableRaster r = - dstCM.isCompatibleSampleModel(src.getSampleModel()) ? - src.getRaster().createCompatibleWritableRaster(src.getWidth(), src.getHeight()) : - dstCM.createCompatibleWritableRaster(src.getWidth(), src.getHeight()); - - return new BufferedImage( - dstCM, - r, - dstCM.isAlphaPremultiplied(), - null - ); + WritableRaster r = dstCM.isCompatibleSampleModel(src.getSampleModel()) ? src.getRaster() + .createCompatibleWritableRaster(src.getWidth(), src.getHeight()) : dstCM + .createCompatibleWritableRaster(src.getWidth(), src.getHeight()); + + return new BufferedImage(dstCM, r, dstCM.isAlphaPremultiplied(), null); } public final WritableRaster filter(Raster src, WritableRaster dst) { @@ -162,7 +167,7 @@ public class ConvolveOp implements BufferedImageOp, RasterOp { throw new NullPointerException(Messages.getString("awt.256")); //$NON-NLS-1$ } - if (src == dst){ + if (src == dst) { // awt.257=Source raster is equal to destination throw new IllegalArgumentException(Messages.getString("awt.257")); //$NON-NLS-1$ } @@ -170,17 +175,18 @@ public class ConvolveOp implements BufferedImageOp, RasterOp { if (dst == null) { dst = createCompatibleDestRaster(src); } else if (src.getNumBands() != dst.getNumBands()) { - // awt.258=Number of source bands ({0}) is not equal to number of destination bands ({1}) - throw new IllegalArgumentException( - Messages.getString("awt.258", src.getNumBands(), dst.getNumBands())); //$NON-NLS-1$ + // awt.258=Number of source bands ({0}) is not equal to number of + // destination bands ({1}) + throw new IllegalArgumentException(Messages.getString( + "awt.258", src.getNumBands(), dst.getNumBands())); //$NON-NLS-1$ } // TODO - //if (ippFilter(src, dst, BufferedImage.TYPE_CUSTOM) != 0) - if (slowFilter(src, dst) != 0) { - // awt.21F=Unable to transform source - throw new ImagingOpException (Messages.getString("awt.21F")); //$NON-NLS-1$ - } + // if (ippFilter(src, dst, BufferedImage.TYPE_CUSTOM) != 0) + if (slowFilter(src, dst) != 0) { + // awt.21F=Unable to transform source + throw new ImagingOpException(Messages.getString("awt.21F")); //$NON-NLS-1$ + } return dst; } @@ -188,10 +194,11 @@ public class ConvolveOp implements BufferedImageOp, RasterOp { /** * Slow filter. * - * @param src the src - * @param dst the dst - * - * @return the int + * @param src + * the src. + * @param dst + * the dst. + * @return the int. */ private int slowFilter(Raster src, WritableRaster dst) { try { @@ -219,7 +226,7 @@ public class ConvolveOp implements BufferedImageOp, RasterOp { int[] masks = new int[numBands]; int[] sampleSizes = sm.getSampleSize(); - for (int i=0; i < numBands; i++){ + for (int i = 0; i < numBands; i++) { maxValues[i] = (1 << sampleSizes[i]) - 1; masks[i] = ~(maxValues[i]); } @@ -228,61 +235,56 @@ public class ConvolveOp implements BufferedImageOp, RasterOp { float[] pixels = null; pixels = src.getPixels(srcMinX, srcMinY, srcWidth, srcHeight, pixels); float[] newPixels = new float[pixels.length]; - int rowLength = srcWidth*numBands; - if (this.edgeCond == ConvolveOp.EDGE_NO_OP){ + int rowLength = srcWidth * numBands; + if (this.edgeCond == ConvolveOp.EDGE_NO_OP) { // top int start = 0; - int length = yOrigin*rowLength; + int length = yOrigin * rowLength; System.arraycopy(pixels, start, newPixels, start, length); // bottom - start = (srcHeight - (kHeight - yOrigin - 1))*rowLength; - length = (kHeight - yOrigin - 1)*rowLength; + start = (srcHeight - (kHeight - yOrigin - 1)) * rowLength; + length = (kHeight - yOrigin - 1) * rowLength; System.arraycopy(pixels, start, newPixels, start, length); // middle - length = xOrigin*numBands; - int length1 = (kWidth - xOrigin - 1)*numBands; - start = yOrigin*rowLength; - int start1 = (yOrigin+1)*rowLength - length1; - for (int i = yOrigin; i < (srcHeight - (kHeight - yOrigin - 1)); i ++) { + length = xOrigin * numBands; + int length1 = (kWidth - xOrigin - 1) * numBands; + start = yOrigin * rowLength; + int start1 = (yOrigin + 1) * rowLength - length1; + for (int i = yOrigin; i < (srcHeight - (kHeight - yOrigin - 1)); i++) { System.arraycopy(pixels, start, newPixels, start, length); System.arraycopy(pixels, start1, newPixels, start1, length1); - start +=rowLength; - start1 +=rowLength; + start += rowLength; + start1 += rowLength; } } // Cycle over pixels to be calculated - for (int i = yOrigin; i < srcConvMaxY; i++){ - for (int j = xOrigin; j < srcConvMaxX; j++){ + for (int i = yOrigin; i < srcConvMaxY; i++) { + for (int j = xOrigin; j < srcConvMaxX; j++) { // Take kernel data in backward direction, convolution int kernelIdx = data.length - 1; int pixelIndex = i * rowLength + j * numBands; - for (int hIdx = 0, rasterHIdx = i - yOrigin; - hIdx < kHeight; - hIdx++, rasterHIdx++ - ){ - for (int wIdx = 0, rasterWIdx = j - xOrigin; - wIdx < kWidth; - wIdx++, rasterWIdx++ - ){ + for (int hIdx = 0, rasterHIdx = i - yOrigin; hIdx < kHeight; hIdx++, rasterHIdx++) { + for (int wIdx = 0, rasterWIdx = j - xOrigin; wIdx < kWidth; wIdx++, rasterWIdx++) { int curIndex = rasterHIdx * rowLength + rasterWIdx * numBands; - for (int idx=0; idx < numBands; idx++){ - newPixels[pixelIndex+idx] += data[kernelIdx] * pixels[curIndex+idx]; + for (int idx = 0; idx < numBands; idx++) { + newPixels[pixelIndex + idx] += data[kernelIdx] + * pixels[curIndex + idx]; } kernelIdx--; } } // Check for overflow now - for (int idx=0; idx < numBands; idx++){ - if (((int)newPixels[pixelIndex+idx] & masks[idx]) != 0) { - if (newPixels[pixelIndex+idx] < 0) { - newPixels[pixelIndex+idx] = 0; + for (int idx = 0; idx < numBands; idx++) { + if (((int)newPixels[pixelIndex + idx] & masks[idx]) != 0) { + if (newPixels[pixelIndex + idx] < 0) { + newPixels[pixelIndex + idx] = 0; } else { - newPixels[pixelIndex+idx] = maxValues[idx]; + newPixels[pixelIndex + idx] = maxValues[idx]; } } } @@ -302,7 +304,7 @@ public class ConvolveOp implements BufferedImageOp, RasterOp { throw new NullPointerException(Messages.getString("awt.259")); //$NON-NLS-1$ } - if (src == dst){ + if (src == dst) { // awt.25A=Source equals to destination throw new IllegalArgumentException(Messages.getString("awt.25A")); //$NON-NLS-1$ } @@ -319,13 +321,10 @@ public class ConvolveOp implements BufferedImageOp, RasterOp { dst = createCompatibleDestImage(src, srcCM); } else { if (!srcCM.equals(dst.getColorModel())) { - // Treat BufferedImage.TYPE_INT_RGB and BufferedImage.TYPE_INT_ARGB as same - if ( - !((src.getType() == BufferedImage.TYPE_INT_RGB || - src.getType() == BufferedImage.TYPE_INT_ARGB) && - (dst.getType() == BufferedImage.TYPE_INT_RGB || - dst.getType() == BufferedImage.TYPE_INT_ARGB)) - ) { + // Treat BufferedImage.TYPE_INT_RGB and + // BufferedImage.TYPE_INT_ARGB as same + if (!((src.getType() == BufferedImage.TYPE_INT_RGB || src.getType() == BufferedImage.TYPE_INT_ARGB) && (dst + .getType() == BufferedImage.TYPE_INT_RGB || dst.getType() == BufferedImage.TYPE_INT_ARGB))) { finalDst = dst; dst = createCompatibleDestImage(src, srcCM); } @@ -334,11 +333,11 @@ public class ConvolveOp implements BufferedImageOp, RasterOp { // Skip alpha channel for TYPE_INT_RGB images // TODO - //if (ippFilter(src.getRaster(), dst.getRaster(), src.getType()) != 0) - if (slowFilter(src.getRaster(), dst.getRaster()) != 0) { - // awt.21F=Unable to transform source - throw new ImagingOpException (Messages.getString("awt.21F")); //$NON-NLS-1$ - } + // if (ippFilter(src.getRaster(), dst.getRaster(), src.getType()) != 0) + if (slowFilter(src.getRaster(), dst.getRaster()) != 0) { + // awt.21F=Unable to transform source + throw new ImagingOpException(Messages.getString("awt.21F")); //$NON-NLS-1$ + } if (finalDst != null) { Graphics2D g = finalDst.createGraphics(); @@ -355,11 +354,13 @@ public class ConvolveOp implements BufferedImageOp, RasterOp { /** * Ipp filter. * - * @param src the src - * @param dst the dst - * @param imageType the image type - * - * @return the int + * @param src + * the src. + * @param dst + * the dst. + * @param imageType + * the image type. + * @return the int. */ @SuppressWarnings("unused") private int ippFilter(Raster src, WritableRaster dst, int imageType) { @@ -372,8 +373,8 @@ public class ConvolveOp implements BufferedImageOp, RasterOp { case BufferedImage.TYPE_INT_RGB: case BufferedImage.TYPE_INT_BGR: { channels = 4; - srcStride = src.getWidth()*4; - dstStride = dst.getWidth()*4; + srcStride = src.getWidth() * 4; + dstStride = dst.getWidth() * 4; skipChannel = true; break; } @@ -383,8 +384,8 @@ public class ConvolveOp implements BufferedImageOp, RasterOp { case BufferedImage.TYPE_4BYTE_ABGR: case BufferedImage.TYPE_4BYTE_ABGR_PRE: { channels = 4; - srcStride = src.getWidth()*4; - dstStride = dst.getWidth()*4; + srcStride = src.getWidth() * 4; + dstStride = dst.getWidth() * 4; break; } @@ -397,12 +398,13 @@ public class ConvolveOp implements BufferedImageOp, RasterOp { case BufferedImage.TYPE_3BYTE_BGR: { channels = 3; - srcStride = src.getWidth()*3; - dstStride = dst.getWidth()*3; + srcStride = src.getWidth() * 3; + dstStride = dst.getWidth() * 3; break; } - case BufferedImage.TYPE_USHORT_GRAY: // TODO - could be done in native code? + case BufferedImage.TYPE_USHORT_GRAY: // TODO - could be done in + // native code? case BufferedImage.TYPE_USHORT_565_RGB: case BufferedImage.TYPE_USHORT_555_RGB: case BufferedImage.TYPE_BYTE_BINARY: { @@ -413,59 +415,51 @@ public class ConvolveOp implements BufferedImageOp, RasterOp { SampleModel srcSM = src.getSampleModel(); SampleModel dstSM = dst.getSampleModel(); - if ( - srcSM instanceof PixelInterleavedSampleModel && - dstSM instanceof PixelInterleavedSampleModel - ) { + if (srcSM instanceof PixelInterleavedSampleModel + && dstSM instanceof PixelInterleavedSampleModel) { // Check PixelInterleavedSampleModel - if ( - srcSM.getDataType() != DataBuffer.TYPE_BYTE || - dstSM.getDataType() != DataBuffer.TYPE_BYTE - ) { + if (srcSM.getDataType() != DataBuffer.TYPE_BYTE + || dstSM.getDataType() != DataBuffer.TYPE_BYTE) { return slowFilter(src, dst); } - channels = srcSM.getNumBands(); // Have IPP functions for 1, 3 and 4 channels + channels = srcSM.getNumBands(); // Have IPP functions for 1, + // 3 and 4 channels if (!(channels == 1 || channels == 3 || channels == 4)) { return slowFilter(src, dst); } - srcStride = ((ComponentSampleModel) srcSM).getScanlineStride(); - dstStride = ((ComponentSampleModel) dstSM).getScanlineStride(); - } else if ( - srcSM instanceof SinglePixelPackedSampleModel && - dstSM instanceof SinglePixelPackedSampleModel - ) { + srcStride = ((ComponentSampleModel)srcSM).getScanlineStride(); + dstStride = ((ComponentSampleModel)dstSM).getScanlineStride(); + } else if (srcSM instanceof SinglePixelPackedSampleModel + && dstSM instanceof SinglePixelPackedSampleModel) { // Check SinglePixelPackedSampleModel - SinglePixelPackedSampleModel sppsm1 = (SinglePixelPackedSampleModel) srcSM; - SinglePixelPackedSampleModel sppsm2 = (SinglePixelPackedSampleModel) dstSM; + SinglePixelPackedSampleModel sppsm1 = (SinglePixelPackedSampleModel)srcSM; + SinglePixelPackedSampleModel sppsm2 = (SinglePixelPackedSampleModel)dstSM; channels = sppsm1.getNumBands(); - // TYPE_INT_RGB, TYPE_INT_ARGB... - if ( - sppsm1.getDataType() != DataBuffer.TYPE_INT || - sppsm2.getDataType() != DataBuffer.TYPE_INT || - !(channels == 3 || channels == 4) - ) { + // TYPE_INT_RGB, TYPE_INT_ARGB... + if (sppsm1.getDataType() != DataBuffer.TYPE_INT + || sppsm2.getDataType() != DataBuffer.TYPE_INT + || !(channels == 3 || channels == 4)) { return slowFilter(src, dst); } // Check compatibility of sample models - if ( - !Arrays.equals(sppsm1.getBitOffsets(), sppsm2.getBitOffsets()) || - !Arrays.equals(sppsm1.getBitMasks(), sppsm2.getBitMasks()) - ) { + if (!Arrays.equals(sppsm1.getBitOffsets(), sppsm2.getBitOffsets()) + || !Arrays.equals(sppsm1.getBitMasks(), sppsm2.getBitMasks())) { return slowFilter(src, dst); } - for (int i=0; i props) { Hashtable fprops; - if(props == null) { + if (props == null) { fprops = new Hashtable(); } else { - fprops = (Hashtable) props.clone(); + fprops = (Hashtable)props.clone(); } String propName = "Crop Filters"; //$NON-NLS-1$ String prop = "x=" + X + "; y=" + Y + "; width=" + //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - WIDTH + "; height=" + HEIGHT; //$NON-NLS-1$ + WIDTH + "; height=" + HEIGHT; //$NON-NLS-1$ Object o = fprops.get(propName); - if(o != null){ - if(o instanceof String){ + if (o != null) { + if (o instanceof String) { prop = (String)o + "; " + prop; //$NON-NLS-1$ - }else{ - prop = o.toString() + "; " + prop; //$NON-NLS-1$ + } else { + prop = o.toString() + "; " + prop; //$NON-NLS-1$ } } fprops.put(propName, prop); @@ -73,15 +81,14 @@ public class CropImageFilter extends ImageFilter { } @Override - public void setPixels(int x, int y, int w, int h, ColorModel model, int[] pixels, int off, int scansize) { + public void setPixels(int x, int y, int w, int h, ColorModel model, int[] pixels, int off, + int scansize) { - if(x + w < X || X + WIDTH < x || - y + h < Y || Y + HEIGHT < y) { + if (x + w < X || X + WIDTH < x || y + h < Y || Y + HEIGHT < y) { return; } - int destX, destY, destWidth, destHeight, endX, endY, - srcEndX, srcEndY; + int destX, destY, destWidth, destHeight, endX, endY, srcEndX, srcEndY; int newOffset = off; @@ -91,37 +98,36 @@ public class CropImageFilter extends ImageFilter { srcEndX = x + w; srcEndY = y + h; - if(x <= X){ + if (x <= X) { destX = 0; newOffset += X; - if(endX >= srcEndX){ + if (endX >= srcEndX) { destWidth = srcEndX - X; - }else{ + } else { destWidth = WIDTH; } - }else{ + } else { destX = x - X; - if(endX >= srcEndX){ + if (endX >= srcEndX) { destWidth = w; - }else{ + } else { destWidth = endX - x; } } - - if(y <= Y){ + if (y <= Y) { newOffset += scansize * (Y - y); destY = 0; - if(endY >= srcEndY){ + if (endY >= srcEndY) { destHeight = srcEndY - Y; - }else{ + } else { destHeight = HEIGHT; } - }else{ + } else { destY = y - Y; - if(endY >= srcEndY){ + if (endY >= srcEndY) { destHeight = h; - }else{ + } else { destHeight = endY - y; } } @@ -129,15 +135,14 @@ public class CropImageFilter extends ImageFilter { } @Override - public void setPixels(int x, int y, int w, int h, ColorModel model, byte[] pixels, int off, int scansize) { + public void setPixels(int x, int y, int w, int h, ColorModel model, byte[] pixels, int off, + int scansize) { - if(x + w < X || X + WIDTH < x || - y + h < Y || Y + HEIGHT < y) { + if (x + w < X || X + WIDTH < x || y + h < Y || Y + HEIGHT < y) { return; } - int destX, destY, destWidth, destHeight, endX, endY, - srcEndX, srcEndY; + int destX, destY, destWidth, destHeight, endX, endY, srcEndX, srcEndY; int newOffset = off; @@ -147,37 +152,36 @@ public class CropImageFilter extends ImageFilter { srcEndX = x + w; srcEndY = y + h; - if(x <= X){ + if (x <= X) { destX = 0; newOffset += X; - if(endX >= srcEndX){ + if (endX >= srcEndX) { destWidth = srcEndX - X; - }else{ + } else { destWidth = WIDTH; } - }else{ + } else { destX = x - X; - if(endX >= srcEndX){ + if (endX >= srcEndX) { destWidth = w; - }else{ + } else { destWidth = endX - x; } } - - if(y <= Y){ + if (y <= Y) { newOffset += scansize * (Y - y); destY = 0; - if(endY >= srcEndY){ + if (endY >= srcEndY) { destHeight = srcEndY - Y; - }else{ + } else { destHeight = HEIGHT; } - }else{ + } else { destY = y - Y; - if(endY >= srcEndY){ + if (endY >= srcEndY) { destHeight = h; - }else{ + } else { destHeight = endY - y; } } @@ -190,4 +194,3 @@ public class CropImageFilter extends ImageFilter { } } - diff --git a/awt/java/awt/image/DataBuffer.java b/awt/java/awt/image/DataBuffer.java index 6856aee0e7950..92f900fd36b2a 100644 --- a/awt/java/awt/image/DataBuffer.java +++ b/awt/java/awt/image/DataBuffer.java @@ -18,65 +18,97 @@ * @author Igor V. Stolyarov * @version $Revision$ */ + package java.awt.image; import org.apache.harmony.awt.gl.image.DataBufferListener; import org.apache.harmony.awt.internal.nls.Messages; /** - * The Class DataBuffer is a wrapper class for a data array - * to be used for the situation where a suite of functionality - * acts on a set of data in a consistent way even though the - * primitive type of the data may vary from one use to the next. + * The Class DataBuffer is a wrapper class for a data array to be used for the + * situation where a suite of functionality acts on a set of data in a + * consistent way even though the primitive type of the data may vary from one + * use to the next. + * + * @since Android 1.0 */ public abstract class DataBuffer { - /** The Constant TYPE_BYTE. */ + /** + * The Constant TYPE_BYTE. + */ public static final int TYPE_BYTE = 0; - /** The Constant TYPE_USHORT. */ + /** + * The Constant TYPE_USHORT. + */ public static final int TYPE_USHORT = 1; - /** The Constant TYPE_SHORT. */ + /** + * The Constant TYPE_SHORT. + */ public static final int TYPE_SHORT = 2; - /** The Constant TYPE_INT. */ + /** + * The Constant TYPE_INT. + */ public static final int TYPE_INT = 3; - /** The Constant TYPE_FLOAT. */ + /** + * The Constant TYPE_FLOAT. + */ public static final int TYPE_FLOAT = 4; - /** The Constant TYPE_DOUBLE. */ + /** + * The Constant TYPE_DOUBLE. + */ public static final int TYPE_DOUBLE = 5; - /** The Constant TYPE_UNDEFINED. */ + /** + * The Constant TYPE_UNDEFINED. + */ public static final int TYPE_UNDEFINED = 32; - /** The data type indicates the primitive type of the - * data in this DataBuffer. */ + /** + * The data type indicates the primitive type of the data in this + * DataBuffer. + */ protected int dataType; - /** The number of data arrays in this DataBuffer. */ + /** + * The number of data arrays in this DataBuffer. + */ protected int banks; - /** The starting index for reading the - * data from the first (or only) internal data array. */ + /** + * The starting index for reading the data from the first (or only) internal + * data array. + */ protected int offset; - /** The length (number of elements) of the data arrays. */ + /** + * The length (number of elements) of the data arrays. + */ protected int size; - /** The starting indices for reading the - * data from the internal data arrays. */ + /** + * The starting indices for reading the data from the internal data arrays. + */ protected int offsets[]; - - /** The data changed. */ + + /** + * The data changed. + */ boolean dataChanged = true; - - /** The data taken. */ + + /** + * The data taken. + */ boolean dataTaken = false; - - /** The listener. */ + + /** + * The listener. + */ DataBufferListener listener; static { @@ -86,11 +118,15 @@ public abstract class DataBuffer { /** * Instantiates a new data buffer. * - * @param dataType the data type - * @param size the length (number of elements) of the data arrays - * @param numBanks the number of data arrays to create - * @param offsets the starting indices for reading the - * data from the internal data arrays + * @param dataType + * the data type. + * @param size + * the length (number of elements) of the data arrays. + * @param numBanks + * the number of data arrays to create. + * @param offsets + * the starting indices for reading the data from the internal + * data arrays. */ protected DataBuffer(int dataType, int size, int numBanks, int[] offsets) { this.dataType = dataType; @@ -101,13 +137,17 @@ public abstract class DataBuffer { } /** - * Instantiates a new data buffer with all of the - * data arrays starting at the same index. + * Instantiates a new data buffer with all of the data arrays starting at + * the same index. * - * @param dataType the data type - * @param size the length (number of elements) of the data arrays - * @param numBanks the number of data arrays to create - * @param offset the offset to use for all of the data arrays + * @param dataType + * the data type. + * @param size + * the length (number of elements) of the data arrays. + * @param numBanks + * the number of data arrays to create. + * @param offset + * the offset to use for all of the data arrays. */ protected DataBuffer(int dataType, int size, int numBanks, int offset) { this.dataType = dataType; @@ -122,12 +162,15 @@ public abstract class DataBuffer { } /** - * Instantiates a new data buffer with all of the - * data arrays read from the beginning (at offset zero). + * Instantiates a new data buffer with all of the data arrays read from the + * beginning (at offset zero). * - * @param dataType the data type - * @param size the length (number of elements) of the data arrays - * @param numBanks the number of data arrays to create + * @param dataType + * the data type. + * @param size + * the length (number of elements) of the data arrays. + * @param numBanks + * the number of data arrays to create. */ protected DataBuffer(int dataType, int size, int numBanks) { this.dataType = dataType; @@ -138,11 +181,13 @@ public abstract class DataBuffer { } /** - * Instantiates a new data buffer with one internal data array - * read from the beginning (at offset zero). + * Instantiates a new data buffer with one internal data array read from the + * beginning (at offset zero). * - * @param dataType the data type - * @param size the length (number of elements) of the data arrays + * @param dataType + * the data type. + * @param size + * the length (number of elements) of the data arrays. */ protected DataBuffer(int dataType, int size) { this.dataType = dataType; @@ -153,165 +198,161 @@ public abstract class DataBuffer { } /** - * Sets the data value in the specified array at the - * specified index. + * Sets the data value in the specified array at the specified index. * - * @param bank the internal array to the data to - * @param i the index within the array where the data - * should be written - * @param val the value to write into the array + * @param bank + * the internal array to the data to. + * @param i + * the index within the array where the data should be written. + * @param val + * the value to write into the array. */ public abstract void setElem(int bank, int i, int val); /** - * Sets the float data value in the specified array at the - * specified index. + * Sets the float data value in the specified array at the specified index. * - * @param bank the internal array to the data to - * @param i the index within the array where the data - * should be written - * @param val the value to write into the array + * @param bank + * the internal array to the data to. + * @param i + * the index within the array where the data should be written. + * @param val + * the value to write into the array. */ public void setElemFloat(int bank, int i, float val) { - setElem(bank, i, (int) val); + setElem(bank, i, (int)val); } /** - * Sets the double data value in the specified array at the - * specified index. + * Sets the double data value in the specified array at the specified index. * - * @param bank the internal array to the data to - * @param i the index within the array where the data - * should be written - * @param val the value to write into the array + * @param bank + * the internal array to the data to. + * @param i + * the index within the array where the data should be written. + * @param val + * the value to write into the array. */ public void setElemDouble(int bank, int i, double val) { - setElem(bank, i, (int) val); + setElem(bank, i, (int)val); } /** - * Sets the data value in the first array at the - * specified index. + * Sets the data value in the first array at the specified index. * - * @param i the index within the array where the data - * should be written - * @param val the value to write into the array + * @param i + * the index within the array where the data should be written. + * @param val + * the value to write into the array. */ public void setElem(int i, int val) { setElem(0, i, val); } /** - * Gets the data value from the specified data array at the - * specified index. - * - * @param bank the data array to read from - * @param i the index within the array where the data - * should be read + * Gets the data value from the specified data array at the specified index. * - * @return the data element + * @param bank + * the data array to read from. + * @param i + * the index within the array where the data should be read. + * @return the data element. */ public abstract int getElem(int bank, int i); /** - * Gets the float-type data value from the specified - * data array at the specified index. - * - * @param bank the data array to read from - * @param i the index within the array where the data - * should be read + * Gets the float-type data value from the specified data array at the + * specified index. * - * @return the data element + * @param bank + * the data array to read from. + * @param i + * the index within the array where the data should be read. + * @return the data element. */ public float getElemFloat(int bank, int i) { return getElem(bank, i); } /** - * Gets the double-type data value from the specified - * data array at the specified index. - * - * @param bank the data array to read from - * @param i the index within the array where the data - * should be read + * Gets the double-type data value from the specified data array at the + * specified index. * - * @return the data element + * @param bank + * the data array to read from. + * @param i + * the index within the array where the data should be read. + * @return the data element. */ public double getElemDouble(int bank, int i) { return getElem(bank, i); } /** - * Sets the float data value in the first array at the - * specified index. + * Sets the float data value in the first array at the specified index. * - * @param i the index within the array where the data - * should be written - * @param val the value to write into the array + * @param i + * the index within the array where the data should be written. + * @param val + * the value to write into the array. */ public void setElemFloat(int i, float val) { setElemFloat(0, i, val); } /** - * Sets the double data value in the first array at the - * specified index. + * Sets the double data value in the first array at the specified index. * - * @param i the index within the array where the data - * should be written - * @param val the value to write into the array + * @param i + * the index within the array where the data should be written. + * @param val + * the value to write into the array. */ public void setElemDouble(int i, double val) { setElemDouble(0, i, val); } /** - * Gets the data value from the first - * data array at the specified index and returns it - * as an int. - * - * @param i the index within the array where the data - * should be read + * Gets the data value from the first data array at the specified index and + * returns it as an integer. * - * @return the data element + * @param i + * the index within the array where the data should be read. + * @return the data element. */ public int getElem(int i) { return getElem(0, i); } /** - * Gets the data value from the first - * data array at the specified index and returns it - * as a float. + * Gets the data value from the first data array at the specified index and + * returns it as a float. * - * @param i the index within the array where the data - * should be read - * - * @return the data element + * @param i + * the index within the array where the data should be read. + * @return the data element. */ public float getElemFloat(int i) { return getElem(0, i); } /** - * Gets the data value from the first - * data array at the specified index and returns it - * as a double. - * - * @param i the index within the array where the data - * should be read + * Gets the data value from the first data array at the specified index and + * returns it as a double. * - * @return the data element + * @param i + * the index within the array where the data should be read. + * @return the data element. */ public double getElemDouble(int i) { return getElem(i); } /** - * Gets the array giving the offsets corresponding - * to the internal data arrays. + * Gets the array giving the offsets corresponding to the internal data + * arrays. * - * @return the array of offsets + * @return the array of offsets. */ public int[] getOffsets() { return offsets; @@ -320,18 +361,16 @@ public abstract class DataBuffer { /** * Gets the size in bits of the primitive data type. * - * @return the size in bits of the primitive data type - + * @return the size in bits of the primitive data type. */ public int getSize() { return size; } /** - * Gets the offset corresponding to the first internal - * data array. + * Gets the offset corresponding to the first internal data array. * - * @return the offset + * @return the offset. */ public int getOffset() { return offset; @@ -340,7 +379,7 @@ public abstract class DataBuffer { /** * Gets the number of data arrays in this DataBuffer. * - * @return the number of data arrays + * @return the number of data arrays. */ public int getNumBanks() { return banks; @@ -349,7 +388,7 @@ public abstract class DataBuffer { /** * Gets the primitive type of this buffer's data. * - * @return the data type + * @return the data type. */ public int getDataType() { return this.dataType; @@ -358,85 +397,85 @@ public abstract class DataBuffer { /** * Gets the size in bits of the primitive data type. * - * @param type the primitive type - * - * @return the size in bits of the primitive data type + * @param type + * the primitive type. + * @return the size in bits of the primitive data type. */ public static int getDataTypeSize(int type) { switch (type) { - case TYPE_BYTE: - return 8; + case TYPE_BYTE: + return 8; - case TYPE_USHORT: - case TYPE_SHORT: - return 16; + case TYPE_USHORT: + case TYPE_SHORT: + return 16; - case TYPE_INT: - case TYPE_FLOAT: - return 32; + case TYPE_INT: + case TYPE_FLOAT: + return 32; - case TYPE_DOUBLE: - return 64; + case TYPE_DOUBLE: + return 64; - default: - // awt.22C=Unknown data type {0} - throw new IllegalArgumentException(Messages.getString("awt.22C", type)); //$NON-NLS-1$ + default: + // awt.22C=Unknown data type {0} + throw new IllegalArgumentException(Messages.getString("awt.22C", type)); //$NON-NLS-1$ } } - + /** * Notifies the listener that the data has changed. */ - void notifyChanged(){ - if(listener != null && !dataChanged){ + void notifyChanged() { + if (listener != null && !dataChanged) { dataChanged = true; listener.dataChanged(); } } - + /** * Notifies the listener that the data has been released. */ - void notifyTaken(){ - if(listener != null && !dataTaken){ + void notifyTaken() { + if (listener != null && !dataTaken) { dataTaken = true; listener.dataTaken(); } } - + /** * Release the data. */ - void releaseData(){ - if(listener != null && dataTaken){ + void releaseData() { + if (listener != null && dataTaken) { dataTaken = false; listener.dataReleased(); } } - + /** * Adds the data buffer listener. * - * @param listener the listener + * @param listener + * the listener. */ - void addDataBufferListener(DataBufferListener listener){ + void addDataBufferListener(DataBufferListener listener) { this.listener = listener; } - + /** * Removes the data buffer listener. */ - void removeDataBufferListener(){ + void removeDataBufferListener() { listener = null; } - + /** * Validate. */ - void validate(){ + void validate() { dataChanged = false; } - -} +} diff --git a/awt/java/awt/image/DataBufferByte.java b/awt/java/awt/image/DataBufferByte.java index 4d29c9ca3dbcc..3407de84dca8f 100644 --- a/awt/java/awt/image/DataBufferByte.java +++ b/awt/java/awt/image/DataBufferByte.java @@ -18,25 +18,32 @@ * @author Igor V. Stolyarov * @version $Revision$ */ + package java.awt.image; /** - * The Class DataBufferByte is the subclass of DataBuffer - * for the case where the underlying data is of type byte. + * The Class DataBufferByte is the subclass of DataBuffer for the case where the + * underlying data is of type byte. + * + * @since Android 1.0 */ public final class DataBufferByte extends DataBuffer { - /** The data. */ + /** + * The data. + */ byte data[][]; /** * Instantiates a new data buffer of type unsigned short. * - * @param dataArrays the data arrays to copy the data from - * @param size the length (number of elements) to use - * from the data arrays - * @param offsets the starting indices for reading the - * data from the internal data arrays + * @param dataArrays + * the data arrays to copy the data from. + * @param size + * the length (number of elements) to use from the data arrays. + * @param offsets + * the starting indices for reading the data from the internal + * data arrays. */ public DataBufferByte(byte dataArrays[][], int size, int offsets[]) { super(TYPE_BYTE, size, dataArrays.length, offsets); @@ -46,9 +53,10 @@ public final class DataBufferByte extends DataBuffer { /** * Instantiates a new data buffer of type unsigned short. * - * @param dataArrays the data arrays to copy the data from - * @param size the length (number of elements) to use - * from the data arrays + * @param dataArrays + * the data arrays to copy the data from. + * @param size + * the length (number of elements) to use from the data arrays. */ public DataBufferByte(byte dataArrays[][], int size) { super(TYPE_BYTE, size, dataArrays.length); @@ -56,12 +64,15 @@ public final class DataBufferByte extends DataBuffer { } /** - * Instantiates a new data buffer of type unsigned short - * with a single underlying array of data. + * Instantiates a new data buffer of type unsigned short with a single + * underlying array of data. * - * @param dataArray the data array to copy the data from - * @param size the length (number of elements) to use - * @param offset the starting index to use when reading the data + * @param dataArray + * the data array to copy the data from. + * @param size + * the length (number of elements) to use. + * @param offset + * the starting index to use when reading the data. */ public DataBufferByte(byte dataArray[], int size, int offset) { super(TYPE_BYTE, size, 1, offset); @@ -70,12 +81,13 @@ public final class DataBufferByte extends DataBuffer { } /** - * Instantiates a new data buffer of type unsigned short - * with a single underlying array of data starting at - * index 0. + * Instantiates a new data buffer of type unsigned short with a single + * underlying array of data starting at index 0. * - * @param dataArray the data array to copy the data from - * @param size the length (number of elements) to use + * @param dataArray + * the data array to copy the data from. + * @param size + * the length (number of elements) to use. */ public DataBufferByte(byte dataArray[], int size) { super(TYPE_BYTE, size); @@ -84,12 +96,13 @@ public final class DataBufferByte extends DataBuffer { } /** - * Instantiates a new empty data buffer of type unsigned short - * with offsets equal to zero. + * Instantiates a new empty data buffer of type unsigned short with offsets + * equal to zero. * - * @param size the length (number of elements) to use - * from the data arrays - * @param numBanks the number of data arrays to create + * @param size + * the length (number of elements) to use from the data arrays. + * @param numBanks + * the number of data arrays to create. */ public DataBufferByte(int size, int numBanks) { super(TYPE_BYTE, size, numBanks); @@ -101,11 +114,11 @@ public final class DataBufferByte extends DataBuffer { } /** - * Instantiates a new empty data buffer of type unsigned short - * with a single underlying array of data starting at - * index 0. + * Instantiates a new empty data buffer of type unsigned short with a single + * underlying array of data starting at index 0. * - * @param size the length (number of elements) to use + * @param size + * the length (number of elements) to use. */ public DataBufferByte(int size) { super(TYPE_BYTE, size); @@ -115,13 +128,13 @@ public final class DataBufferByte extends DataBuffer { @Override public void setElem(int bank, int i, int val) { - data[bank][offsets[bank] + i] = (byte) val; + data[bank][offsets[bank] + i] = (byte)val; notifyChanged(); } @Override public void setElem(int i, int val) { - data[0][offset + i] = (byte) val; + data[0][offset + i] = (byte)val; notifyChanged(); } @@ -133,9 +146,9 @@ public final class DataBufferByte extends DataBuffer { /** * Gets the data of the specified internal data array. * - * @param bank the index of the desired data array - * - * @return the data + * @param bank + * the index of the desired data array. + * @return the data. */ public byte[] getData(int bank) { notifyTaken(); @@ -150,7 +163,7 @@ public final class DataBufferByte extends DataBuffer { /** * Gets the bank data. * - * @return the bank data + * @return the bank data. */ public byte[][] getBankData() { notifyTaken(); @@ -160,7 +173,7 @@ public final class DataBufferByte extends DataBuffer { /** * Gets the data of the first data array. * - * @return the data + * @return the data. */ public byte[] getData() { notifyTaken(); @@ -168,4 +181,3 @@ public final class DataBufferByte extends DataBuffer { } } - diff --git a/awt/java/awt/image/DataBufferDouble.java b/awt/java/awt/image/DataBufferDouble.java index fa3d324d7f47e..5d0a51688f034 100644 --- a/awt/java/awt/image/DataBufferDouble.java +++ b/awt/java/awt/image/DataBufferDouble.java @@ -18,26 +18,33 @@ * @author Igor V. Stolyarov * @version $Revision$ */ + package java.awt.image; /** - * The Class DataBufferDouble is the subclass of DataBuffer - * for the case where the underlying data is of type double. + * The Class DataBufferDouble is the subclass of DataBuffer for the case where + * the underlying data is of type double. + * + * @since Android 1.0 */ public final class DataBufferDouble extends DataBuffer { - /** The data. */ + /** + * The data. + */ double data[][]; /** * Instantiates a new data buffer of type double. * - * @param dataArrays the data arrays to copy the data from - * @param size the length (number of elements) to use - * from the data arrays - * @param offsets the starting indices for reading the - * data from the internal data arrays - */ + * @param dataArrays + * the data arrays to copy the data from. + * @param size + * the length (number of elements) to use from the data arrays. + * @param offsets + * the starting indices for reading the data from the internal + * data arrays. + */ public DataBufferDouble(double dataArrays[][], int size, int offsets[]) { super(TYPE_DOUBLE, size, dataArrays.length, offsets); data = dataArrays.clone(); @@ -46,9 +53,10 @@ public final class DataBufferDouble extends DataBuffer { /** * Instantiates a new data buffer of type double. * - * @param dataArrays the data arrays to copy the data from - * @param size the length (number of elements) to use - * from the data arrays + * @param dataArrays + * the data arrays to copy the data from. + * @param size + * the length (number of elements) to use from the data arrays. */ public DataBufferDouble(double dataArrays[][], int size) { super(TYPE_DOUBLE, size, dataArrays.length); @@ -56,12 +64,15 @@ public final class DataBufferDouble extends DataBuffer { } /** - * Instantiates a new data buffer of type double - * with a single underlying array of data. + * Instantiates a new data buffer of type double with a single underlying + * array of data. * - * @param dataArray the data array to copy the data from - * @param size the length (number of elements) to use - * @param offset the starting index to use when reading the data + * @param dataArray + * the data array to copy the data from. + * @param size + * the length (number of elements) to use. + * @param offset + * the starting index to use when reading the data. */ public DataBufferDouble(double dataArray[], int size, int offset) { super(TYPE_DOUBLE, size, 1, offset); @@ -70,12 +81,13 @@ public final class DataBufferDouble extends DataBuffer { } /** - * Instantiates a new data buffer of type double - * with a single underlying array of data starting at - * index 0. + * Instantiates a new data buffer of type double with a single underlying + * array of data starting at index 0. * - * @param dataArray the data array to copy the data from - * @param size the length (number of elements) to use + * @param dataArray + * the data array to copy the data from. + * @param size + * the length (number of elements) to use. */ public DataBufferDouble(double dataArray[], int size) { super(TYPE_DOUBLE, size); @@ -84,12 +96,13 @@ public final class DataBufferDouble extends DataBuffer { } /** - * Instantiates a new empty data buffer of type double - * with offsets equal to zero. + * Instantiates a new empty data buffer of type double with offsets equal to + * zero. * - * @param size the length (number of elements) to use - * from the data arrays - * @param numBanks the number of data arrays to create + * @param size + * the length (number of elements) to use from the data arrays. + * @param numBanks + * the number of data arrays to create. */ public DataBufferDouble(int size, int numBanks) { super(TYPE_DOUBLE, size, numBanks); @@ -101,11 +114,11 @@ public final class DataBufferDouble extends DataBuffer { } /** - * Instantiates a new empty data buffer of type double - * with a single underlying array of data starting at - * index 0. + * Instantiates a new empty data buffer of type double with a single + * underlying array of data starting at index 0. * - * @param size the length (number of elements) to use + * @param size + * the length (number of elements) to use. */ public DataBufferDouble(int size) { super(TYPE_DOUBLE, size); @@ -139,12 +152,12 @@ public final class DataBufferDouble extends DataBuffer { @Override public int getElem(int bank, int i) { - return (int) (data[bank][offsets[bank] + i]); + return (int)(data[bank][offsets[bank] + i]); } @Override public float getElemFloat(int bank, int i) { - return (float) (data[bank][offsets[bank] + i]); + return (float)(data[bank][offsets[bank] + i]); } @Override @@ -167,9 +180,9 @@ public final class DataBufferDouble extends DataBuffer { /** * Gets the data of the specified internal data array. * - * @param bank the index of the desired data array - * - * @return the data + * @param bank + * the index of the desired data array. + * @return the data. */ public double[] getData(int bank) { notifyTaken(); @@ -178,12 +191,12 @@ public final class DataBufferDouble extends DataBuffer { @Override public int getElem(int i) { - return (int) (data[0][offset + i]); + return (int)(data[0][offset + i]); } @Override public float getElemFloat(int i) { - return (float) (data[0][offset + i]); + return (float)(data[0][offset + i]); } @Override @@ -194,7 +207,7 @@ public final class DataBufferDouble extends DataBuffer { /** * Gets the bank data. * - * @return the bank data + * @return the bank data. */ public double[][] getBankData() { notifyTaken(); @@ -204,11 +217,10 @@ public final class DataBufferDouble extends DataBuffer { /** * Gets the data of the first data array. * - * @return the data + * @return the data. */ public double[] getData() { notifyTaken(); return data[0]; } } - diff --git a/awt/java/awt/image/DataBufferFloat.java b/awt/java/awt/image/DataBufferFloat.java index e34245c2c86e0..9a4a6bfed23dc 100644 --- a/awt/java/awt/image/DataBufferFloat.java +++ b/awt/java/awt/image/DataBufferFloat.java @@ -18,25 +18,32 @@ * @author Igor V. Stolyarov * @version $Revision$ */ + package java.awt.image; /** - * The Class DataBufferFloat is the subclass of DataBuffer - * for the case where the underlying data is float. + * The Class DataBufferFloat is the subclass of DataBuffer for the case where + * the underlying data is float. + * + * @since Android 1.0 */ public final class DataBufferFloat extends DataBuffer { - /** The data. */ + /** + * The data. + */ float data[][]; /** * Instantiates a new data buffer of type float. * - * @param dataArrays the data arrays to copy the data from - * @param size the length (number of elements) to use - * from the data arrays - * @param offsets the starting indices for reading the - * data from the internal data arrays + * @param dataArrays + * the data arrays to copy the data from. + * @param size + * the length (number of elements) to use from the data arrays. + * @param offsets + * the starting indices for reading the data from the internal + * data arrays. */ public DataBufferFloat(float dataArrays[][], int size, int offsets[]) { super(TYPE_FLOAT, size, dataArrays.length, offsets); @@ -46,9 +53,10 @@ public final class DataBufferFloat extends DataBuffer { /** * Instantiates a new data buffer of type float. * - * @param dataArrays the data arrays to copy the data from - * @param size the length (number of elements) to use - * from the data arrays + * @param dataArrays + * the data arrays to copy the data from. + * @param size + * the length (number of elements) to use from the data arrays. */ public DataBufferFloat(float dataArrays[][], int size) { super(TYPE_FLOAT, size, dataArrays.length); @@ -56,12 +64,15 @@ public final class DataBufferFloat extends DataBuffer { } /** - * Instantiates a new data buffer of type float - * with a single underlying array of data. + * Instantiates a new data buffer of type float with a single underlying + * array of data. * - * @param dataArray the data array to copy the data from - * @param size the length (number of elements) to use - * @param offset the starting index to use when reading the data + * @param dataArray + * the data array to copy the data from. + * @param size + * the length (number of elements) to use. + * @param offset + * the starting index to use when reading the data. */ public DataBufferFloat(float dataArray[], int size, int offset) { super(TYPE_FLOAT, size, 1, offset); @@ -70,12 +81,13 @@ public final class DataBufferFloat extends DataBuffer { } /** - * Instantiates a new data buffer of type float - * with a single underlying array of data starting at - * index 0. + * Instantiates a new data buffer of type float with a single underlying + * array of data starting at index 0. * - * @param dataArray the data array to copy the data from - * @param size the length (number of elements) to use + * @param dataArray + * the data array to copy the data from. + * @param size + * the length (number of elements) to use. */ public DataBufferFloat(float dataArray[], int size) { super(TYPE_FLOAT, size); @@ -84,12 +96,13 @@ public final class DataBufferFloat extends DataBuffer { } /** - * Instantiates a new empty data buffer of type float - * with offsets equal to zero. + * Instantiates a new empty data buffer of type float with offsets equal to + * zero. * - * @param size the length (number of elements) to use - * from the data arrays - * @param numBanks the number of data arrays to create + * @param size + * the length (number of elements) to use from the data arrays. + * @param numBanks + * the number of data arrays to create. */ public DataBufferFloat(int size, int numBanks) { super(TYPE_FLOAT, size, numBanks); @@ -101,11 +114,11 @@ public final class DataBufferFloat extends DataBuffer { } /** - * Instantiates a new empty data buffer of type float - * with a single underlying array of data starting at - * index 0. + * Instantiates a new empty data buffer of type float with a single + * underlying array of data starting at index 0. * - * @param size the length (number of elements) to use + * @param size + * the length (number of elements) to use. */ public DataBufferFloat(int size) { super(TYPE_FLOAT, size); @@ -127,7 +140,7 @@ public final class DataBufferFloat extends DataBuffer { @Override public void setElemDouble(int bank, int i, double val) { - data[bank][offsets[bank] + i] = (float) val; + data[bank][offsets[bank] + i] = (float)val; notifyChanged(); } @@ -139,7 +152,7 @@ public final class DataBufferFloat extends DataBuffer { @Override public int getElem(int bank, int i) { - return (int) (data[bank][offsets[bank] + i]); + return (int)(data[bank][offsets[bank] + i]); } @Override @@ -160,16 +173,16 @@ public final class DataBufferFloat extends DataBuffer { @Override public void setElemDouble(int i, double val) { - data[0][offset + i] = (float) val; + data[0][offset + i] = (float)val; notifyChanged(); } /** * Gets the data of the specified internal data array. * - * @param bank the index of the desired array - * - * @return the data + * @param bank + * the index of the desired array. + * @return the data. */ public float[] getData(int bank) { notifyTaken(); @@ -178,7 +191,7 @@ public final class DataBufferFloat extends DataBuffer { @Override public int getElem(int i) { - return (int) (data[0][offset + i]); + return (int)(data[0][offset + i]); } @Override @@ -194,7 +207,7 @@ public final class DataBufferFloat extends DataBuffer { /** * Gets the bank data. * - * @return the bank data + * @return the bank data. */ public float[][] getBankData() { notifyTaken(); @@ -204,11 +217,10 @@ public final class DataBufferFloat extends DataBuffer { /** * Gets the data of the first data array. * - * @return the data + * @return the data. */ public float[] getData() { notifyTaken(); return data[0]; } } - diff --git a/awt/java/awt/image/DataBufferInt.java b/awt/java/awt/image/DataBufferInt.java index 43dc1880ad271..380a1278d7a78 100644 --- a/awt/java/awt/image/DataBufferInt.java +++ b/awt/java/awt/image/DataBufferInt.java @@ -18,25 +18,32 @@ * @author Igor V. Stolyarov * @version $Revision$ */ + package java.awt.image; /** - * The Class DataBufferInt is the subclass of DataBuffer - * for the case where the underlying data is of type int. + * The Class DataBufferInt is the subclass of DataBuffer for the case where the + * underlying data is of type integer. + * + * @since Android 1.0 */ public final class DataBufferInt extends DataBuffer { - /** The data. */ + /** + * The data. + */ int data[][]; /** - * Instantiates a new data buffer of type int. + * Instantiates a new data buffer of type integer. * - * @param dataArrays the data arrays to copy the data from - * @param size the length (number of elements) to use - * from the data arrays - * @param offsets the starting indices for reading the - * data from the internal data arrays + * @param dataArrays + * the data arrays to copy the data from. + * @param size + * the length (number of elements) to use from the data arrays. + * @param offsets + * the starting indices for reading the data from the internal + * data arrays. */ public DataBufferInt(int dataArrays[][], int size, int offsets[]) { super(TYPE_INT, size, dataArrays.length, offsets); @@ -44,11 +51,12 @@ public final class DataBufferInt extends DataBuffer { } /** - * Instantiates a new data buffer of type int. + * Instantiates a new data buffer of type integer. * - * @param dataArrays the data arrays to copy the data from - * @param size the length (number of elements) to use - * from the data arrays + * @param dataArrays + * the data arrays to copy the data from. + * @param size + * the length (number of elements) to use from the data arrays. */ public DataBufferInt(int dataArrays[][], int size) { super(TYPE_INT, size, dataArrays.length); @@ -56,12 +64,15 @@ public final class DataBufferInt extends DataBuffer { } /** - * Instantiates a new data buffer of type int - * with a single underlying array of data. + * Instantiates a new data buffer of type integer with a single underlying + * array of data. * - * @param dataArray the data array to copy the data from - * @param size the length (number of elements) to use - * @param offset the starting index to use when reading the data + * @param dataArray + * the data array to copy the data from. + * @param size + * the length (number of elements) to use. + * @param offset + * the starting index to use when reading the data. */ public DataBufferInt(int dataArray[], int size, int offset) { super(TYPE_INT, size, 1, offset); @@ -70,12 +81,13 @@ public final class DataBufferInt extends DataBuffer { } /** - * Instantiates a new data buffer of type int - * with a single underlying array of data starting at - * index 0. + * Instantiates a new data buffer of type integer with a single underlying + * array of data starting at index 0. * - * @param dataArray the data array to copy the data from - * @param size the length (number of elements) to use + * @param dataArray + * the data array to copy the data from. + * @param size + * the length (number of elements) to use. */ public DataBufferInt(int dataArray[], int size) { super(TYPE_INT, size); @@ -84,12 +96,13 @@ public final class DataBufferInt extends DataBuffer { } /** - * Instantiates a new empty data buffer of type int - * with offsets equal to zero. + * Instantiates a new empty data buffer of type integer with offsets equal + * to zero. * - * @param size the length (number of elements) to use - * from the data arrays - * @param numBanks the number of data arrays to create + * @param size + * the length (number of elements) to use from the data arrays. + * @param numBanks + * the number of data arrays to create. */ public DataBufferInt(int size, int numBanks) { super(TYPE_INT, size, numBanks); @@ -101,11 +114,11 @@ public final class DataBufferInt extends DataBuffer { } /** - * Instantiates a new empty data buffer of type int - * with a single underlying array of data starting at - * index 0. + * Instantiates a new empty data buffer of type integer with a single + * underlying array of data starting at index 0. * - * @param size the length (number of elements) to use + * @param size + * the length (number of elements) to use. */ public DataBufferInt(int size) { super(TYPE_INT, size); @@ -133,9 +146,9 @@ public final class DataBufferInt extends DataBuffer { /** * Gets the data of the specified internal data array. * - * @param bank the index of the desired data array - * - * @return the data + * @param bank + * the index of the desired data array. + * @return the data. */ public int[] getData(int bank) { notifyTaken(); @@ -150,7 +163,7 @@ public final class DataBufferInt extends DataBuffer { /** * Gets the bank data. * - * @return the bank data + * @return the bank data. */ public int[][] getBankData() { notifyTaken(); @@ -160,11 +173,10 @@ public final class DataBufferInt extends DataBuffer { /** * Gets the data of the first data array. * - * @return the data + * @return the data. */ public int[] getData() { notifyTaken(); return data[0]; } } - diff --git a/awt/java/awt/image/DataBufferShort.java b/awt/java/awt/image/DataBufferShort.java index 819ba4a46aece..1b11b29c3d92c 100644 --- a/awt/java/awt/image/DataBufferShort.java +++ b/awt/java/awt/image/DataBufferShort.java @@ -18,25 +18,32 @@ * @author Igor V. Stolyarov * @version $Revision$ */ + package java.awt.image; /** - * The Class DataBufferShort is the subclass of DataBuffer - * for the case where the underlying data is short. + * The Class DataBufferShort is the subclass of DataBuffer for the case where + * the underlying data is short. + * + * @since Android 1.0 */ public final class DataBufferShort extends DataBuffer { - /** The data. */ + /** + * The data. + */ short data[][]; /** * Instantiates a new data buffer of type short. * - * @param dataArrays the data arrays to copy the data from - * @param size the length (number of elements) to use - * from the data arrays - * @param offsets the starting indices for reading the - * data from the internal data arrays + * @param dataArrays + * the data arrays to copy the data from. + * @param size + * the length (number of elements) to use from the data arrays. + * @param offsets + * the starting indices for reading the data from the internal + * data arrays. */ public DataBufferShort(short dataArrays[][], int size, int offsets[]) { super(TYPE_SHORT, size, dataArrays.length, offsets); @@ -46,9 +53,10 @@ public final class DataBufferShort extends DataBuffer { /** * Instantiates a new data buffer of type short. * - * @param dataArrays the data arrays to copy the data from - * @param size the length (number of elements) to use - * from the data arrays + * @param dataArrays + * the data arrays to copy the data from. + * @param size + * the length (number of elements) to use from the data arrays. */ public DataBufferShort(short dataArrays[][], int size) { super(TYPE_SHORT, size, dataArrays.length); @@ -56,13 +64,15 @@ public final class DataBufferShort extends DataBuffer { } /** - * Instantiates a new data buffer of type short - * with a single underlying array of data. + * Instantiates a new data buffer of type short with a single underlying + * array of data. * - * @param dataArray the data array to copy the data from - * @param size the length (number of elements) to use - * @param offset the starting index to use when reading the data - + * @param dataArray + * the data array to copy the data from. + * @param size + * the length (number of elements) to use. + * @param offset + * the starting index to use when reading the data. */ public DataBufferShort(short dataArray[], int size, int offset) { super(TYPE_SHORT, size, 1, offset); @@ -71,13 +81,13 @@ public final class DataBufferShort extends DataBuffer { } /** - * Instantiates a new data buffer of type short - * with a single underlying array of data starting at - * index 0. + * Instantiates a new data buffer of type short with a single underlying + * array of data starting at index 0. * - * @param dataArray the data array to copy the data from - * @param size the length (number of elements) to use - + * @param dataArray + * the data array to copy the data from. + * @param size + * the length (number of elements) to use. */ public DataBufferShort(short dataArray[], int size) { super(TYPE_SHORT, size); @@ -86,12 +96,12 @@ public final class DataBufferShort extends DataBuffer { } /** - * Instantiates a new data buffer of type short - * with offsets equal to zero. + * Instantiates a new data buffer of type short with offsets equal to zero. * - * @param size the length (number of elements) to use - * from the data arrays - * @param numBanks the number of data arrays to create + * @param size + * the length (number of elements) to use from the data arrays. + * @param numBanks + * the number of data arrays to create. */ public DataBufferShort(int size, int numBanks) { super(TYPE_SHORT, size, numBanks); @@ -103,11 +113,11 @@ public final class DataBufferShort extends DataBuffer { } /** - * Instantiates a new empty data buffer of type short - * with a single underlying array of data starting at - * index 0. + * Instantiates a new empty data buffer of type short with a single + * underlying array of data starting at index 0. * - * @param size the length (number of elements) to use + * @param size + * the length (number of elements) to use. */ public DataBufferShort(int size) { super(TYPE_SHORT, size); @@ -117,13 +127,13 @@ public final class DataBufferShort extends DataBuffer { @Override public void setElem(int bank, int i, int val) { - data[bank][offsets[bank] + i] = (short) val; + data[bank][offsets[bank] + i] = (short)val; notifyChanged(); } @Override public void setElem(int i, int val) { - data[0][offset + i] = (short) val; + data[0][offset + i] = (short)val; notifyChanged(); } @@ -135,9 +145,9 @@ public final class DataBufferShort extends DataBuffer { /** * Gets the data of the specified internal data array. * - * @param bank the index of the desired data array - * - * @return the data + * @param bank + * the index of the desired data array. + * @return the data. */ public short[] getData(int bank) { notifyTaken(); @@ -152,7 +162,7 @@ public final class DataBufferShort extends DataBuffer { /** * Gets the bank data. * - * @return the bank data + * @return the bank data. */ public short[][] getBankData() { notifyTaken(); @@ -162,11 +172,10 @@ public final class DataBufferShort extends DataBuffer { /** * Gets the data of the first data array. * - * @return the data + * @return the data. */ public short[] getData() { notifyTaken(); return data[0]; } } - diff --git a/awt/java/awt/image/DataBufferUShort.java b/awt/java/awt/image/DataBufferUShort.java index 79826784aa0c7..58d9d8340bf64 100644 --- a/awt/java/awt/image/DataBufferUShort.java +++ b/awt/java/awt/image/DataBufferUShort.java @@ -18,34 +18,42 @@ * @author Igor V. Stolyarov * @version $Revision$ */ + package java.awt.image; import org.apache.harmony.awt.internal.nls.Messages; /** - * The Class DataBufferUShort is the subclass of DataBuffer - * for the case where the underlying data is unsigned short. + * The Class DataBufferUShort is the subclass of DataBuffer for the case where + * the underlying data is unsigned short. + * + * @since Android 1.0 */ public final class DataBufferUShort extends DataBuffer { - /** The data. */ + /** + * The data. + */ short data[][]; /** * Instantiates a new data buffer of type unsigned short. * - * @param dataArrays the data arrays to copy the data from - * @param size the length (number of elements) to use - * from the data arrays - * @param offsets the starting indices for reading the - * data from the internal data arrays + * @param dataArrays + * the data arrays to copy the data from. + * @param size + * the length (number of elements) to use from the data arrays. + * @param offsets + * the starting indices for reading the data from the internal + * data arrays. */ public DataBufferUShort(short dataArrays[][], int size, int offsets[]) { super(TYPE_USHORT, size, dataArrays.length, offsets); - for(int i = 0; i < dataArrays.length; i++){ - if(dataArrays[i].length < offsets[i] + size){ - // awt.28d=Length of dataArray[{0}] is less than size + offset[{1}] - throw new IllegalArgumentException(Messages.getString("awt.28D", i, i)); //$NON-NLS-1$ + for (int i = 0; i < dataArrays.length; i++) { + if (dataArrays[i].length < offsets[i] + size) { + // awt.28d=Length of dataArray[{0}] is less than size + + // offset[{1}] + throw new IllegalArgumentException(Messages.getString("awt.28D", i, i)); //$NON-NLS-1$ } } data = dataArrays.clone(); @@ -54,9 +62,10 @@ public final class DataBufferUShort extends DataBuffer { /** * Instantiates a new data buffer of type unsigned short. * - * @param dataArrays the data arrays to copy the data from - * @param size the length (number of elements) to use - * from the data arrays + * @param dataArrays + * the data arrays to copy the data from. + * @param size + * the length (number of elements) to use from the data arrays. */ public DataBufferUShort(short dataArrays[][], int size) { super(TYPE_USHORT, size, dataArrays.length); @@ -64,16 +73,19 @@ public final class DataBufferUShort extends DataBuffer { } /** - * Instantiates a new data buffer of type unsigned short - * with a single underlying array of data. + * Instantiates a new data buffer of type unsigned short with a single + * underlying array of data. * - * @param dataArray the data array to copy the data from - * @param size the length (number of elements) to use - * @param offset the starting index to use when reading the data + * @param dataArray + * the data array to copy the data from. + * @param size + * the length (number of elements) to use. + * @param offset + * the starting index to use when reading the data. */ public DataBufferUShort(short dataArray[], int size, int offset) { super(TYPE_USHORT, size, 1, offset); - if(dataArray.length < size + offset){ + if (dataArray.length < size + offset) { // awt.28E=Length of dataArray is less than size + offset throw new IllegalArgumentException(Messages.getString("awt.28E")); //$NON-NLS-1$ } @@ -82,12 +94,13 @@ public final class DataBufferUShort extends DataBuffer { } /** - * Instantiates a new data buffer of type unsigned short - * with a single underlying array of data starting at - * index 0. + * Instantiates a new data buffer of type unsigned short with a single + * underlying array of data starting at index 0. * - * @param dataArray the data array to copy the data from - * @param size the length (number of elements) to use + * @param dataArray + * the data array to copy the data from. + * @param size + * the length (number of elements) to use. */ public DataBufferUShort(short dataArray[], int size) { super(TYPE_USHORT, size); @@ -96,28 +109,29 @@ public final class DataBufferUShort extends DataBuffer { } /** - * Instantiates a new empty data buffer of type unsigned short - * with offsets equal to zero. + * Instantiates a new empty data buffer of type unsigned short with offsets + * equal to zero. * - * @param size the length (number of elements) to use - * from the data arrays - * @param numBanks the number of data arrays to create + * @param size + * the length (number of elements) to use from the data arrays. + * @param numBanks + * the number of data arrays to create. */ public DataBufferUShort(int size, int numBanks) { super(TYPE_USHORT, size, numBanks); data = new short[numBanks][]; - int i= 0; - while( i < numBanks) { + int i = 0; + while (i < numBanks) { data[i++] = new short[size]; } } /** - * Instantiates a new empty data buffer of type unsigned short - * with a single underlying array of data starting at - * index 0. + * Instantiates a new empty data buffer of type unsigned short with a single + * underlying array of data starting at index 0. * - * @param size the length (number of elements) to use + * @param size + * the length (number of elements) to use. */ public DataBufferUShort(int size) { super(TYPE_USHORT, size); @@ -145,9 +159,9 @@ public final class DataBufferUShort extends DataBuffer { /** * Gets the data of the specified internal data array. * - * @param bank the index of the desired data array - * - * @return the data + * @param bank + * the index of the desired data array. + * @return the data. */ public short[] getData(int bank) { notifyTaken(); @@ -162,7 +176,7 @@ public final class DataBufferUShort extends DataBuffer { /** * Gets the bank data. * - * @return the bank data + * @return the bank data. */ public short[][] getBankData() { notifyTaken(); @@ -172,11 +186,10 @@ public final class DataBufferUShort extends DataBuffer { /** * Gets the data of the first data array. * - * @return the data + * @return the data. */ public short[] getData() { notifyTaken(); return data[0]; } } - diff --git a/awt/java/awt/image/DirectColorModel.java b/awt/java/awt/image/DirectColorModel.java index 7a287c00e5b49..700eb7a39e5e9 100644 --- a/awt/java/awt/image/DirectColorModel.java +++ b/awt/java/awt/image/DirectColorModel.java @@ -18,6 +18,7 @@ * @author Igor V. Stolyarov * @version $Revision$ */ + package java.awt.image; import java.awt.color.ColorSpace; @@ -28,104 +29,141 @@ import org.apache.harmony.awt.gl.color.LUTColorConverter; import org.apache.harmony.awt.internal.nls.Messages; /** - * The Class DirectColorModel represents a standard (packed) RGB - * color model with additional support for converting between sRGB - * color space and 8 or 16 bit linear RGB color space using lookup tables. + * The Class DirectColorModel represents a standard (packed) RGB color model + * with additional support for converting between sRGB color space and 8 or 16 + * bit linear RGB color space using lookup tables. + * + * @since Android 1.0 */ public class DirectColorModel extends PackedColorModel { - /** The from_ linea r_ rg b_ lut. */ + /** + * The from_ linea r_ rg b_ lut. + */ private byte from_LINEAR_RGB_LUT[]; // Lookup table for conversion from - // Linear RGB Color Space into sRGB - /** The to_ linea r_8 rg b_ lut. */ - private byte to_LINEAR_8RGB_LUT[]; // Lookup table for conversion from - // sRGB Color Space into Linear RGB - // 8 bit + // Linear RGB Color Space into sRGB + + /** + * The to_ linea r_8 rg b_ lut. + */ + private byte to_LINEAR_8RGB_LUT[]; // Lookup table for conversion from - /** The to_ linea r_16 rg b_ lut. */ - private short to_LINEAR_16RGB_LUT[]; // Lookup table for conversion from - // sRGB Color Space into Linear RGB - // 16 bit + // sRGB Color Space into Linear RGB + // 8 bit - /** The alpha lut. */ - private byte alphaLUT[]; // Lookup table for scale alpha value + /** + * The to_ linea r_16 rg b_ lut. + */ + private short to_LINEAR_16RGB_LUT[]; // Lookup table for conversion from - /** The color lu ts. */ - private byte colorLUTs[][]; // Lookup tables for scale color values + // sRGB Color Space into Linear RGB + // 16 bit - /** The is_s rgb. */ - private boolean is_sRGB; // ColorModel has sRGB ColorSpace + /** + * The alpha lut. + */ + private byte alphaLUT[]; // Lookup table for scale alpha value + + /** + * The color lu ts. + */ + private byte colorLUTs[][]; // Lookup tables for scale color values + + /** + * The is_s rgb. + */ + private boolean is_sRGB; // ColorModel has sRGB ColorSpace + + /** + * The is_ linea r_ rgb. + */ + private boolean is_LINEAR_RGB; // Color Model has Linear RGB Color - /** The is_ linea r_ rgb. */ - private boolean is_LINEAR_RGB; // Color Model has Linear RGB Color - // Space + // Space - /** The LINEA r_ rg b_ length. */ - private int LINEAR_RGB_Length; // Linear RGB bit length + /** + * The LINEA r_ rg b_ length. + */ + private int LINEAR_RGB_Length; // Linear RGB bit length - /** The factor. */ - private float fFactor; // Scale factor + /** + * The factor. + */ + private float fFactor; // Scale factor /** * Instantiates a new direct color model. * - * @param space the color space - * @param bits the array of component masks - * @param rmask the bitmask corresponding to the red band - * @param gmask the bitmask corresponding to the green band - * @param bmask the bitmask corresponding to the blue band - * @param amask the bitmask corresponding to the alpha band - * @param isAlphaPremultiplied whether the alpha is premultiplied in this color model - * @param transferType the transfer type (primitive java type - * to use for the components) - * - * @throws IllegalArgumentException if the number of bits in the combined - * bitmasks for the color bands is less than one or greater than 32 + * @param space + * the color space. + * @param bits + * the array of component masks. + * @param rmask + * the bitmask corresponding to the red band. + * @param gmask + * the bitmask corresponding to the green band. + * @param bmask + * the bitmask corresponding to the blue band. + * @param amask + * the bitmask corresponding to the alpha band. + * @param isAlphaPremultiplied + * whether the alpha is pre-multiplied in this color model. + * @param transferType + * the transfer type (primitive java type to use for the + * components). + * @throws IllegalArgumentException + * if the number of bits in the combined bitmasks for the color + * bands is less than one or greater than 32. */ - public DirectColorModel(ColorSpace space, int bits, int rmask, int gmask, - int bmask, int amask, boolean isAlphaPremultiplied, - int transferType) { + public DirectColorModel(ColorSpace space, int bits, int rmask, int gmask, int bmask, int amask, + boolean isAlphaPremultiplied, int transferType) { super(space, bits, rmask, gmask, bmask, amask, isAlphaPremultiplied, - (amask == 0 ? Transparency.OPAQUE : Transparency.TRANSLUCENT), - transferType); + (amask == 0 ? Transparency.OPAQUE : Transparency.TRANSLUCENT), transferType); initLUTs(); } /** - * Instantiates a new direct color model, determining the transfer - * type from the bits array, the transparency from the alpha mask, - * and the default color space {@link ColorSpace#CS_sRGB}. + * Instantiates a new direct color model, determining the transfer type from + * the bits array, the transparency from the alpha mask, and the default + * color space {@link ColorSpace#CS_sRGB}. * - * @param bits the array of component masks - * @param rmask the bitmask corresponding to the red band - * @param gmask the bitmask corresponding to the green band - * @param bmask the bitmask corresponding to the blue band - * @param amask the bitmask corresponding to the alpha band + * @param bits + * the array of component masks. + * @param rmask + * the bitmask corresponding to the red band. + * @param gmask + * the bitmask corresponding to the green band. + * @param bmask + * the bitmask corresponding to the blue band. + * @param amask + * the bitmask corresponding to the alpha band. */ - public DirectColorModel(int bits, int rmask, int gmask, int bmask, - int amask) { + public DirectColorModel(int bits, int rmask, int gmask, int bmask, int amask) { - super(ColorSpace.getInstance(ColorSpace.CS_sRGB), bits, rmask, gmask, - bmask, amask, false, - (amask == 0 ? Transparency.OPAQUE : Transparency.TRANSLUCENT), - ColorModel.getTransferType(bits)); + super(ColorSpace.getInstance(ColorSpace.CS_sRGB), bits, rmask, gmask, bmask, amask, false, + (amask == 0 ? Transparency.OPAQUE : Transparency.TRANSLUCENT), ColorModel + .getTransferType(bits)); initLUTs(); } /** - * Instantiates a new direct color model with no alpha channel, - * determining the transfer type from the bits array, - * the default color space {@link ColorSpace#CS_sRGB}, - * and with the transparency set to {@link Transparency#OPAQUE}. + * Instantiates a new direct color model with no alpha channel, determining + * the transfer type from the bits array, the default color space + * {@link ColorSpace#CS_sRGB}, and with the transparency set to + * {@link Transparency#OPAQUE}. * - * @param bits the array of component masks - * @param rmask the bitmask corresponding to the red band - * @param gmask the bitmask corresponding to the green band - * @param bmask the bitmask corresponding to the blue band + * @param bits + * the array of component masks. + * @param rmask + * the bitmask corresponding to the red band. + * @param gmask + * the bitmask corresponding to the green band. + * @param bmask + * the bitmask corresponding to the blue band. */ public DirectColorModel(int bits, int rmask, int gmask, int bmask) { this(bits, rmask, gmask, bmask, 0); @@ -139,42 +177,42 @@ public class DirectColorModel extends PackedColorModel { } switch (transferType) { - case DataBuffer.TYPE_BYTE: - byte ba[]; - if (obj == null) { - ba = new byte[1]; - } else { - ba = (byte[]) obj; - } - ba[0] = (byte) pixel; - obj = ba; - break; - - case DataBuffer.TYPE_USHORT: - short sa[]; - if (obj == null) { - sa = new short[1]; - } else { - sa = (short[]) obj; - } - sa[0] = (short) pixel; - obj = sa; - break; + case DataBuffer.TYPE_BYTE: + byte ba[]; + if (obj == null) { + ba = new byte[1]; + } else { + ba = (byte[])obj; + } + ba[0] = (byte)pixel; + obj = ba; + break; - case DataBuffer.TYPE_INT: - int ia[]; - if (obj == null) { - ia = new int[1]; - } else { - ia = (int[]) obj; - } - ia[0] = pixel; - obj = ia; - break; + case DataBuffer.TYPE_USHORT: + short sa[]; + if (obj == null) { + sa = new short[1]; + } else { + sa = (short[])obj; + } + sa[0] = (short)pixel; + obj = sa; + break; + + case DataBuffer.TYPE_INT: + int ia[]; + if (obj == null) { + ia = new int[1]; + } else { + ia = (int[])obj; + } + ia[0] = pixel; + obj = ia; + break; - default: - // awt.214=This Color Model doesn't support this transferType - throw new UnsupportedOperationException(Messages.getString("awt.214")); //$NON-NLS-1$ + default: + // awt.214=This Color Model doesn't support this transferType + throw new UnsupportedOperationException(Messages.getString("awt.214")); //$NON-NLS-1$ } return obj; @@ -187,7 +225,7 @@ public class DirectColorModel extends PackedColorModel { if (pixel == null) { ia = new int[1]; } else { - ia = (int[]) pixel; + ia = (int[])pixel; } ia[0] = rgb; return ia; @@ -246,67 +284,66 @@ public class DirectColorModel extends PackedColorModel { int pxl = 0; if (hasAlpha) { float normAlpha = normComp[numColorComponents]; - alpha = (int) (normAlpha * maxValues[numColorComponents] + 0.5f); + alpha = (int)(normAlpha * maxValues[numColorComponents] + 0.5f); if (isAlphaPremultiplied) { - red = (int) (normComp[0] * normAlpha * maxValues[0] + 0.5f); - green = (int) (normComp[1] * normAlpha * maxValues[1] + 0.5f); - blue = (int) (normComp[2] * normAlpha * maxValues[2] + 0.5f); + red = (int)(normComp[0] * normAlpha * maxValues[0] + 0.5f); + green = (int)(normComp[1] * normAlpha * maxValues[1] + 0.5f); + blue = (int)(normComp[2] * normAlpha * maxValues[2] + 0.5f); } else { - red = (int) (normComp[0] * maxValues[0] + 0.5f); - green = (int) (normComp[1] * maxValues[1] + 0.5f); - blue = (int) (normComp[2] * maxValues[2] + 0.5f); + red = (int)(normComp[0] * maxValues[0] + 0.5f); + green = (int)(normComp[1] * maxValues[1] + 0.5f); + blue = (int)(normComp[2] * maxValues[2] + 0.5f); } pxl = (alpha << offsets[3]) & componentMasks[3]; } else { - red = (int) (normComp[0] * maxValues[0] + 0.5f); - green = (int) (normComp[1] * maxValues[1] + 0.5f); - blue = (int) (normComp[2] * maxValues[2] + 0.5f); + red = (int)(normComp[0] * maxValues[0] + 0.5f); + green = (int)(normComp[1] * maxValues[1] + 0.5f); + blue = (int)(normComp[2] * maxValues[2] + 0.5f); } - pxl |= ((red << offsets[0]) & componentMasks[0]) | - ((green << offsets[1]) & componentMasks[1]) | - ((blue << offsets[2]) & componentMasks[2]); + pxl |= ((red << offsets[0]) & componentMasks[0]) + | ((green << offsets[1]) & componentMasks[1]) + | ((blue << offsets[2]) & componentMasks[2]); switch (transferType) { - case DataBuffer.TYPE_BYTE: - byte ba[]; - if (pixel == null) { - ba = new byte[1]; - } else { - ba = (byte[]) pixel; - } - ba[0] = (byte) pxl; - return ba; + case DataBuffer.TYPE_BYTE: + byte ba[]; + if (pixel == null) { + ba = new byte[1]; + } else { + ba = (byte[])pixel; + } + ba[0] = (byte)pxl; + return ba; - case DataBuffer.TYPE_USHORT: - short sa[]; - if (pixel == null) { - sa = new short[1]; - } else { - sa = (short[]) pixel; - } - sa[0] = (short) pxl; - return sa; + case DataBuffer.TYPE_USHORT: + short sa[]; + if (pixel == null) { + sa = new short[1]; + } else { + sa = (short[])pixel; + } + sa[0] = (short)pxl; + return sa; - case DataBuffer.TYPE_INT: - int ia[]; - if (pixel == null) { - ia = new int[1]; - } else { - ia = (int[]) pixel; - } - ia[0] = pxl; - return ia; + case DataBuffer.TYPE_INT: + int ia[]; + if (pixel == null) { + ia = new int[1]; + } else { + ia = (int[])pixel; + } + ia[0] = pxl; + return ia; - default: - // awt.214=This Color Model doesn't support this transferType - throw new UnsupportedOperationException(Messages.getString("awt.214")); //$NON-NLS-1$ + default: + // awt.214=This Color Model doesn't support this transferType + throw new UnsupportedOperationException(Messages.getString("awt.214")); //$NON-NLS-1$ } } @Override - public final ColorModel coerceData(WritableRaster raster, - boolean isAlphaPremultiplied) { + public final ColorModel coerceData(WritableRaster raster, boolean isAlphaPremultiplied) { if (!hasAlpha || this.isAlphaPremultiplied == isAlphaPremultiplied) { return this; @@ -324,86 +361,82 @@ public class DirectColorModel extends PackedColorModel { if (isAlphaPremultiplied) { switch (transferType) { - case DataBuffer.TYPE_BYTE: - case DataBuffer.TYPE_USHORT: - case DataBuffer.TYPE_INT: - for (int i = 0; i < h; i++, minY++) { - for (int j = 0, x = minX; j < w; j++, x++) { - components = raster.getPixel(x, minY, components); - if (components[numColorComponents] == 0) { - raster.setPixel(x, minY, transparentComponents); - } else { - float alpha = - components[numColorComponents] / - alphaFactor; - for (int n = 0; n < numColorComponents; n++) { - components[n] = - (int) (alpha * components[n] + 0.5f); + case DataBuffer.TYPE_BYTE: + case DataBuffer.TYPE_USHORT: + case DataBuffer.TYPE_INT: + for (int i = 0; i < h; i++, minY++) { + for (int j = 0, x = minX; j < w; j++, x++) { + components = raster.getPixel(x, minY, components); + if (components[numColorComponents] == 0) { + raster.setPixel(x, minY, transparentComponents); + } else { + float alpha = components[numColorComponents] / alphaFactor; + for (int n = 0; n < numColorComponents; n++) { + components[n] = (int)(alpha * components[n] + 0.5f); + } + raster.setPixel(x, minY, components); } - raster.setPixel(x, minY, components); } - } - } - break; + } + break; - default: - // awt.214=This Color Model doesn't support this transferType - throw new UnsupportedOperationException(Messages.getString("awt.214")); //$NON-NLS-1$ + default: + // awt.214=This Color Model doesn't support this + // transferType + throw new UnsupportedOperationException(Messages.getString("awt.214")); //$NON-NLS-1$ } } else { switch (transferType) { - case DataBuffer.TYPE_BYTE: - case DataBuffer.TYPE_USHORT: - case DataBuffer.TYPE_INT: - for (int i = 0; i < h; i++, minY++) { - for (int j = 0, x = minX; j < w; j++, x++) { - components = raster.getPixel(x, minY, components); - if (components[numColorComponents] != 0) { - float alpha = - alphaFactor / components[numColorComponents]; - for (int n = 0; n < numColorComponents; n++) { - components[n] = - (int) (alpha * components[n] + 0.5f); + case DataBuffer.TYPE_BYTE: + case DataBuffer.TYPE_USHORT: + case DataBuffer.TYPE_INT: + for (int i = 0; i < h; i++, minY++) { + for (int j = 0, x = minX; j < w; j++, x++) { + components = raster.getPixel(x, minY, components); + if (components[numColorComponents] != 0) { + float alpha = alphaFactor / components[numColorComponents]; + for (int n = 0; n < numColorComponents; n++) { + components[n] = (int)(alpha * components[n] + 0.5f); + } + raster.setPixel(x, minY, components); } - raster.setPixel(x, minY, components); } - } - } - break; + } + break; - default: - // awt.214=This Color Model doesn't support this transferType - throw new UnsupportedOperationException(Messages.getString("awt.214")); //$NON-NLS-1$ + default: + // awt.214=This Color Model doesn't support this + // transferType + throw new UnsupportedOperationException(Messages.getString("awt.214")); //$NON-NLS-1$ } } - return new DirectColorModel(cs, pixel_bits, componentMasks[0], - componentMasks[1], componentMasks[2], componentMasks[3], - isAlphaPremultiplied, transferType); + return new DirectColorModel(cs, pixel_bits, componentMasks[0], componentMasks[1], + componentMasks[2], componentMasks[3], isAlphaPremultiplied, transferType); } @Override public String toString() { - // The output format based on 1.5 release behaviour. + // The output format based on 1.5 release behaviour. // It could be reveled such way: - // BufferedImage bi = new BufferedImage(1, 1, BufferedImage.TYPE_INT_ARGB); + // BufferedImage bi = new BufferedImage(1, 1, + // BufferedImage.TYPE_INT_ARGB); // ColorModel cm = bi.getColorModel(); // System.out.println(cm.toString()); String str = "DirectColorModel:" + " rmask = " + //$NON-NLS-1$ //$NON-NLS-2$ - Integer.toHexString(componentMasks[0]) + " gmask = " + //$NON-NLS-1$ - Integer.toHexString(componentMasks[1]) + " bmask = " + //$NON-NLS-1$ - Integer.toHexString(componentMasks[2]) + " amask = " + //$NON-NLS-1$ - (!hasAlpha ? "0" : Integer.toHexString(componentMasks[3])); //$NON-NLS-1$ + Integer.toHexString(componentMasks[0]) + " gmask = " + //$NON-NLS-1$ + Integer.toHexString(componentMasks[1]) + " bmask = " + //$NON-NLS-1$ + Integer.toHexString(componentMasks[2]) + " amask = " + //$NON-NLS-1$ + (!hasAlpha ? "0" : Integer.toHexString(componentMasks[3])); //$NON-NLS-1$ return str; } @Override - public final int[] getComponents(Object pixel, int components[], - int offset) { + public final int[] getComponents(Object pixel, int components[], int offset) { if (components == null) { components = new int[numComponents + offset]; @@ -412,25 +445,26 @@ public class DirectColorModel extends PackedColorModel { int intPixel = 0; switch (transferType) { - case DataBuffer.TYPE_BYTE: - byte ba[] = (byte[]) pixel; - intPixel = ba[0] & 0xff; - break; + case DataBuffer.TYPE_BYTE: + byte ba[] = (byte[])pixel; + intPixel = ba[0] & 0xff; + break; - case DataBuffer.TYPE_USHORT: - short sa[] = (short[]) pixel; - intPixel = sa[0] & 0xffff; - break; + case DataBuffer.TYPE_USHORT: + short sa[] = (short[])pixel; + intPixel = sa[0] & 0xffff; + break; - case DataBuffer.TYPE_INT: - int ia[] = (int[]) pixel; - intPixel = ia[0]; - break; + case DataBuffer.TYPE_INT: + int ia[] = (int[])pixel; + intPixel = ia[0]; + break; - default: - // awt.22D=This transferType ( {0} ) is not supported by this color model - throw new UnsupportedOperationException(Messages.getString("awt.22D", //$NON-NLS-1$ - transferType)); + default: + // awt.22D=This transferType ( {0} ) is not supported by this + // color model + throw new UnsupportedOperationException(Messages.getString("awt.22D", //$NON-NLS-1$ + transferType)); } return getComponents(intPixel, components, offset); @@ -440,24 +474,24 @@ public class DirectColorModel extends PackedColorModel { public int getRed(Object inData) { int pixel = 0; switch (transferType) { - case DataBuffer.TYPE_BYTE: - byte ba[] = (byte[]) inData; - pixel = ba[0] & 0xff; - break; + case DataBuffer.TYPE_BYTE: + byte ba[] = (byte[])inData; + pixel = ba[0] & 0xff; + break; - case DataBuffer.TYPE_USHORT: - short sa[] = (short[]) inData; - pixel = sa[0] & 0xffff; - break; + case DataBuffer.TYPE_USHORT: + short sa[] = (short[])inData; + pixel = sa[0] & 0xffff; + break; - case DataBuffer.TYPE_INT: - int ia[] = (int[]) inData; - pixel = ia[0]; - break; + case DataBuffer.TYPE_INT: + int ia[] = (int[])inData; + pixel = ia[0]; + break; - default: - // awt.214=This Color Model doesn't support this transferType - throw new UnsupportedOperationException(Messages.getString("awt.214")); //$NON-NLS-1$ + default: + // awt.214=This Color Model doesn't support this transferType + throw new UnsupportedOperationException(Messages.getString("awt.214")); //$NON-NLS-1$ } return getRed(pixel); } @@ -466,24 +500,24 @@ public class DirectColorModel extends PackedColorModel { public int getRGB(Object inData) { int pixel = 0; switch (transferType) { - case DataBuffer.TYPE_BYTE: - byte ba[] = (byte[]) inData; - pixel = ba[0] & 0xff; - break; + case DataBuffer.TYPE_BYTE: + byte ba[] = (byte[])inData; + pixel = ba[0] & 0xff; + break; - case DataBuffer.TYPE_USHORT: - short sa[] = (short[]) inData; - pixel = sa[0] & 0xffff; - break; + case DataBuffer.TYPE_USHORT: + short sa[] = (short[])inData; + pixel = sa[0] & 0xffff; + break; - case DataBuffer.TYPE_INT: - int ia[] = (int[]) inData; - pixel = ia[0]; - break; + case DataBuffer.TYPE_INT: + int ia[] = (int[])inData; + pixel = ia[0]; + break; - default: - // awt.214=This Color Model doesn't support this transferType - throw new UnsupportedOperationException(Messages.getString("awt.214")); //$NON-NLS-1$ + default: + // awt.214=This Color Model doesn't support this transferType + throw new UnsupportedOperationException(Messages.getString("awt.214")); //$NON-NLS-1$ } return getRGB(pixel); } @@ -492,24 +526,24 @@ public class DirectColorModel extends PackedColorModel { public int getGreen(Object inData) { int pixel = 0; switch (transferType) { - case DataBuffer.TYPE_BYTE: - byte ba[] = (byte[]) inData; - pixel = ba[0] & 0xff; - break; + case DataBuffer.TYPE_BYTE: + byte ba[] = (byte[])inData; + pixel = ba[0] & 0xff; + break; - case DataBuffer.TYPE_USHORT: - short sa[] = (short[]) inData; - pixel = sa[0] & 0xffff; - break; + case DataBuffer.TYPE_USHORT: + short sa[] = (short[])inData; + pixel = sa[0] & 0xffff; + break; - case DataBuffer.TYPE_INT: - int ia[] = (int[]) inData; - pixel = ia[0]; - break; + case DataBuffer.TYPE_INT: + int ia[] = (int[])inData; + pixel = ia[0]; + break; - default: - // awt.214=This Color Model doesn't support this transferType - throw new UnsupportedOperationException(Messages.getString("awt.214")); //$NON-NLS-1$ + default: + // awt.214=This Color Model doesn't support this transferType + throw new UnsupportedOperationException(Messages.getString("awt.214")); //$NON-NLS-1$ } return getGreen(pixel); } @@ -518,24 +552,24 @@ public class DirectColorModel extends PackedColorModel { public int getBlue(Object inData) { int pixel = 0; switch (transferType) { - case DataBuffer.TYPE_BYTE: - byte ba[] = (byte[]) inData; - pixel = ba[0] & 0xff; - break; + case DataBuffer.TYPE_BYTE: + byte ba[] = (byte[])inData; + pixel = ba[0] & 0xff; + break; - case DataBuffer.TYPE_USHORT: - short sa[] = (short[]) inData; - pixel = sa[0] & 0xffff; - break; + case DataBuffer.TYPE_USHORT: + short sa[] = (short[])inData; + pixel = sa[0] & 0xffff; + break; - case DataBuffer.TYPE_INT: - int ia[] = (int[]) inData; - pixel = ia[0]; - break; + case DataBuffer.TYPE_INT: + int ia[] = (int[])inData; + pixel = ia[0]; + break; - default: - // awt.214=This Color Model doesn't support this transferType - throw new UnsupportedOperationException(Messages.getString("awt.214")); //$NON-NLS-1$ + default: + // awt.214=This Color Model doesn't support this transferType + throw new UnsupportedOperationException(Messages.getString("awt.214")); //$NON-NLS-1$ } return getBlue(pixel); } @@ -544,24 +578,24 @@ public class DirectColorModel extends PackedColorModel { public int getAlpha(Object inData) { int pixel = 0; switch (transferType) { - case DataBuffer.TYPE_BYTE: - byte ba[] = (byte[]) inData; - pixel = ba[0] & 0xff; - break; + case DataBuffer.TYPE_BYTE: + byte ba[] = (byte[])inData; + pixel = ba[0] & 0xff; + break; - case DataBuffer.TYPE_USHORT: - short sa[] = (short[]) inData; - pixel = sa[0] & 0xffff; - break; + case DataBuffer.TYPE_USHORT: + short sa[] = (short[])inData; + pixel = sa[0] & 0xffff; + break; - case DataBuffer.TYPE_INT: - int ia[] = (int[]) inData; - pixel = ia[0]; - break; + case DataBuffer.TYPE_INT: + int ia[] = (int[])inData; + pixel = ia[0]; + break; - default: - // awt.214=This Color Model doesn't support this transferType - throw new UnsupportedOperationException(Messages.getString("awt.214")); //$NON-NLS-1$ + default: + // awt.214=This Color Model doesn't support this transferType + throw new UnsupportedOperationException(Messages.getString("awt.214")); //$NON-NLS-1$ } return getAlpha(pixel); } @@ -576,14 +610,11 @@ public class DirectColorModel extends PackedColorModel { int bandMasks[] = componentMasks.clone(); if (pixel_bits > 16) { - return Raster.createPackedRaster(DataBuffer.TYPE_INT, w, h, - bandMasks, null); + return Raster.createPackedRaster(DataBuffer.TYPE_INT, w, h, bandMasks, null); } else if (pixel_bits > 8) { - return Raster.createPackedRaster(DataBuffer.TYPE_USHORT, w, h, - bandMasks, null); + return Raster.createPackedRaster(DataBuffer.TYPE_USHORT, w, h, bandMasks, null); } else { - return Raster.createPackedRaster(DataBuffer.TYPE_BYTE, w, h, - bandMasks, null); + return Raster.createPackedRaster(DataBuffer.TYPE_BYTE, w, h, bandMasks, null); } } @@ -594,7 +625,7 @@ public class DirectColorModel extends PackedColorModel { return false; } - SinglePixelPackedSampleModel sppsm = (SinglePixelPackedSampleModel) sm; + SinglePixelPackedSampleModel sppsm = (SinglePixelPackedSampleModel)sm; if (sppsm.getNumBands() != numComponents) { return false; @@ -640,8 +671,8 @@ public class DirectColorModel extends PackedColorModel { @Override public final int getRGB(int pixel) { - return (getAlpha(pixel) << 24) | (getRed(pixel) << 16) | - (getGreen(pixel) << 8) | getBlue(pixel); + return (getAlpha(pixel) << 24) | (getRed(pixel) << 16) | (getGreen(pixel) << 8) + | getBlue(pixel); } @Override @@ -681,7 +712,7 @@ public class DirectColorModel extends PackedColorModel { /** * Gets the red mask. * - * @return the red mask + * @return the red mask. */ public final int getRedMask() { return componentMasks[0]; @@ -690,7 +721,7 @@ public class DirectColorModel extends PackedColorModel { /** * Gets the green mask. * - * @return the green mask + * @return the green mask. */ public final int getGreenMask() { return componentMasks[1]; @@ -699,7 +730,7 @@ public class DirectColorModel extends PackedColorModel { /** * Gets the blue mask. * - * @return the blue mask + * @return the blue mask. */ public final int getBlueMask() { return componentMasks[2]; @@ -708,7 +739,7 @@ public class DirectColorModel extends PackedColorModel { /** * Gets the alpha mask. * - * @return the alpha mask + * @return the alpha mask. */ public final int getAlphaMask() { if (hasAlpha) { @@ -727,16 +758,12 @@ public class DirectColorModel extends PackedColorModel { if (is_LINEAR_RGB) { if (maxBitLength > 8) { LINEAR_RGB_Length = 16; - from_LINEAR_RGB_LUT = - LUTColorConverter.getFrom16lRGBtosRGB_LUT(); - to_LINEAR_16RGB_LUT = - LUTColorConverter.getFromsRGBto16lRGB_LUT(); + from_LINEAR_RGB_LUT = LUTColorConverter.getFrom16lRGBtosRGB_LUT(); + to_LINEAR_16RGB_LUT = LUTColorConverter.getFromsRGBto16lRGB_LUT(); } else { LINEAR_RGB_Length = 8; - from_LINEAR_RGB_LUT = - LUTColorConverter.getFrom8lRGBtosRGB_LUT(); - to_LINEAR_8RGB_LUT = - LUTColorConverter.getFromsRGBto8lRGB_LUT(); + from_LINEAR_RGB_LUT = LUTColorConverter.getFrom8lRGBtosRGB_LUT(); + to_LINEAR_8RGB_LUT = LUTColorConverter.getFromsRGBto8lRGB_LUT(); } fFactor = ((1 << LINEAR_RGB_Length) - 1); } else { @@ -746,7 +773,7 @@ public class DirectColorModel extends PackedColorModel { if (hasAlpha && bits[3] != 8) { alphaLUT = new byte[maxValues[3] + 1]; for (int i = 0; i <= maxValues[3]; i++) { - alphaLUT[i] = (byte) (scales[3] * i + 0.5f); + alphaLUT[i] = (byte)(scales[3] * i + 0.5f); } } @@ -765,7 +792,7 @@ public class DirectColorModel extends PackedColorModel { } colorLUTs[i] = new byte[maxValues[i] + 1]; for (int j = 0; j <= maxValues[i]; j++) { - colorLUTs[i][j] = (byte) (scales[i] * j + 0.5f); + colorLUTs[i][j] = (byte)(scales[i] * j + 0.5f); } } } @@ -784,9 +811,9 @@ public class DirectColorModel extends PackedColorModel { for (int j = 0; j <= maxValues[0]; j++) { int idx; if (LINEAR_RGB_Length == 8) { - idx = (int) (scales[i] * j + 0.5f); + idx = (int)(scales[i] * j + 0.5f); } else { - idx = (int) (scales[i] * j * 257.0f + 0.5f); + idx = (int)(scales[i] * j * 257.0f + 0.5f); } colorLUTs[i][j] = from_LINEAR_RGB_LUT[idx]; } @@ -798,20 +825,20 @@ public class DirectColorModel extends PackedColorModel { } /** - * This method return RGB component value if Color Model has - * sRGB ColorSpace. + * This method return RGB component value if Color Model has sRGB + * ColorSpace. * - * @param pixel - INT representation of pixel - * @param idx - index of pixel component - * - * @return - value of the pixel component scaled fro 0 to 255 + * @param pixel + * the integer representation of the pixel. + * @param idx + * the index of the pixel component. + * @return the value of the pixel component scaled from 0 to 255. */ private int getComponentFrom_sRGB(int pixel, int idx) { int comp = (pixel & componentMasks[idx]) >> offsets[idx]; if (isAlphaPremultiplied) { int alpha = (pixel & componentMasks[3]) >>> offsets[3]; - comp = alpha == 0 ? 0 : (int) (scales[idx] * comp * 255.0f / - (scales[3] * alpha) + 0.5f); + comp = alpha == 0 ? 0 : (int)(scales[idx] * comp * 255.0f / (scales[3] * alpha) + 0.5f); } else if (bits[idx] != 8) { comp = colorLUTs[idx][comp] & 0xff; } @@ -819,21 +846,21 @@ public class DirectColorModel extends PackedColorModel { } /** - * This method return RGB component value if Color Model has - * Linear RGB ColorSpace. - * - * @param pixel - INT representation of pixel - * @param idx - index of pixel component + * This method return RGB component value if Color Model has Linear RGB + * ColorSpace. * - * @return - value of the pixel component scaled fro 0 to 255 + * @param pixel + * the integer representation of the pixel. + * @param idx + * the index of the pixel component. + * @return the value of the pixel component scaled from 0 to 255. */ private int getComponentFrom_LINEAR_RGB(int pixel, int idx) { int comp = (pixel & componentMasks[idx]) >> offsets[idx]; if (isAlphaPremultiplied) { float factor = ((1 << LINEAR_RGB_Length) - 1); int alpha = (pixel & componentMasks[3]) >> offsets[3]; - comp = alpha == 0 ? 0 : (int) (scales[idx] * comp * factor / - (scales[3] * alpha) + 0.5f); + comp = alpha == 0 ? 0 : (int)(scales[idx] * comp * factor / (scales[3] * alpha) + 0.5f); } else if (bits[idx] != LINEAR_RGB_Length) { comp = colorLUTs[idx][comp] & 0xff; } else { @@ -843,20 +870,20 @@ public class DirectColorModel extends PackedColorModel { } /** - * This method return RGB component value if Color Model has - * arbitrary RGB ColorSapce. + * This method return RGB component value if Color Model has arbitrary RGB + * ColorSapce. * - * @param pixel - INT representation of pixel - * @param idx - index of pixel component - * - * @return - value of the pixel component scaled fro 0 to 255 + * @param pixel + * the integer representation of the pixel. + * @param idx + * the index of the pixel component. + * @return the value of the pixel component scaled from 0 to 255. */ private int getComponentFrom_RGB(int pixel, int idx) { int components[] = getComponents(pixel, null, 0); float[] normComponents = getNormalizedComponents(components, 0, null, 0); float[] sRGBcomponents = cs.toRGB(normComponents); - return (int) (sRGBcomponents[idx] * 255.0f + 0.5f); + return (int)(sRGBcomponents[idx] * 255.0f + 0.5f); } } - diff --git a/awt/java/awt/image/FilteredImageSource.java b/awt/java/awt/image/FilteredImageSource.java index 6a41fa76a2ffe..ed8558d3c5e5c 100644 --- a/awt/java/awt/image/FilteredImageSource.java +++ b/awt/java/awt/image/FilteredImageSource.java @@ -18,32 +18,42 @@ * @author Igor V. Stolyarov * @version $Revision$ */ + package java.awt.image; import java.util.Hashtable; - /** - * The FilteredImageSource class is used for producing image data for a new - * filtered version of the original image using the specified filter object. + * The FilteredImageSource class is used for producing image data for a new + * filtered version of the original image using the specified filter object. + * + * @since Android 1.0 */ public class FilteredImageSource implements ImageProducer { - /** The source. */ + /** + * The source. + */ private final ImageProducer source; - - /** The filter. */ + + /** + * The filter. + */ private final ImageFilter filter; - /** The cons table. */ + /** + * The cons table. + */ private final Hashtable consTable = new Hashtable(); /** - * Instantiates a new FilteredImageSource object with - * the specified ImageProducer and the ImageFilter objects. + * Instantiates a new FilteredImageSource object with the specified + * ImageProducer and the ImageFilter objects. * - * @param orig the specified ImageProducer. - * @param imgf the specified ImageFilter. + * @param orig + * the specified ImageProducer. + * @param imgf + * the specified ImageFilter. */ public FilteredImageSource(ImageProducer orig, ImageFilter imgf) { source = orig; @@ -51,7 +61,7 @@ public class FilteredImageSource implements ImageProducer { } public synchronized boolean isConsumer(ImageConsumer ic) { - if(ic != null) { + if (ic != null) { return consTable.containsKey(ic); } return false; @@ -64,14 +74,14 @@ public class FilteredImageSource implements ImageProducer { } public void requestTopDownLeftRightResend(ImageConsumer ic) { - if(ic != null && isConsumer(ic)){ - ImageFilter fic = (ImageFilter) consTable.get(ic); + if (ic != null && isConsumer(ic)) { + ImageFilter fic = (ImageFilter)consTable.get(ic); fic.resendTopDownLeftRight(source); } } public synchronized void removeConsumer(ImageConsumer ic) { - if(ic != null && isConsumer(ic)){ + if (ic != null && isConsumer(ic)) { ImageConsumer fic = consTable.get(ic); source.removeConsumer(fic); consTable.remove(ic); @@ -79,7 +89,7 @@ public class FilteredImageSource implements ImageProducer { } public synchronized void addConsumer(ImageConsumer ic) { - if(ic != null && !isConsumer(ic)){ + if (ic != null && !isConsumer(ic)) { ImageConsumer fic = filter.getFilterInstance(ic); source.addConsumer(fic); consTable.put(ic, fic); diff --git a/awt/java/awt/image/ImageConsumer.java b/awt/java/awt/image/ImageConsumer.java index 2eba290d54d39..caf87d108847d 100644 --- a/awt/java/awt/image/ImageConsumer.java +++ b/awt/java/awt/image/ImageConsumer.java @@ -18,148 +18,168 @@ * @author Igor V. Stolyarov * @version $Revision$ */ + package java.awt.image; import java.util.Hashtable; /** - * The ImageConsumer interface provides the data about the image - * and about how its data is delivered. A ImageProducer provides - * all of the information about the image using - * the methods defined in this interface. + * The ImageConsumer interface provides the data about the image and about how + * its data is delivered. A ImageProducer provides all of the information about + * the image using the methods defined in this interface. + * + * @since Android 1.0 */ public interface ImageConsumer { - /** - * The Constant RANDOMPIXELORDER indicates that the pixels are - * delivered in a random order. + /** + * The Constant RANDOMPIXELORDER indicates that the pixels are delivered in + * a random order. */ public static final int RANDOMPIXELORDER = 1; - /** - * The Constant TOPDOWNLEFTRIGHT indicates that the pixels are - * delivered in top-down, left-to-right order. + /** + * The Constant TOPDOWNLEFTRIGHT indicates that the pixels are delivered in + * top-down, left-to-right order. */ public static final int TOPDOWNLEFTRIGHT = 2; - /** - * The Constant COMPLETESCANLINES indicates that the pixels are - * delivered in complete scanline. + /** + * The Constant COMPLETESCANLINES indicates that the pixels are delivered in + * complete scanline. */ public static final int COMPLETESCANLINES = 4; - /** - * The Constant SINGLEPASS indicates that pixels are delivered - * in a single pass. + /** + * The Constant SINGLEPASS indicates that pixels are delivered in a single + * pass. */ public static final int SINGLEPASS = 8; - /** - * The Constant SINGLEFRAME indicates that image consists of - * single frame. + /** + * The Constant SINGLEFRAME indicates that image consists of single frame. */ public static final int SINGLEFRAME = 16; - /** + /** * The Constant IMAGEERROR indicates an image error during image producing. */ public static final int IMAGEERROR = 1; - /** - * The Constant SINGLEFRAMEDONE indicates that only one of the - * image's frames is completed. + /** + * The Constant SINGLEFRAMEDONE indicates that only one of the image's + * frames is completed. */ public static final int SINGLEFRAMEDONE = 2; - /** - * The Constant STATICIMAGEDONE indicates that the image is completed. + /** + * The Constant STATICIMAGEDONE indicates that the image is completed. */ public static final int STATICIMAGEDONE = 3; - /** - * The Constant IMAGEABORTED indicates that the image producing - * process is aborted. + /** + * The Constant IMAGEABORTED indicates that the image producing process is + * aborted. */ public static final int IMAGEABORTED = 4; /** * Sets the properties for the image associated with this ImageConsumer. * - * @param props the properties for the image associated with - * this ImageConsumer. + * @param props + * the properties for the image associated with this + * ImageConsumer. */ public void setProperties(Hashtable props); /** * Sets the ColorModel object. * - * @param model the new ColorModel. + * @param model + * the new ColorModel. */ public void setColorModel(ColorModel model); /** * Sets the pixels for the specified rectangular area of the image. * - * @param x the X coordinate of rectangular area. - * @param y the Y coordinate of rectangular area. - * @param w the width of rectangular area. - * @param h the height of rectangular area. - * @param model the specified ColorModel to be used for pixels - * converting. - * @param pixels the array of pixels. - * @param off the offset of pixels array. - * @param scansize the distance from the one row of pixels - * to the next row in the specified array. - */ - public void setPixels(int x, int y, int w, int h, ColorModel model, - int[] pixels, int off, int scansize); + * @param x + * the X coordinate of rectangular area. + * @param y + * the Y coordinate of rectangular area. + * @param w + * the width of rectangular area. + * @param h + * the height of rectangular area. + * @param model + * the specified ColorModel to be used for pixels converting. + * @param pixels + * the array of pixels. + * @param off + * the offset of pixels array. + * @param scansize + * the distance from the one row of pixels to the next row in the + * specified array. + */ + public void setPixels(int x, int y, int w, int h, ColorModel model, int[] pixels, int off, + int scansize); /** * Sets the pixels for the specified rectangular area of the image. * - * @param x the X coordinate of rectangular area. - * @param y the Y coordinate of rectangular area. - * @param w the width of rectangular area. - * @param h the height of rectangular area. - * @param model the specified ColorModel to be used for pixels - * converting. - * @param pixels the array of pixels. - * @param off the offset of pixels array. - * @param scansize the distance from the one row of pixels - * to the next row in the specified array. - */ - public void setPixels(int x, int y, int w, int h, ColorModel model, - byte[] pixels, int off, int scansize); + * @param x + * the X coordinate of rectangular area. + * @param y + * the Y coordinate of rectangular area. + * @param w + * the width of rectangular area. + * @param h + * the height of rectangular area. + * @param model + * the specified ColorModel to be used for pixels converting. + * @param pixels + * the array of pixels. + * @param off + * the offset of pixels array. + * @param scansize + * the distance from the one row of pixels to the next row in the + * specified array. + */ + public void setPixels(int x, int y, int w, int h, ColorModel model, byte[] pixels, int off, + int scansize); /** * Sets the dimensions of a source image. * - * @param width the width of the image. - * @param height the height of the image. + * @param width + * the width of the image. + * @param height + * the height of the image. */ public void setDimensions(int width, int height); /** - * Sets the hint flags of pixels order, which is used by - * the ImageConsumer for obtaining pixels from the ImageProducer - * for which this ImageConsumer is added. + * Sets the hint flags of pixels order, which is used by the ImageConsumer + * for obtaining pixels from the ImageProducer for which this ImageConsumer + * is added. * - * @param hintflags the mask of hint flags. + * @param hintflags + * the mask of hint flags. */ public void setHints(int hintflags); /** * THis method is called in the one of the following cases: *

      - *
    • The ImageProducer (for which this ImageConsumer is added) - * has been delivered all pixels of the source image.
    • - *
    • A one frame of an animation has been completed.
    • - *
    • An error while loading or producing of the image has occured. - *
    + *
  • The ImageProducer (for which this ImageConsumer is added) has been + * delivered all pixels of the source image.
  • + *
  • A one frame of an animation has been completed.
  • + *
  • An error while loading or producing of the image has occurred. + * * - * @param status the status of image producing. + * @param status + * the status of image producing. */ public void imageComplete(int status); } - diff --git a/awt/java/awt/image/ImageFilter.java b/awt/java/awt/image/ImageFilter.java index e386d657a82e2..d2c9f50248238 100644 --- a/awt/java/awt/image/ImageFilter.java +++ b/awt/java/awt/image/ImageFilter.java @@ -18,17 +18,22 @@ * @author Igor V. Stolyarov * @version $Revision$ */ + package java.awt.image; import java.util.Hashtable; /** - * The ImageFilter class provides a filter for delivering image data - * from an ImageProducer to an ImageConsumer. + * The ImageFilter class provides a filter for delivering image data from an + * ImageProducer to an ImageConsumer. + * + * @since Android 1.0 */ public class ImageFilter implements ImageConsumer, Cloneable { - /** The consumer. */ + /** + * The consumer. + */ protected ImageConsumer consumer; /** @@ -39,16 +44,16 @@ public class ImageFilter implements ImageConsumer, Cloneable { } /** - * Gets an instance of an ImageFilter object which performs - * the filtering for the specified ImageConsumer. - * - * @param ic the specified ImageConsumer. + * Gets an instance of an ImageFilter object which performs the filtering + * for the specified ImageConsumer. * - * @return an ImageFilter used to perform the filtering for - * the specified ImageConsumer. + * @param ic + * the specified ImageConsumer. + * @return an ImageFilter used to perform the filtering for the specified + * ImageConsumer. */ public ImageFilter getFilterInstance(ImageConsumer ic) { - ImageFilter filter = (ImageFilter) clone(); + ImageFilter filter = (ImageFilter)clone(); filter.consumer = ic; return filter; } @@ -59,14 +64,14 @@ public class ImageFilter implements ImageConsumer, Cloneable { if (props == null) { fprops = new Hashtable(); } else { - fprops = (Hashtable) props.clone(); + fprops = (Hashtable)props.clone(); } String propName = "Filters"; //$NON-NLS-1$ String prop = "Null filter"; //$NON-NLS-1$ Object o = fprops.get(propName); if (o != null) { if (o instanceof String) { - prop = (String) o + "; " + prop; //$NON-NLS-1$ + prop = (String)o + "; " + prop; //$NON-NLS-1$ } else { prop = o.toString() + "; " + prop; //$NON-NLS-1$ } @@ -90,11 +95,11 @@ public class ImageFilter implements ImageConsumer, Cloneable { } /** - * Responds to a request for a Top-Down-Left-Right ordered - * resend of the pixel data from an ImageConsumer. + * Responds to a request for a Top-Down-Left-Right ordered resend of the + * pixel data from an ImageConsumer. * - * @param ip the ImageProducer that provides this instance of - * the filter. + * @param ip + * the ImageProducer that provides this instance of the filter. */ public void resendTopDownLeftRight(ImageProducer ip) { ip.requestTopDownLeftRightResend(this); diff --git a/awt/java/awt/image/ImageObserver.java b/awt/java/awt/image/ImageObserver.java index 418bd0766bbcb..21ec41bf25828 100644 --- a/awt/java/awt/image/ImageObserver.java +++ b/awt/java/awt/image/ImageObserver.java @@ -18,82 +18,84 @@ * @author Igor V. Stolyarov * @version $Revision$ */ + package java.awt.image; import java.awt.Image; /** - * the ImageObserver interface is an asynchronous update interface - * for receiving notifications about Image construction status. + * the ImageObserver interface is an asynchronous update interface for receiving + * notifications about Image construction status. + * + * @since Android 1.0 */ public interface ImageObserver { - /** - * The Constant WIDTH indicates that the width of the image is - * available. + /** + * The Constant WIDTH indicates that the width of the image is available. */ public static final int WIDTH = 1; - /** - * The Constant HEIGHT indicates that the width of the image is - * available. + /** + * The Constant HEIGHT indicates that the width of the image is available. */ public static final int HEIGHT = 2; - /** - * The Constant PROPERTIES indicates that the properties of the image - * are available. + /** + * The Constant PROPERTIES indicates that the properties of the image are + * available. */ public static final int PROPERTIES = 4; /** - * The Constant SOMEBITS indicates that more bits needed for - * drawing a scaled variation of the image pixels are available. + * The Constant SOMEBITS indicates that more bits needed for drawing a + * scaled variation of the image pixels are available. */ public static final int SOMEBITS = 8; - /** - * The Constant FRAMEBITS indicates that complete frame of - * a image which was previously drawn is now available - * for drawing again. + /** + * The Constant FRAMEBITS indicates that complete frame of a image which was + * previously drawn is now available for drawing again. */ public static final int FRAMEBITS = 16; - /** - * The Constant ALLBITS indicates that an image which - * was previously drawn is now complete and can be drawn again. + /** + * The Constant ALLBITS indicates that an image which was previously drawn + * is now complete and can be drawn again. */ public static final int ALLBITS = 32; - /** - * The Constant ERROR indicates that error occured. + /** + * The Constant ERROR indicates that error occurred. */ public static final int ERROR = 64; - /** - * The Constant ABORT indicates that the image producing is - * aborted. + /** + * The Constant ABORT indicates that the image producing is aborted. */ public static final int ABORT = 128; /** - * This method is called when information about an Image - * interface becomes available. This method returns true - * if further updates are needed, false if not. - * - * @param img the image to be observed. - * @param infoflags the bitwise OR combination of information flags: - * ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, - * WIDTH. - * @param x the X coordinate. - * @param y the Y coordinate. - * @param width the width. - * @param height the height. + * This method is called when information about an Image interface becomes + * available. This method returns true if further updates are needed, false + * if not. * + * @param img + * the image to be observed. + * @param infoflags + * the bitwise OR combination of information flags: ABORT, + * ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, + * WIDTH. + * @param x + * the X coordinate. + * @param y + * the Y coordinate. + * @param width + * the width. + * @param height + * the height. * @return true if further updates are needed, false if not. */ - public boolean imageUpdate(Image img, int infoflags, int x, int y, - int width, int height); + public boolean imageUpdate(Image img, int infoflags, int x, int y, int width, int height); } - diff --git a/awt/java/awt/image/ImageProducer.java b/awt/java/awt/image/ImageProducer.java index 557ae085a4397..9138be27118f1 100644 --- a/awt/java/awt/image/ImageProducer.java +++ b/awt/java/awt/image/ImageProducer.java @@ -18,57 +18,62 @@ * @author Igor V. Stolyarov * @version $Revision$ */ -package java.awt.image; +package java.awt.image; /** - * The ImageProducer provides an interface for objects which produce - * the image data. ImageProducer is used for reconstructing the - * image. Each image contains an ImageProducer. + * The ImageProducer provides an interface for objects which produce the image + * data. ImageProducer is used for reconstructing the image. Each image contains + * an ImageProducer. + * + * @since Android 1.0 */ public interface ImageProducer { /** - * Checks if the specified ImageConsumer is registered with this + * Checks if the specified ImageConsumer is registered with this * ImageProvider or not. * - * @param ic the ImageConsumer to be checked. - * - * @return true, if the specified ImageConsumer is registered with this - * ImageProvider, false otherwise. + * @param ic + * the ImageConsumer to be checked. + * @return true, if the specified ImageConsumer is registered with this + * ImageProvider, false otherwise. */ public boolean isConsumer(ImageConsumer ic); /** - * Starts a reconstruction of the image data which will - * be delivered to this consumer. This method addes the - * specified ImageConsumer before reconstructing the image. + * Starts a reconstruction of the image data which will be delivered to this + * consumer. This method adds the specified ImageConsumer before + * reconstructing the image. * - * @param ic the specified ImageConsumer. + * @param ic + * the specified ImageConsumer. */ public void startProduction(ImageConsumer ic); /** - * Requests the ImageProducer to resend the image data - * in ImageConsumer.TOPDOWNLEFTRIGHT order. + * Requests the ImageProducer to resend the image data in + * ImageConsumer.TOPDOWNLEFTRIGHT order. * - * @param ic the specified ImageConsumer. + * @param ic + * the specified ImageConsumer. */ public void requestTopDownLeftRightResend(ImageConsumer ic); /** * Deregisters the specified ImageConsumer. * - * @param ic the specified ImageConsumer. + * @param ic + * the specified ImageConsumer. */ public void removeConsumer(ImageConsumer ic); /** * Adds the specified ImageConsumer object to this ImageProducer. * - * @param ic the specified ImageConsumer. + * @param ic + * the specified ImageConsumer. */ public void addConsumer(ImageConsumer ic); } - diff --git a/awt/java/awt/image/ImagingOpException.java b/awt/java/awt/image/ImagingOpException.java index ebcaba42503a3..e0c0127f4a1f6 100644 --- a/awt/java/awt/image/ImagingOpException.java +++ b/awt/java/awt/image/ImagingOpException.java @@ -24,19 +24,24 @@ package java.awt.image; /** - * The ImagingOpException class provides error notification when - * the BufferedImageOp or RasterOp filter methods can not perform - * the desired filter operation. + * The ImagingOpException class provides error notification when the + * BufferedImageOp or RasterOp filter methods can not perform the desired filter + * operation. + * + * @since Android 1.0 */ public class ImagingOpException extends RuntimeException { - - /** The Constant serialVersionUID. */ + + /** + * The Constant serialVersionUID. + */ private static final long serialVersionUID = 8026288481846276658L; /** * Instantiates a new ImagingOpException with a detail message. * - * @param s the detail message. + * @param s + * the detail message. */ public ImagingOpException(String s) { super(s); diff --git a/awt/java/awt/image/IndexColorModel.java b/awt/java/awt/image/IndexColorModel.java index a7043f491c728..0b06acda61047 100644 --- a/awt/java/awt/image/IndexColorModel.java +++ b/awt/java/awt/image/IndexColorModel.java @@ -18,6 +18,7 @@ * @author Igor V. Stolyarov * @version $Revision$ */ + package java.awt.image; import java.awt.Transparency; @@ -27,64 +28,92 @@ import java.math.BigInteger; import org.apache.harmony.awt.internal.nls.Messages; /** - * The Class IndexColorModel represents a color model in which the - * color values of the pixels are read from a palette. + * The Class IndexColorModel represents a color model in which the color values + * of the pixels are read from a palette. + * + * @since Android 1.0 */ public class IndexColorModel extends ColorModel { - /** The color map. */ - private int colorMap[]; // Color Map + /** + * The color map. + */ + private int colorMap[]; // Color Map + + /** + * The map size. + */ + private int mapSize; // Color Map size + + /** + * The transparent index. + */ + private int transparentIndex; // Index of fully transparent pixel + + /** + * The gray palette. + */ + private boolean grayPalette; // Color Model has Color Map with Gray Pallete - /** The map size. */ - private int mapSize; // Color Map size + /** + * The valid bits. + */ + private BigInteger validBits; // Specify valid Color Map values - /** The transparent index. */ - private int transparentIndex; // Index of fully transparent pixel + /** + * The Constant CACHESIZE. + */ + private static final int CACHESIZE = 20; // Cache size. Cache used for - /** The gray palette. */ - private boolean grayPalette; // Color Model has Color Map with Gray Pallete + // improving performace of selection + // nearest color in Color Map - /** The valid bits. */ - private BigInteger validBits; // Specify valid Color Map values + /** + * The cachetable. + */ + private final int cachetable[] = new int[CACHESIZE * 2]; // Cache table - - /** The Constant CACHESIZE. */ - private static final int CACHESIZE = 20; // Cache size. Cache used for - // improving performace of selection - // nearest color in Color Map + // used for - /** The cachetable. */ - private final int cachetable[] = new int[CACHESIZE * 2]; // Cache table - used for - // storing RGB values and that appropriate indices - // in the Color Map - + // storing RGB values and that appropriate indices + // in the Color Map - /** The next insert idx. */ - private int nextInsertIdx = 0; // Next index for insertion into Cache table + /** + * The next insert idx. + */ + private int nextInsertIdx = 0; // Next index for insertion into Cache table - /** The total inserted. */ - private int totalInserted = 0; // Number of inserted values into Cache table + /** + * The total inserted. + */ + private int totalInserted = 0; // Number of inserted values into Cache table /** * Instantiates a new index color model. * - * @param bits the array of component masks - * @param size the size of the color map - * @param cmap the array that gives the color mapping - * @param start the start index of the color mapping data within the cmap array - * @param transferType the transfer type (primitive java type - * to use for the components) - * @param validBits a list of which bits represent valid colormap - * values, or null if all are valid - * - * @throws IllegalArgumentException if the size of the color map is - * less than one + * @param bits + * the array of component masks. + * @param size + * the size of the color map. + * @param cmap + * the array that gives the color mapping. + * @param start + * the start index of the color mapping data within the cmap + * array. + * @param transferType + * the transfer type (primitive java type to use for the + * components). + * @param validBits + * a list of which bits represent valid colormap values, or null + * if all are valid. + * @throws IllegalArgumentException + * if the size of the color map is less than one. */ - public IndexColorModel(int bits, int size, int cmap[], int start, - int transferType, BigInteger validBits) { + public IndexColorModel(int bits, int size, int cmap[], int start, int transferType, + BigInteger validBits) { - super(bits, IndexColorModel.createBits(true), - ColorSpace.getInstance(ColorSpace.CS_sRGB), true, false, - Transparency.OPAQUE, validateTransferType(transferType)); + super(bits, IndexColorModel.createBits(true), ColorSpace.getInstance(ColorSpace.CS_sRGB), + true, false, Transparency.OPAQUE, validateTransferType(transferType)); if (size < 1) { // awt.264=Size of the color map is less than 1 @@ -122,8 +151,7 @@ public class IndexColorModel extends ColorModel { if (transparency == Transparency.OPAQUE) { transparency = Transparency.BITMASK; } - } else if (alpha != alphaMask && - transparency != Transparency.TRANSLUCENT) { + } else if (alpha != alphaMask && transparency != Transparency.TRANSLUCENT) { transparency = Transparency.TRANSLUCENT; } @@ -135,25 +163,31 @@ public class IndexColorModel extends ColorModel { /** * Instantiates a new index color model. * - * @param bits the array of component masks - * @param size the size of the color map - * @param cmap the array that gives the color mapping - * @param start the start index of the color mapping data within the cmap array - * @param hasalpha whether this color model uses alpha - * @param trans the transparency supported, @see java.awt.Transparency - * @param transferType the transfer type (primitive java type - * to use for the components) - * - * @throws IllegalArgumentException if the size of the color map is - * less than one + * @param bits + * the array of component masks. + * @param size + * the size of the color map. + * @param cmap + * the array that gives the color mapping. + * @param start + * the start index of the color mapping data within the cmap + * array. + * @param hasalpha + * whether this color model uses alpha. + * @param trans + * the transparency supported, @see java.awt.Transparency. + * @param transferType + * the transfer type (primitive java type to use for the + * components). + * @throws IllegalArgumentException + * if the size of the color map is less than one. */ - public IndexColorModel(int bits, int size, int cmap[], int start, - boolean hasalpha, int trans, int transferType) { + public IndexColorModel(int bits, int size, int cmap[], int start, boolean hasalpha, int trans, + int transferType) { - super(bits, IndexColorModel.createBits(hasalpha || (trans >= 0)), - ColorSpace.getInstance(ColorSpace.CS_sRGB), - (hasalpha || (trans >= 0)), false, Transparency.OPAQUE, - validateTransferType(transferType)); + super(bits, IndexColorModel.createBits(hasalpha || (trans >= 0)), ColorSpace + .getInstance(ColorSpace.CS_sRGB), (hasalpha || (trans >= 0)), false, + Transparency.OPAQUE, validateTransferType(transferType)); if (size < 1) { // awt.264=Size of the color map is less than 1 @@ -192,8 +226,7 @@ public class IndexColorModel extends ColorModel { if (transparency == Transparency.OPAQUE) { transparency = Transparency.BITMASK; } - } else if (alpha != 0 - && transparency != Transparency.TRANSLUCENT) { + } else if (alpha != 0 && transparency != Transparency.TRANSLUCENT) { transparency = Transparency.TRANSLUCENT; } } else { @@ -205,55 +238,70 @@ public class IndexColorModel extends ColorModel { } /** - * Instantiates a new index color model by building the color map - * from arrays of red, green, blue, and alpha values. + * Instantiates a new index color model by building the color map from + * arrays of red, green, blue, and alpha values. * - * @param bits the array of component masks - * @param size the size of the color map - * @param r the array giving the red components of the entries in the color map - * @param g the array giving the green components of the entries in the color map - * @param b the array giving the blue components of the entries in the color map - * @param a the array giving the alpha components of the entries in the color map - * - * @throws IllegalArgumentException if the size of the color map is - * less than one - * @throws ArrayIndexOutOfBoundsException if the size of one of the - * component arrays is less than the size of the color map + * @param bits + * the array of component masks. + * @param size + * the size of the color map. + * @param r + * the array giving the red components of the entries in the + * color map. + * @param g + * the array giving the green components of the entries in the + * color map. + * @param b + * the array giving the blue components of the entries in the + * color map. + * @param a + * the array giving the alpha components of the entries in the + * color map. + * @throws IllegalArgumentException + * if the size of the color map is less than one. + * @throws ArrayIndexOutOfBoundsException + * if the size of one of the component arrays is less than the + * size of the color map. */ - public IndexColorModel(int bits, int size, byte r[], byte g[], byte b[], - byte a[]) { + public IndexColorModel(int bits, int size, byte r[], byte g[], byte b[], byte a[]) { - super(bits, IndexColorModel.createBits(true), - ColorSpace.getInstance(ColorSpace.CS_sRGB), true, false, - Transparency.OPAQUE, - validateTransferType(ColorModel.getTransferType(bits))); + super(bits, IndexColorModel.createBits(true), ColorSpace.getInstance(ColorSpace.CS_sRGB), + true, false, Transparency.OPAQUE, validateTransferType(ColorModel + .getTransferType(bits))); createColorMap(size, r, g, b, a, -1); checkPalette(); } /** - * Instantiates a new index color model by building the color map - * from arrays of red, green, and blue values. + * Instantiates a new index color model by building the color map from + * arrays of red, green, and blue values. * - * @param bits the array of component masks - * @param size the size of the color map - * @param r the array giving the red components of the entries in the color map - * @param g the array giving the green components of the entries in the color map - * @param b the array giving the blue components of the entries in the color map - * @param trans the transparency supported, @see java.awt.Transparency - * - * @throws IllegalArgumentException if the size of the color map is - * less than one - * @throws ArrayIndexOutOfBoundsException if the size of one of the - * component arrays is less than the size of the color map + * @param bits + * the array of component masks. + * @param size + * the size of the color map. + * @param r + * the array giving the red components of the entries in the + * color map. + * @param g + * the array giving the green components of the entries in the + * color map. + * @param b + * the array giving the blue components of the entries in the + * color map. + * @param trans + * the transparency supported, @see java.awt.Transparency. + * @throws IllegalArgumentException + * if the size of the color map is less than one. + * @throws ArrayIndexOutOfBoundsException + * if the size of one of the component arrays is less than the + * size of the color map. */ - public IndexColorModel(int bits, int size, byte r[], byte g[], byte b[], - int trans) { + public IndexColorModel(int bits, int size, byte r[], byte g[], byte b[], int trans) { - super(bits, IndexColorModel.createBits((trans >= 0)), - ColorSpace.getInstance(ColorSpace.CS_sRGB), (trans >= 0), false, - Transparency.OPAQUE, + super(bits, IndexColorModel.createBits((trans >= 0)), ColorSpace + .getInstance(ColorSpace.CS_sRGB), (trans >= 0), false, Transparency.OPAQUE, validateTransferType(ColorModel.getTransferType(bits))); createColorMap(size, r, g, b, null, trans); @@ -261,25 +309,32 @@ public class IndexColorModel extends ColorModel { } /** - * Instantiates a new index color model by building the color map - * from arrays of red, green, and blue values. - * - * @param bits the array of component masks - * @param size the size of the color map - * @param r the array giving the red components of the entries in the color map - * @param g the array giving the green components of the entries in the color map - * @param b the array giving the blue components of the entries in the color map + * Instantiates a new index color model by building the color map from + * arrays of red, green, and blue values. * - * @throws IllegalArgumentException if the size of the color map is - * less than one - * @throws ArrayIndexOutOfBoundsException if the size of one of the - * component arrays is less than the size of the color map + * @param bits + * the array of component masks. + * @param size + * the size of the color map. + * @param r + * the array giving the red components of the entries in the + * color map. + * @param g + * the array giving the green components of the entries in the + * color map. + * @param b + * the array giving the blue components of the entries in the + * color map. + * @throws IllegalArgumentException + * if the size of the color map is less than one. + * @throws ArrayIndexOutOfBoundsException + * if the size of one of the component arrays is less than the + * size of the color map. */ public IndexColorModel(int bits, int size, byte r[], byte g[], byte b[]) { - super(bits, IndexColorModel.createBits(false), - ColorSpace.getInstance(ColorSpace.CS_sRGB), false, false, - Transparency.OPAQUE, - validateTransferType(ColorModel.getTransferType(bits))); + super(bits, IndexColorModel.createBits(false), ColorSpace.getInstance(ColorSpace.CS_sRGB), + false, false, Transparency.OPAQUE, validateTransferType(ColorModel + .getTransferType(bits))); createColorMap(size, r, g, b, null, -1); checkPalette(); @@ -288,23 +343,27 @@ public class IndexColorModel extends ColorModel { /** * Instantiates a new index color model. * - * @param bits the array of component masks - * @param size the size of the color map - * @param cmap the array that gives the color mapping - * @param start the start index of the color mapping data within the cmap array - * @param hasalpha whether this color model uses alpha - * @param trans the transparency supported, @see java.awt.Transparency - * - * @throws IllegalArgumentException if the size of the color map is - * less than one + * @param bits + * the array of component masks. + * @param size + * the size of the color map. + * @param cmap + * the array that gives the color mapping. + * @param start + * the start index of the color mapping data within the cmap + * array. + * @param hasalpha + * whether this color model uses alpha. + * @param trans + * the transparency supported, @see java.awt.Transparency. + * @throws IllegalArgumentException + * if the size of the color map is less than one. */ - public IndexColorModel(int bits, int size, byte cmap[], int start, - boolean hasalpha, int trans) { + public IndexColorModel(int bits, int size, byte cmap[], int start, boolean hasalpha, int trans) { - super(bits, IndexColorModel.createBits(hasalpha || (trans >= 0)), - ColorSpace.getInstance(ColorSpace.CS_sRGB), - (hasalpha || (trans >= 0)), false, Transparency.OPAQUE, - validateTransferType(ColorModel.getTransferType(bits))); + super(bits, IndexColorModel.createBits(hasalpha || (trans >= 0)), ColorSpace + .getInstance(ColorSpace.CS_sRGB), (hasalpha || (trans >= 0)), false, + Transparency.OPAQUE, validateTransferType(ColorModel.getTransferType(bits))); if (size < 1) { // awt.264=Size of the color map is less than 1 @@ -319,13 +378,13 @@ public class IndexColorModel extends ColorModel { int alpha = 0xff000000; for (int i = 0; i < mapSize; i++) { - colorMap[i] = (cmap[start++] & 0xff) << 16 | - (cmap[start++] & 0xff) << 8 | (cmap[start++] & 0xff); + colorMap[i] = (cmap[start++] & 0xff) << 16 | (cmap[start++] & 0xff) << 8 + | (cmap[start++] & 0xff); if (trans == i) { if (transparency == Transparency.OPAQUE) { transparency = Transparency.BITMASK; } - if(hasalpha) { + if (hasalpha) { start++; } continue; @@ -340,8 +399,7 @@ public class IndexColorModel extends ColorModel { } } } else { - if (alpha != 0xff && - transparency != Transparency.TRANSLUCENT) { + if (alpha != 0xff && transparency != Transparency.TRANSLUCENT) { transparency = Transparency.TRANSLUCENT; } } @@ -360,25 +418,29 @@ public class IndexColorModel extends ColorModel { /** * Instantiates a new index color model. * - * @param bits the array of component masks - * @param size the size of the color map - * @param cmap the array that gives the color mapping - * @param start the start index of the color mapping data within the cmap array - * @param hasalpha whether this color model uses alpha - * - * @throws IllegalArgumentException if the size of the color map is - * less than one + * @param bits + * the array of component masks. + * @param size + * the size of the color map. + * @param cmap + * the array that gives the color mapping. + * @param start + * the start index of the color mapping data within the cmap + * array. + * @param hasalpha + * whether this color model uses alpha. + * @throws IllegalArgumentException + * if the size of the color map is less than one. */ - public IndexColorModel(int bits, int size, byte cmap[], int start, - boolean hasalpha) { + public IndexColorModel(int bits, int size, byte cmap[], int start, boolean hasalpha) { this(bits, size, cmap, start, hasalpha, -1); } @Override public Object getDataElements(int[] components, int offset, Object pixel) { - int rgb = (components[offset] << 16) | (components[offset + 1]) << 8 | - components[offset + 2]; + int rgb = (components[offset] << 16) | (components[offset + 1]) << 8 + | components[offset + 2]; if (hasAlpha) { rgb |= components[offset + 3] << 24; } else { @@ -419,7 +481,7 @@ public class IndexColorModel extends ColorModel { } } else if (alpha == 0 && transparentIndex > -1) { pixIdx = transparentIndex; - } else { + } else { int minAlphaError = 255; int minError = 195075; // 255^2 + 255^2 + 255^2 int alphaError; @@ -470,19 +532,19 @@ public class IndexColorModel extends ColorModel { /** * Converts an image from indexed to RGB format. * - * @param raster the raster containing the source image - * @param forceARGB whether to use the default RGB color model - * - * @return the buffered image - * - * @throws IllegalArgumentException if the raster is not compatible with - * this color model + * @param raster + * the raster containing the source image. + * @param forceARGB + * whether to use the default RGB color model. + * @return the buffered image. + * @throws IllegalArgumentException + * if the raster is not compatible with this color model. */ - public BufferedImage convertToIntDiscrete(Raster raster, - boolean forceARGB) { + public BufferedImage convertToIntDiscrete(Raster raster, boolean forceARGB) { if (!isCompatibleRaster(raster)) { - // awt.265=The raster argument is not compatible with this IndexColorModel + // awt.265=The raster argument is not compatible with this + // IndexColorModel throw new IllegalArgumentException(Messages.getString("awt.265")); //$NON-NLS-1$ } @@ -490,8 +552,7 @@ public class IndexColorModel extends ColorModel { if (forceARGB || transparency == Transparency.TRANSLUCENT) { model = ColorModel.getRGBdefault(); } else if (transparency == Transparency.BITMASK) { - model = new DirectColorModel(25, 0x00ff0000, 0x0000ff00, - 0x000000ff, 0x01000000); + model = new DirectColorModel(25, 0x00ff0000, 0x0000ff00, 0x000000ff, 0x01000000); } else { model = new DirectColorModel(24, 0x00ff0000, 0x0000ff00, 0x000000ff); } @@ -510,7 +571,7 @@ public class IndexColorModel extends ColorModel { for (int i = 0; i < h; i++, minY++) { obj = raster.getDataElements(minX, minY, w, 1, obj); if (obj instanceof byte[]) { - byte ba[] = (byte[]) obj; + byte ba[] = (byte[])obj; if (pixels == null) { pixels = new int[ba.length]; } @@ -518,7 +579,7 @@ public class IndexColorModel extends ColorModel { pixels[j] = colorMap[ba[j] & 0xff]; } } else if (obj instanceof short[]) { - short sa[] = (short[]) obj; + short sa[] = (short[])obj; if (pixels == null) { pixels = new int[sa.length]; } @@ -527,7 +588,7 @@ public class IndexColorModel extends ColorModel { } } if (obj instanceof int[]) { - int ia[] = (int[]) obj; + int ia[] = (int[])obj; if (pixels == null) { pixels = new int[ia.length]; } @@ -545,7 +606,7 @@ public class IndexColorModel extends ColorModel { /** * Gets the valid pixels. * - * @return the valid pixels + * @return the valid pixels. */ public BigInteger getValidPixels() { return validBits; @@ -553,14 +614,15 @@ public class IndexColorModel extends ColorModel { @Override public String toString() { - // The output format based on 1.5 release behaviour. + // The output format based on 1.5 release behaviour. // It could be reveled such way: - // BufferedImage bi = new BufferedImage(1, 1, BufferedImage.TYPE_BYTE_INDEXED); + // BufferedImage bi = new BufferedImage(1, 1, + // BufferedImage.TYPE_BYTE_INDEXED); // ColorModel cm = bi.getColorModel(); // System.out.println(cm.toString()); String str = "IndexColorModel: #pixel_bits = " + pixel_bits + //$NON-NLS-1$ - " numComponents = " + numComponents + " color space = " + cs + //$NON-NLS-1$ //$NON-NLS-2$ - " transparency = "; //$NON-NLS-1$ + " numComponents = " + numComponents + " color space = " + cs + //$NON-NLS-1$ //$NON-NLS-2$ + " transparency = "; //$NON-NLS-1$ if (transparency == Transparency.OPAQUE) { str = str + "Transparency.OPAQUE"; //$NON-NLS-1$ @@ -571,7 +633,7 @@ public class IndexColorModel extends ColorModel { } str = str + " transIndex = " + transparentIndex + " has alpha = " + //$NON-NLS-1$ //$NON-NLS-2$ - hasAlpha + " isAlphaPre = " + isAlphaPremultiplied; //$NON-NLS-1$ + hasAlpha + " isAlphaPre = " + isAlphaPremultiplied; //$NON-NLS-1$ return str; } @@ -580,13 +642,13 @@ public class IndexColorModel extends ColorModel { public int[] getComponents(Object pixel, int components[], int offset) { int pixIdx = -1; if (pixel instanceof byte[]) { - byte ba[] = (byte[]) pixel; + byte ba[] = (byte[])pixel; pixIdx = ba[0] & 0xff; } else if (pixel instanceof short[]) { - short sa[] = (short[]) pixel; + short sa[] = (short[])pixel; pixIdx = sa[0] & 0xffff; } else if (pixel instanceof int[]) { - int ia[] = (int[]) pixel; + int ia[] = (int[])pixel; pixIdx = ia[0]; } else { // awt.219=This transferType is not supported by this color model @@ -600,14 +662,11 @@ public class IndexColorModel extends ColorModel { public WritableRaster createCompatibleWritableRaster(int w, int h) { WritableRaster raster; if (pixel_bits == 1 || pixel_bits == 2 || pixel_bits == 4) { - raster = Raster.createPackedRaster(DataBuffer.TYPE_BYTE, w, h, 1, - pixel_bits, null); + raster = Raster.createPackedRaster(DataBuffer.TYPE_BYTE, w, h, 1, pixel_bits, null); } else if (pixel_bits <= 8) { - raster = Raster.createInterleavedRaster(DataBuffer.TYPE_BYTE, w, h, - 1, null); + raster = Raster.createInterleavedRaster(DataBuffer.TYPE_BYTE, w, h, 1, null); } else if (pixel_bits <= 16) { - raster = Raster.createInterleavedRaster(DataBuffer.TYPE_USHORT, w, - h, 1, null); + raster = Raster.createInterleavedRaster(DataBuffer.TYPE_USHORT, w, h, 1, null); } else { // awt.266=The number of bits in a pixel is greater than 16 throw new UnsupportedOperationException(Messages.getString("awt.266")); //$NON-NLS-1$ @@ -622,8 +681,7 @@ public class IndexColorModel extends ColorModel { return false; } - if (!(sm instanceof MultiPixelPackedSampleModel) - && !(sm instanceof ComponentSampleModel)) { + if (!(sm instanceof MultiPixelPackedSampleModel) && !(sm instanceof ComponentSampleModel)) { return false; } @@ -640,48 +698,45 @@ public class IndexColorModel extends ColorModel { @Override public SampleModel createCompatibleSampleModel(int w, int h) { if (pixel_bits == 1 || pixel_bits == 2 || pixel_bits == 4) { - return new MultiPixelPackedSampleModel(DataBuffer.TYPE_BYTE, w, h, - pixel_bits); + return new MultiPixelPackedSampleModel(DataBuffer.TYPE_BYTE, w, h, pixel_bits); } int bandOffsets[] = new int[1]; bandOffsets[0] = 0; - return new ComponentSampleModel(transferType, w, h, 1, w, - bandOffsets); + return new ComponentSampleModel(transferType, w, h, 1, w, bandOffsets); } @Override public boolean isCompatibleRaster(Raster raster) { int sampleSize = raster.getSampleModel().getSampleSize(0); - return (raster.getTransferType() == transferType && - raster.getNumBands() == 1 && (1 << sampleSize) >= mapSize); + return (raster.getTransferType() == transferType && raster.getNumBands() == 1 && (1 << sampleSize) >= mapSize); } @Override public int getDataElement(int components[], int offset) { int rgb = (components[offset] << 16) | (components[offset + 1]) << 8 | components[offset + 2]; - + if (hasAlpha) { rgb |= components[offset + 3] << 24; } else { rgb |= 0xff000000; } - + int pixel; switch (transferType) { - case DataBuffer.TYPE_BYTE: - byte ba[] = (byte[]) getDataElements(rgb, null); - pixel = ba[0] & 0xff; - break; - case DataBuffer.TYPE_USHORT: - short sa[] = (short[]) getDataElements(rgb, null); - pixel = sa[0] & 0xffff; - break; - default: - // awt.267=The transferType is invalid - throw new UnsupportedOperationException(Messages.getString("awt.267")); //$NON-NLS-1$ + case DataBuffer.TYPE_BYTE: + byte ba[] = (byte[])getDataElements(rgb, null); + pixel = ba[0] & 0xff; + break; + case DataBuffer.TYPE_USHORT: + short sa[] = (short[])getDataElements(rgb, null); + pixel = sa[0] & 0xffff; + break; + default: + // awt.267=The transferType is invalid + throw new UnsupportedOperationException(Messages.getString("awt.267")); //$NON-NLS-1$ } return pixel; @@ -690,7 +745,8 @@ public class IndexColorModel extends ColorModel { /** * Gets the color map. * - * @param rgb the destination array where the color map is written + * @param rgb + * the destination array where the color map is written. */ public final void getRGBs(int rgb[]) { System.arraycopy(colorMap, 0, rgb, 0, mapSize); @@ -699,44 +755,48 @@ public class IndexColorModel extends ColorModel { /** * Gets the red component of the color map. * - * @param r the destination array + * @param r + * the destination array. */ public final void getReds(byte r[]) { for (int i = 0; i < mapSize; i++) { - r[i] = (byte) (colorMap[i] >> 16); + r[i] = (byte)(colorMap[i] >> 16); } } /** * Gets the green component of the color map. * - * @param g the destination array + * @param g + * the destination array. */ public final void getGreens(byte g[]) { for (int i = 0; i < mapSize; i++) { - g[i] = (byte) (colorMap[i] >> 8); + g[i] = (byte)(colorMap[i] >> 8); } } /** * Gets the blue component of the color map. * - * @param b the destination array + * @param b + * the destination array. */ public final void getBlues(byte b[]) { for (int i = 0; i < mapSize; i++) { - b[i] = (byte) colorMap[i]; + b[i] = (byte)colorMap[i]; } } /** * Gets the alpha component of the color map. * - * @param a the destination array + * @param a + * the destination array. */ public final void getAlphas(byte a[]) { for (int i = 0; i < mapSize; i++) { - a[i] = (byte) (colorMap[i] >> 24); + a[i] = (byte)(colorMap[i] >> 24); } } @@ -759,9 +819,9 @@ public class IndexColorModel extends ColorModel { /** * Checks if the specified pixel is valid for this color model. * - * @param pixel the pixel - * - * @return true, if the pixel is valid + * @param pixel + * the pixel. + * @return true, if the pixel is valid. */ public boolean isValid(int pixel) { if (validBits == null) { @@ -803,7 +863,7 @@ public class IndexColorModel extends ColorModel { /** * Checks if this color model validates pixels. * - * @return true, if all pixels are valid, otherwise false + * @return true, if all pixels are valid, otherwise false. */ public boolean isValid() { return (validBits == null); @@ -818,7 +878,7 @@ public class IndexColorModel extends ColorModel { /** * Gets the index that represents the transparent pixel. * - * @return the index that represents the transparent pixel + * @return the index that represents the transparent pixel. */ public final int getTransparentPixel() { return transparentIndex; @@ -832,7 +892,7 @@ public class IndexColorModel extends ColorModel { /** * Gets the size of the color map. * - * @return the map size + * @return the map size. */ public final int getMapSize() { return mapSize; @@ -841,15 +901,20 @@ public class IndexColorModel extends ColorModel { /** * Creates the color map. * - * @param size the size - * @param r the r - * @param g the g - * @param b the b - * @param a the a - * @param trans the trans - */ - private void createColorMap(int size, byte r[], byte g[], byte b[], - byte a[], int trans) { + * @param size + * the size. + * @param r + * the r. + * @param g + * the g. + * @param b + * the b. + * @param a + * the a. + * @param trans + * the trans. + */ + private void createColorMap(int size, byte r[], byte g[], byte b[], byte a[], int trans) { if (size < 1) { // awt.264=Size of the color map is less than 1 throw new IllegalArgumentException(Messages.getString("awt.264")); //$NON-NLS-1$ @@ -867,8 +932,7 @@ public class IndexColorModel extends ColorModel { int alpha = 0; for (int i = 0; i < mapSize; i++) { - colorMap[i] = ((r[i] & 0xff) << 16) | ((g[i] & 0xff) << 8) | - (b[i] & 0xff); + colorMap[i] = ((r[i] & 0xff) << 16) | ((g[i] & 0xff) << 8) | (b[i] & 0xff); if (trans == i) { continue; @@ -900,7 +964,7 @@ public class IndexColorModel extends ColorModel { } /** - * This method checking, if Color Map has Gray Palette. + * This method checking, if Color Map has Gray palette. */ private void checkPalette() { grayPalette = false; @@ -911,8 +975,7 @@ public class IndexColorModel extends ColorModel { for (int i = 0; i < mapSize; i++) { rgb = colorMap[i]; - if (((rgb >> 16) & 0xff) != ((rgb >> 8) & 0xff) || - ((rgb >> 8) & 0xff) != (rgb & 0xff)) { + if (((rgb >> 16) & 0xff) != ((rgb >> 8) & 0xff) || ((rgb >> 8) & 0xff) != (rgb & 0xff)) { return; } } @@ -922,40 +985,39 @@ public class IndexColorModel extends ColorModel { /** * Construction an array pixel representation. * - * @param colorMapIdx - index into Color Map - * @param pixel - pixel - * - * @return - an array pixel representation + * @param colorMapIdx + * the index into Color Map. + * @param pixel + * the pixel + * @return the pixel representation array. */ private Object createDataObject(int colorMapIdx, Object pixel) { if (pixel == null) { switch (transferType) { - case DataBuffer.TYPE_BYTE: - byte[] ba = new byte[1]; - ba[0] = (byte) colorMapIdx; - pixel = ba; - break; - case DataBuffer.TYPE_USHORT: - short[] sa = new short[1]; - sa[0] = (short) colorMapIdx; - pixel = sa; - break; - default: - // awt.267=The transferType is invalid - throw new UnsupportedOperationException(Messages.getString("awt.267")); //$NON-NLS-1$ + case DataBuffer.TYPE_BYTE: + byte[] ba = new byte[1]; + ba[0] = (byte)colorMapIdx; + pixel = ba; + break; + case DataBuffer.TYPE_USHORT: + short[] sa = new short[1]; + sa[0] = (short)colorMapIdx; + pixel = sa; + break; + default: + // awt.267=The transferType is invalid + throw new UnsupportedOperationException(Messages.getString("awt.267")); //$NON-NLS-1$ } - } else if (pixel instanceof byte[] - && transferType == DataBuffer.TYPE_BYTE) { - byte ba[] = (byte[]) pixel; - ba[0] = (byte) colorMapIdx; + } else if (pixel instanceof byte[] && transferType == DataBuffer.TYPE_BYTE) { + byte ba[] = (byte[])pixel; + ba[0] = (byte)colorMapIdx; pixel = ba; - } else if (pixel instanceof short[]&& - transferType == DataBuffer.TYPE_USHORT) { - short[] sa = (short[]) pixel; - sa[0] = (short) colorMapIdx; + } else if (pixel instanceof short[] && transferType == DataBuffer.TYPE_USHORT) { + short[] sa = (short[])pixel; + sa[0] = (short)colorMapIdx; pixel = sa; } else if (pixel instanceof int[]) { - int ia[] = (int[]) pixel; + int ia[] = (int[])pixel; ia[0] = colorMapIdx; pixel = ia; } else { @@ -968,9 +1030,9 @@ public class IndexColorModel extends ColorModel { /** * Creates the bits. * - * @param hasAlpha the has alpha - * - * @return the int[] + * @param hasAlpha + * the has alpha. + * @return the int[]. */ private static int[] createBits(boolean hasAlpha) { @@ -993,28 +1055,26 @@ public class IndexColorModel extends ColorModel { /** * Validate transfer type. * - * @param transferType the transfer type - * - * @return the int + * @param transferType + * the transfer type. + * @return the int. */ private static int validateTransferType(int transferType) { - if (transferType != DataBuffer.TYPE_BYTE && - transferType != DataBuffer.TYPE_USHORT) { - // awt.269=The transferType is not one of DataBuffer.TYPE_BYTE or DataBuffer.TYPE_USHORT + if (transferType != DataBuffer.TYPE_BYTE && transferType != DataBuffer.TYPE_USHORT) { + // awt.269=The transferType is not one of DataBuffer.TYPE_BYTE or + // DataBuffer.TYPE_USHORT throw new IllegalArgumentException(Messages.getString("awt.269")); //$NON-NLS-1$ } return transferType; } /** - * Checks if is gray pallete. + * Checks if is gray palette. * - * @return true, if is gray pallete + * @return true, if is gray palette. */ - boolean isGrayPallete(){ + boolean isGrayPallete() { return grayPalette; } } - - diff --git a/awt/java/awt/image/Kernel.java b/awt/java/awt/image/Kernel.java index c6f00e2b8b5ee..a59d27a11423a 100644 --- a/awt/java/awt/image/Kernel.java +++ b/awt/java/awt/image/Kernel.java @@ -27,38 +27,53 @@ import org.apache.harmony.awt.internal.nls.Messages; /** * The Kernel class provides a matrix. This matrix is stored as a float array - * which describes how a specified pixel affects the value calculated for - * the pixel's position in the output image of a filtering operation. - * The X, Y origins indicate the kernel matrix element which corresponds to - * the pixel position for which an output value is being calculated. + * which describes how a specified pixel affects the value calculated for the + * pixel's position in the output image of a filtering operation. The X, Y + * origins indicate the kernel matrix element which corresponds to the pixel + * position for which an output value is being calculated. + * + * @since Android 1.0 */ public class Kernel implements Cloneable { - - /** The x origin. */ + + /** + * The x origin. + */ private final int xOrigin; - - /** The y origin. */ + + /** + * The y origin. + */ private final int yOrigin; - - /** The width. */ + + /** + * The width. + */ private int width; - - /** The height. */ + + /** + * The height. + */ private int height; - - /** The data. */ + + /** + * The data. + */ float data[]; /** - * Instantiates a new Kernel with the specified float array. - * The width*height elements of the data array are copied. + * Instantiates a new Kernel with the specified float array. The + * width*height elements of the data array are copied. * - * @param width the width of the Kernel. - * @param height the height of the Kernel. - * @param data the data of Kernel. + * @param width + * the width of the Kernel. + * @param height + * the height of the Kernel. + * @param data + * the data of Kernel. */ public Kernel(int width, int height, float[] data) { - int dataLength = width*height; + int dataLength = width * height; if (data.length < dataLength) { // awt.22B=Length of data should not be less than width*height throw new IllegalArgumentException(Messages.getString("awt.22B")); //$NON-NLS-1$ @@ -70,8 +85,8 @@ public class Kernel implements Cloneable { this.data = new float[dataLength]; System.arraycopy(data, 0, this.data, 0, dataLength); - xOrigin = (width-1)/2; - yOrigin = (height-1)/2; + xOrigin = (width - 1) / 2; + yOrigin = (height - 1) / 2; } /** @@ -95,8 +110,8 @@ public class Kernel implements Cloneable { /** * Gets the float data array of this Kernel. * - * @param data the float array where the resulted data will be stored. - * + * @param data + * the float array where the resulted data will be stored. * @return the float data array of this Kernel. */ public final float[] getKernelData(float[] data) { diff --git a/awt/java/awt/image/LookupOp.java b/awt/java/awt/image/LookupOp.java index f9bd2c7b20d7c..3362c5cf79259 100644 --- a/awt/java/awt/image/LookupOp.java +++ b/awt/java/awt/image/LookupOp.java @@ -32,56 +32,76 @@ import org.apache.harmony.awt.gl.AwtImageBackdoorAccessor; import org.apache.harmony.awt.internal.nls.Messages; /** - * The LookupOp class perfoms a lookup operation which transforms a - * source image by filtering each band using a table of data. - * The table may contain a single array or it may contain a - * different data array for each band of the image. + * The LookupOp class performs a lookup operation which transforms a source + * image by filtering each band using a table of data. The table may contain a + * single array or it may contain a different data array for each band of the + * image. + * + * @since Android 1.0 */ public class LookupOp implements BufferedImageOp, RasterOp { - - /** The lut. */ + + /** + * The lut. + */ private final LookupTable lut; - - /** The hints. */ + + /** + * The hints. + */ private RenderingHints hints; - + // TODO remove when this field is used - /** The can use ipp. */ + /** + * The can use ipp. + */ @SuppressWarnings("unused") private final boolean canUseIpp; // We don't create levels/values when it is possible to reuse old - /** The cached levels. */ + /** + * The cached levels. + */ private int cachedLevels[]; - - /** The cached values. */ + + /** + * The cached values. + */ private int cachedValues[]; + // Number of channels for which cache is valid. - // If negative number of channels is same as positive but skipAlpha was specified - /** The valid for channels. */ + // If negative number of channels is same as positive but skipAlpha was + // specified + /** + * The valid for channels. + */ private int validForChannels; - /** The level initializer. */ + /** + * The level initializer. + */ static int levelInitializer[] = new int[0x10000]; static { // TODO // System.loadLibrary("imageops"); - for (int i=1; i<=0x10000; i++) { - levelInitializer[i-1] = i; + for (int i = 1; i <= 0x10000; i++) { + levelInitializer[i - 1] = i; } } /** - * Instantiates a new LookupOp object from the specified - * LookupTable object and a RenderingHints object. + * Instantiates a new LookupOp object from the specified LookupTable object + * and a RenderingHints object. * - * @param lookup the specified LookupTable object. - * @param hints the RenderingHints object or null. + * @param lookup + * the specified LookupTable object. + * @param hints + * the RenderingHints object or null. */ public LookupOp(LookupTable lookup, RenderingHints hints) { - if (lookup == null){ + if (lookup == null) { throw new NullPointerException(Messages.getString("awt.01", "lookup")); //$NON-NLS-1$ //$NON-NLS-2$ } lut = lookup; @@ -136,27 +156,16 @@ public class LookupOp implements BufferedImageOp, RasterOp { transferType = DataBuffer.TYPE_SHORT; } - dstCM = new ComponentColorModel( - dstCM.cs, - dstCM.hasAlpha(), - dstCM.isAlphaPremultiplied, - dstCM.transparency, - transferType - ); + dstCM = new ComponentColorModel(dstCM.cs, dstCM.hasAlpha(), + dstCM.isAlphaPremultiplied, dstCM.transparency, transferType); } } - WritableRaster r = - dstCM.isCompatibleSampleModel(src.getSampleModel()) ? - src.getRaster().createCompatibleWritableRaster(src.getWidth(), src.getHeight()) : - dstCM.createCompatibleWritableRaster(src.getWidth(), src.getHeight()); - - return new BufferedImage( - dstCM, - r, - dstCM.isAlphaPremultiplied(), - null - ); + WritableRaster r = dstCM.isCompatibleSampleModel(src.getSampleModel()) ? src.getRaster() + .createCompatibleWritableRaster(src.getWidth(), src.getHeight()) : dstCM + .createCompatibleWritableRaster(src.getWidth(), src.getHeight()); + + return new BufferedImage(dstCM, r, dstCM.isAlphaPremultiplied(), null); } public final WritableRaster filter(Raster src, WritableRaster dst) { @@ -166,25 +175,27 @@ public class LookupOp implements BufferedImageOp, RasterOp { if (src.getNumBands() != dst.getNumBands()) { throw new IllegalArgumentException(Messages.getString("awt.237")); //$NON-NLS-1$ } } - if (src.getWidth() != dst.getWidth()){ + if (src.getWidth() != dst.getWidth()) { throw new IllegalArgumentException(Messages.getString("awt.28F")); //$NON-NLS-1$ } } - if (src.getHeight() != dst.getHeight()){ + if (src.getHeight() != dst.getHeight()) { throw new IllegalArgumentException(Messages.getString("awt.290")); //$NON-NLS-1$ } } } if (lut.getNumComponents() != 1 && lut.getNumComponents() != src.getNumBands()) { - // awt.238=The number of arrays in the LookupTable does not meet the restrictions + // awt.238=The number of arrays in the LookupTable does not meet the + // restrictions throw new IllegalArgumentException(Messages.getString("awt.238")); //$NON-NLS-1$ } // TODO - // if (!canUseIpp || ippFilter(src, dst, BufferedImage.TYPE_CUSTOM, false) != 0) - if (slowFilter(src, dst, false) != 0) { - // awt.21F=Unable to transform source - throw new ImagingOpException (Messages.getString("awt.21F")); //$NON-NLS-1$ - } + // if (!canUseIpp || ippFilter(src, dst, BufferedImage.TYPE_CUSTOM, + // false) != 0) + if (slowFilter(src, dst, false) != 0) { + // awt.21F=Unable to transform source + throw new ImagingOpException(Messages.getString("awt.21F")); //$NON-NLS-1$ + } return dst; } @@ -202,18 +213,20 @@ public class LookupOp implements BufferedImageOp, RasterOp { int nLUTComponents = lut.getNumComponents(); boolean skipAlpha; if (srcCM.hasAlpha()) { - if (nLUTComponents == 1 || nLUTComponents == nComponents-1) { + if (nLUTComponents == 1 || nLUTComponents == nComponents - 1) { skipAlpha = true; } else if (nLUTComponents == nComponents) { skipAlpha = false; } else { - // awt.229=Number of components in the LUT does not match the number of bands + // awt.229=Number of components in the LUT does not match the + // number of bands throw new IllegalArgumentException(Messages.getString("awt.229")); //$NON-NLS-1$ } } else if (nLUTComponents == 1 || nLUTComponents == nComponents) { skipAlpha = false; } else { - // awt.229=Number of components in the LUT does not match the number of bands + // awt.229=Number of components in the LUT does not match the number + // of bands throw new IllegalArgumentException(Messages.getString("awt.229")); //$NON-NLS-1$ } @@ -222,21 +235,19 @@ public class LookupOp implements BufferedImageOp, RasterOp { finalDst = dst; dst = createCompatibleDestImage(src, null); } else { - if (src.getWidth() != dst.getWidth()){ + if (src.getWidth() != dst.getWidth()) { throw new IllegalArgumentException(Messages.getString("awt.291")); //$NON-NLS-1$ } - if (src.getHeight() != dst.getHeight()){ + if (src.getHeight() != dst.getHeight()) { throw new IllegalArgumentException(Messages.getString("awt.292")); //$NON-NLS-1$ } if (!srcCM.equals(dst.getColorModel())) { // Treat BufferedImage.TYPE_INT_RGB and // BufferedImage.TYPE_INT_ARGB as same - if (!((src.getType() == BufferedImage.TYPE_INT_RGB || src - .getType() == BufferedImage.TYPE_INT_ARGB) && (dst - .getType() == BufferedImage.TYPE_INT_RGB || dst - .getType() == BufferedImage.TYPE_INT_ARGB))) { + if (!((src.getType() == BufferedImage.TYPE_INT_RGB || src.getType() == BufferedImage.TYPE_INT_ARGB) && (dst + .getType() == BufferedImage.TYPE_INT_RGB || dst.getType() == BufferedImage.TYPE_INT_ARGB))) { finalDst = dst; dst = createCompatibleDestImage(src, null); } @@ -244,11 +255,12 @@ public class LookupOp implements BufferedImageOp, RasterOp { } // TODO - //if (!canUseIpp || ippFilter(src.getRaster(), dst.getRaster(), src.getType(), skipAlpha) != 0) - if (slowFilter(src.getRaster(), dst.getRaster(), skipAlpha) != 0) { - // awt.21F=Unable to transform source - throw new ImagingOpException (Messages.getString("awt.21F")); //$NON-NLS-1$ - } + // if (!canUseIpp || ippFilter(src.getRaster(), dst.getRaster(), + // src.getType(), skipAlpha) != 0) + if (slowFilter(src.getRaster(), dst.getRaster(), skipAlpha) != 0) { + // awt.21F=Unable to transform source + throw new ImagingOpException(Messages.getString("awt.21F")); //$NON-NLS-1$ + } if (finalDst != null) { Graphics2D g = finalDst.createGraphics(); @@ -264,11 +276,13 @@ public class LookupOp implements BufferedImageOp, RasterOp { /** * Slow filter. * - * @param src the src - * @param dst the dst - * @param skipAlpha the skip alpha - * - * @return the int + * @param src + * the src. + * @param dst + * the dst. + * @param skipAlpha + * the skip alpha. + * @return the int. */ private final int slowFilter(Raster src, WritableRaster dst, boolean skipAlpha) { int minSrcX = src.getMinX(); @@ -286,39 +300,39 @@ public class LookupOp implements BufferedImageOp, RasterOp { int[] pixels = null; int offset = lut.getOffset(); - if (lut instanceof ByteLookupTable){ + if (lut instanceof ByteLookupTable) { byte[][] byteData = ((ByteLookupTable)lut).getTable(); pixels = src.getPixels(minSrcX, minSrcY, srcWidth, srcHeight, pixels); - if (lut.getNumComponents() != 1){ - for (int i=0; i < pixels.length; i+= numBands){ - for (int b = 0; b < numBands2Process; b++){ - pixels[i+b] = byteData[b][pixels[i+b]-offset] & 0xFF; + if (lut.getNumComponents() != 1) { + for (int i = 0; i < pixels.length; i += numBands) { + for (int b = 0; b < numBands2Process; b++) { + pixels[i + b] = byteData[b][pixels[i + b] - offset] & 0xFF; } } } else { - for (int i=0; i < pixels.length; i+= numBands){ - for (int b = 0; b < numBands2Process; b++){ - pixels[i+b] = byteData[0][pixels[i+b]-offset] & 0xFF; + for (int i = 0; i < pixels.length; i += numBands) { + for (int b = 0; b < numBands2Process; b++) { + pixels[i + b] = byteData[0][pixels[i + b] - offset] & 0xFF; } } } dst.setPixels(minDstX, minDstY, srcWidth, srcHeight, pixels); - } else if (lut instanceof ShortLookupTable){ - short[][] shortData = ((ShortLookupTable)lut).getTable(); + } else if (lut instanceof ShortLookupTable) { + short[][] shortData = ((ShortLookupTable)lut).getTable(); pixels = src.getPixels(minSrcX, minSrcY, srcWidth, srcHeight, pixels); - if (lut.getNumComponents() != 1){ - for (int i=0; i < pixels.length; i+= numBands){ - for (int b = 0; b < numBands2Process; b++){ - pixels[i+b] = shortData[b][pixels[i+b]-offset] & 0xFFFF; + if (lut.getNumComponents() != 1) { + for (int i = 0; i < pixels.length; i += numBands) { + for (int b = 0; b < numBands2Process; b++) { + pixels[i + b] = shortData[b][pixels[i + b] - offset] & 0xFFFF; } } } else { - for (int i=0; i < pixels.length; i+= numBands){ - for (int b = 0; b < numBands2Process; b++){ - pixels[i+b] = shortData[0][pixels[i+b]-offset] & 0xFFFF; + for (int i = 0; i < pixels.length; i += numBands) { + for (int b = 0; b < numBands2Process; b++) { + pixels[i + b] = shortData[0][pixels[i + b] - offset] & 0xFFFF; } } } @@ -328,8 +342,8 @@ public class LookupOp implements BufferedImageOp, RasterOp { int pixel[] = new int[src.getNumBands()]; int maxY = minSrcY + srcHeight; int maxX = minSrcX + srcWidth; - for (int srcY=minSrcY, dstY = minDstY; srcY < maxY; srcY++, dstY++){ - for (int srcX=minSrcX, dstX = minDstX; srcX < maxX; srcX++, dstX++){ + for (int srcY = minSrcY, dstY = minDstY; srcY < maxY; srcY++, dstY++) { + for (int srcX = minSrcX, dstX = minDstX; srcX < maxX; srcX++, dstX++) { src.getPixel(srcX, srcY, pixel); lut.lookupPixel(pixel, pixel); dst.setPixel(dstX, dstY, pixel); @@ -343,16 +357,19 @@ public class LookupOp implements BufferedImageOp, RasterOp { /** * Creates the byte levels. * - * @param channels the channels - * @param skipAlpha the skip alpha - * @param levels the levels - * @param values the values - * @param channelsOrder the channels order + * @param channels + * the channels. + * @param skipAlpha + * the skip alpha. + * @param levels + * the levels. + * @param values + * the values. + * @param channelsOrder + * the channels order. */ - private final void createByteLevels( - int channels, boolean skipAlpha, - int levels[], int values[], int channelsOrder[] - ) { + private final void createByteLevels(int channels, boolean skipAlpha, int levels[], + int values[], int channelsOrder[]) { byte data[][] = ((ByteLookupTable)lut).getTable(); int nLevels = data[0].length; int offset = lut.getOffset(); @@ -360,18 +377,18 @@ public class LookupOp implements BufferedImageOp, RasterOp { // Use one data array for all channels or use several data arrays int dataIncrement = data.length > 1 ? 1 : 0; - for (int ch = 0, dataIdx = 0; ch= data.length)) { + if ((channelOffset == channels - 1 && skipAlpha) || (dataIdx >= data.length)) { continue; } System.arraycopy(levelInitializer, offset, levels, channelBase, nLevels); - for (int from=0, to=channelBase; from 1 ? 1 : 0; - for (int ch = 0, dataIdx = 0; ch= data.length)) { + if ((channelOffset == channels - 1 && skipAlpha) || (dataIdx >= data.length)) { continue; } int channelBase = nLevels * channelOffset; System.arraycopy(levelInitializer, offset, levels, channelBase, nLevels); - for (int from=0, to=channelBase; from properties; - - /** The consumers. */ + + /** + * The consumers. + */ Vector consumers; - - /** The animated. */ + + /** + * The animated. + */ boolean animated; - - /** The fullbuffers. */ + + /** + * The fullbuffers. + */ boolean fullbuffers; - - /** The data type. */ + + /** + * The data type. + */ int dataType; - /** The Constant DATA_TYPE_BYTE. */ + /** + * The Constant DATA_TYPE_BYTE. + */ static final int DATA_TYPE_BYTE = 0; - - /** The Constant DATA_TYPE_INT. */ + + /** + * The Constant DATA_TYPE_INT. + */ static final int DATA_TYPE_INT = 1; /** - * Instantiates a new MemoryImageSource with the specified - * parameters. + * Instantiates a new MemoryImageSource with the specified parameters. * - * @param w the width of the rectangular area of pixels. - * @param h the height of the rectangular area of pixels. - * @param cm the specified ColorModel. - * @param pix the pixel array. - * @param off the offset in the pixel array. - * @param scan the distance from one pixel's row to the next - * in the pixel array. - * @param props the set of properties to be used for image - * processing. + * @param w + * the width of the rectangular area of pixels. + * @param h + * the height of the rectangular area of pixels. + * @param cm + * the specified ColorModel. + * @param pix + * the pixel array. + * @param off + * the offset in the pixel array. + * @param scan + * the distance from one pixel's row to the next in the pixel + * array. + * @param props + * the set of properties to be used for image processing. */ - public MemoryImageSource(int w, int h, ColorModel cm, int pix[], - int off, int scan, Hashtable props) { + public MemoryImageSource(int w, int h, ColorModel cm, int pix[], int off, int scan, + Hashtable props) { init(w, h, cm, pix, off, scan, props); } /** - * Instantiates a new MemoryImageSource with the specified - * parameters. + * Instantiates a new MemoryImageSource with the specified parameters. * - * @param w the width of the rectangular area of pixels. - * @param h the height of the rectangular area of pixels. - * @param cm the specified ColorModel. - * @param pix the pixel array. - * @param off the offset in the pixel array. - * @param scan the distance from one pixel's row to the next - * in the pixel array. - * @param props the set of properties to be used for image - * processing. + * @param w + * the width of the rectangular area of pixels. + * @param h + * the height of the rectangular area of pixels. + * @param cm + * the specified ColorModel. + * @param pix + * the pixel array. + * @param off + * the offset in the pixel array. + * @param scan + * the distance from one pixel's row to the next in the pixel + * array. + * @param props + * the set of properties to be used for image processing. */ - public MemoryImageSource(int w, int h, ColorModel cm, byte pix[], - int off, int scan, Hashtable props) { + public MemoryImageSource(int w, int h, ColorModel cm, byte pix[], int off, int scan, + Hashtable props) { init(w, h, cm, pix, off, scan, props); } /** - * Instantiates a new MemoryImageSource with the specified - * parameters and default RGB ColorModel. + * Instantiates a new MemoryImageSource with the specified parameters and + * default RGB ColorModel. * - * @param w the width of the rectangular area of pixels. - * @param h the height of the rectangular area of pixels. - * @param pix the pixel array. - * @param off the offset in the pixel array. - * @param scan the distance from one pixel's row to the next - * in the pixel array. - * @param props the set of properties to be used for image - * processing. + * @param w + * the width of the rectangular area of pixels. + * @param h + * the height of the rectangular area of pixels. + * @param pix + * the pixel array. + * @param off + * the offset in the pixel array. + * @param scan + * the distance from one pixel's row to the next in the pixel + * array. + * @param props + * the set of properties to be used for image processing. */ - public MemoryImageSource(int w, int h, int pix[], int off, int scan, - Hashtable props) { + public MemoryImageSource(int w, int h, int pix[], int off, int scan, Hashtable props) { init(w, h, ColorModel.getRGBdefault(), pix, off, scan, props); } /** - * Instantiates a new MemoryImageSource with the specified - * parameters. + * Instantiates a new MemoryImageSource with the specified parameters. * - * @param w the width of the rectangular area of pixels. - * @param h the height of the rectangular area of pixels. - * @param cm the specified ColorModel. - * @param pix the pixel array. - * @param off the offset in the pixel array. - * @param scan the distance from one pixel's row to the next - * in the pixel array. + * @param w + * the width of the rectangular area of pixels. + * @param h + * the height of the rectangular area of pixels. + * @param cm + * the specified ColorModel. + * @param pix + * the pixel array. + * @param off + * the offset in the pixel array. + * @param scan + * the distance from one pixel's row to the next in the pixel + * array. */ - public MemoryImageSource(int w, int h, ColorModel cm, int pix[], - int off, int scan) { + public MemoryImageSource(int w, int h, ColorModel cm, int pix[], int off, int scan) { init(w, h, cm, pix, off, scan, null); } /** - * Instantiates a new MemoryImageSource with the specified - * parameters. + * Instantiates a new MemoryImageSource with the specified parameters. * - * @param w the width of the rectangular area of pixels. - * @param h the height of the rectangular area of pixels. - * @param cm the specified ColorModel. - * @param pix the pixel array. - * @param off the offset in the pixel array. - * @param scan the distance from one pixel's row to the next - * in the pixel array. + * @param w + * the width of the rectangular area of pixels. + * @param h + * the height of the rectangular area of pixels. + * @param cm + * the specified ColorModel. + * @param pix + * the pixel array. + * @param off + * the offset in the pixel array. + * @param scan + * the distance from one pixel's row to the next in the pixel + * array. */ - public MemoryImageSource(int w, int h, ColorModel cm, byte pix[], - int off, int scan) { + public MemoryImageSource(int w, int h, ColorModel cm, byte pix[], int off, int scan) { init(w, h, cm, pix, off, scan, null); } /** - * Instantiates a new MemoryImageSource with the specified - * parameters and default RGB ColorModel. + * Instantiates a new MemoryImageSource with the specified parameters and + * default RGB ColorModel. * - * @param w the width of the rectangular area of pixels. - * @param h the height of the rectangular area of pixels. - * @param pix the pixels array. - * @param off the offset in the pixel array. - * @param scan the distance from one pixel's row to the next - * in the pixel array. + * @param w + * the width of the rectangular area of pixels. + * @param h + * the height of the rectangular area of pixels. + * @param pix + * the pixels array. + * @param off + * the offset in the pixel array. + * @param scan + * the distance from one pixel's row to the next in the pixel + * array. */ public MemoryImageSource(int w, int h, int pix[], int off, int scan) { init(w, h, ColorModel.getRGBdefault(), pix, off, scan, null); @@ -184,25 +242,25 @@ public class MemoryImageSource implements ImageProducer { } public void startProduction(ImageConsumer ic) { - if(!isConsumer(ic) && ic != null) { + if (!isConsumer(ic) && ic != null) { consumers.addElement(ic); } - try{ + try { setHeader(ic); setPixels(ic, 0, 0, width, height); - if(animated){ + if (animated) { ic.imageComplete(ImageConsumer.SINGLEFRAMEDONE); - }else{ + } else { ic.imageComplete(ImageConsumer.STATICIMAGEDONE); - if(isConsumer(ic)) { + if (isConsumer(ic)) { removeConsumer(ic); } } - }catch(Exception e){ - if(isConsumer(ic)) { + } catch (Exception e) { + if (isConsumer(ic)) { ic.imageComplete(ImageConsumer.IMAGEERROR); } - if(isConsumer(ic)) { + if (isConsumer(ic)) { removeConsumer(ic); } } @@ -216,26 +274,29 @@ public class MemoryImageSource implements ImageProducer { } public synchronized void addConsumer(ImageConsumer ic) { - if(ic == null || consumers.contains(ic)) { + if (ic == null || consumers.contains(ic)) { return; } consumers.addElement(ic); } /** - * Replaces the pixel data with a new pixel array for holding - * the pixels for this image. If an animation - * flag is set to true value by the setAnimated() method, - * the new pixels will be immediately delivered to the ImageConsumers. + * Replaces the pixel data with a new pixel array for holding the pixels for + * this image. If an animation flag is set to true value by the + * setAnimated() method, the new pixels will be immediately delivered to the + * ImageConsumers. * - * @param newpix the new pixel array. - * @param newmodel the new ColorModel. - * @param offset the offset in the array. - * @param scansize the distance from one row of pixels to the next row - * in the pixel array + * @param newpix + * the new pixel array. + * @param newmodel + * the new ColorModel. + * @param offset + * the offset in the array. + * @param scansize + * the distance from one row of pixels to the next row in the + * pixel array. */ - public synchronized void newPixels(int newpix[], ColorModel newmodel, - int offset, int scansize) { + public synchronized void newPixels(int newpix[], ColorModel newmodel, int offset, int scansize) { this.dataType = DATA_TYPE_INT; this.iData = newpix; this.cm = newmodel; @@ -245,19 +306,22 @@ public class MemoryImageSource implements ImageProducer { } /** - * Replaces the pixel data with a new pixel array for holding - * the pixels for this image. If an animation - * flag is set to true value by the setAnimated() method, - * the new pixels will be immediately delivered to the ImageConsumers. + * Replaces the pixel data with a new pixel array for holding the pixels for + * this image. If an animation flag is set to true value by the + * setAnimated() method, the new pixels will be immediately delivered to the + * ImageConsumers. * - * @param newpix the new pixel array. - * @param newmodel the new ColorModel. - * @param offset the offset in the array. - * @param scansize the distance from one row of pixels to the next row - * in the pixel array + * @param newpix + * the new pixel array. + * @param newmodel + * the new ColorModel. + * @param offset + * the offset in the array. + * @param scansize + * the distance from one row of pixels to the next row in the + * pixel array. */ - public synchronized void newPixels(byte newpix[], ColorModel newmodel, - int offset, int scansize) { + public synchronized void newPixels(byte newpix[], ColorModel newmodel, int offset, int scansize) { this.dataType = DATA_TYPE_BYTE; this.bData = newpix; this.cm = newmodel; @@ -267,33 +331,33 @@ public class MemoryImageSource implements ImageProducer { } /** - * Sets the full buffer updates flag to true. If this is an - * animated image, the image consumers hints are updated - * accordingly. + * Sets the full buffer updates flag to true. If this is an animated image, + * the image consumers hints are updated accordingly. * - * @param fullbuffers the true if the pixel buffer should be sent always. + * @param fullbuffers + * the true if the pixel buffer should be sent always. */ public synchronized void setFullBufferUpdates(boolean fullbuffers) { - if(this.fullbuffers == fullbuffers) { + if (this.fullbuffers == fullbuffers) { return; } this.fullbuffers = fullbuffers; - if(animated){ + if (animated) { Object consAr[] = consumers.toArray(); for (Object element : consAr) { ImageConsumer con = (ImageConsumer)element; - try{ - if(fullbuffers){ - con.setHints(ImageConsumer.TOPDOWNLEFTRIGHT | - ImageConsumer.COMPLETESCANLINES); - }else{ + try { + if (fullbuffers) { + con.setHints(ImageConsumer.TOPDOWNLEFTRIGHT + | ImageConsumer.COMPLETESCANLINES); + } else { con.setHints(ImageConsumer.RANDOMPIXELORDER); } - }catch(Exception e){ - if(isConsumer(con)) { + } catch (Exception e) { + if (isConsumer(con)) { con.imageComplete(ImageConsumer.IMAGEERROR); } - if(isConsumer(con)) { + if (isConsumer(con)) { removeConsumer(con); } } @@ -302,27 +366,28 @@ public class MemoryImageSource implements ImageProducer { } /** - * Sets the flag that tells whether this memory image has more - * than one frame (for animation): true for multiple frames, - * false if this class represents a single frame image. - * - * @param animated whether this image represents an animation. + * Sets the flag that tells whether this memory image has more than one + * frame (for animation): true for multiple frames, false if this class + * represents a single frame image. + * + * @param animated + * whether this image represents an animation. */ public synchronized void setAnimated(boolean animated) { - if(this.animated == animated) { + if (this.animated == animated) { return; } Object consAr[] = consumers.toArray(); for (Object element : consAr) { ImageConsumer con = (ImageConsumer)element; - try{ + try { con.imageComplete(ImageConsumer.STATICIMAGEDONE); - }catch(Exception e){ - if(isConsumer(con)) { + } catch (Exception e) { + if (isConsumer(con)) { con.imageComplete(ImageConsumer.IMAGEERROR); } } - if(isConsumer(con)){ + if (isConsumer(con)) { removeConsumer(con); } } @@ -330,60 +395,63 @@ public class MemoryImageSource implements ImageProducer { } /** - * Sends the specified rectangular area of the buffer to - * ImageConsumers and notifies them that an animation frame - * is completed only if framenotify parameter is true. - * That works only if the animated flag has been set to true - * by the setAnimated() method. If the full buffer update flag - * has been set to true by the setFullBufferUpdates() method, - * then the entire buffer will always be sent ignoring parameters. + * Sends the specified rectangular area of the buffer to ImageConsumers and + * notifies them that an animation frame is completed only if the {@code + * framenotify} parameter is true. That works only if the animated flag has + * been set to true by the setAnimated() method. If the full buffer update + * flag has been set to true by the setFullBufferUpdates() method, then the + * entire buffer will always be sent ignoring parameters. * - * @param x the X coordinate of the rectangular area. - * @param y the Y coordinate of rthe ectangular area. - * @param w the width of the rectangular area. - * @param h the height of the rectangular area. - * @param framenotify true if a SINGLEFRAMEDONE notification - * should be sent to the registered consumers, false otherwise. + * @param x + * the X coordinate of the rectangular area. + * @param y + * the Y coordinate of the rectangular area. + * @param w + * the width of the rectangular area. + * @param h + * the height of the rectangular area. + * @param framenotify + * true if a SINGLEFRAMEDONE notification should be sent to the + * registered consumers, false otherwise. */ - public synchronized void newPixels(int x, int y, int w, int h, - boolean framenotify) { - if(animated){ - if(fullbuffers){ + public synchronized void newPixels(int x, int y, int w, int h, boolean framenotify) { + if (animated) { + if (fullbuffers) { x = 0; y = 0; w = width; h = height; - }else{ - if(x < 0){ + } else { + if (x < 0) { w += x; x = 0; } - if(w > width) { + if (w > width) { w = width - x; } - if(y < 0){ + if (y < 0) { h += y; y = 0; } } - if(h > height) { + if (h > height) { h = height - y; } Object consAr[] = consumers.toArray(); for (Object element : consAr) { ImageConsumer con = (ImageConsumer)element; - try{ - if(w > 0 && h > 0) { + try { + if (w > 0 && h > 0) { setPixels(con, x, y, w, h); } - if(framenotify) { + if (framenotify) { con.imageComplete(ImageConsumer.SINGLEFRAMEDONE); } - }catch(Exception ex){ - if(isConsumer(con)) { + } catch (Exception ex) { + if (isConsumer(con)) { con.imageComplete(ImageConsumer.IMAGEERROR); } - if(isConsumer(con)) { + if (isConsumer(con)) { removeConsumer(con); } } @@ -392,26 +460,29 @@ public class MemoryImageSource implements ImageProducer { } /** - * Sends the specified rectangular area of the buffer to - * the ImageConsumers and notifies them that an animation frame - * is completed if the animated flag has been set to true - * by the setAnimated() method. If the full buffer update flag - * has been set to true by the setFullBufferUpdates() method, + * Sends the specified rectangular area of the buffer to the ImageConsumers + * and notifies them that an animation frame is completed if the animated + * flag has been set to true by the setAnimated() method. If the full buffer + * update flag has been set to true by the setFullBufferUpdates() method, * then the entire buffer will always be sent ignoring parameters. * - * @param x the X coordinate of the rectangular area. - * @param y the Y coordinate of the rectangular area. - * @param w the width of the rectangular area. - * @param h the height of the rectangular area. + * @param x + * the X coordinate of the rectangular area. + * @param y + * the Y coordinate of the rectangular area. + * @param w + * the width of the rectangular area. + * @param h + * the height of the rectangular area. */ public synchronized void newPixels(int x, int y, int w, int h) { newPixels(x, y, w, h, true); } /** - * Sends a new buffer of pixels to the ImageConsumers - * and notifies them that an animation frame is completed if - * the animated flag has been set to true by the setAnimated() method. + * Sends a new buffer of pixels to the ImageConsumers and notifies them that + * an animation frame is completed if the animated flag has been set to true + * by the setAnimated() method. */ public void newPixels() { newPixels(0, 0, width, height, true); @@ -420,16 +491,23 @@ public class MemoryImageSource implements ImageProducer { /** * Inits the. * - * @param width the width - * @param height the height - * @param model the model - * @param pixels the pixels - * @param off the off - * @param scan the scan - * @param prop the prop + * @param width + * the width. + * @param height + * the height. + * @param model + * the model. + * @param pixels + * the pixels. + * @param off + * the off. + * @param scan + * the scan. + * @param prop + * the prop. */ - private void init(int width, int height, ColorModel model, byte pixels[], - int off, int scan, Hashtable prop){ + private void init(int width, int height, ColorModel model, byte pixels[], int off, int scan, + Hashtable prop) { this.width = width; this.height = height; @@ -446,16 +524,23 @@ public class MemoryImageSource implements ImageProducer { /** * Inits the. * - * @param width the width - * @param height the height - * @param model the model - * @param pixels the pixels - * @param off the off - * @param scan the scan - * @param prop the prop + * @param width + * the width. + * @param height + * the height. + * @param model + * the model. + * @param pixels + * the pixels. + * @param off + * the off. + * @param scan + * the scan. + * @param prop + * the prop. */ - private void init(int width, int height, ColorModel model, int pixels[], - int off, int scan, Hashtable prop){ + private void init(int width, int height, ColorModel model, int pixels[], int off, int scan, + Hashtable prop) { this.width = width; this.height = height; @@ -471,42 +556,48 @@ public class MemoryImageSource implements ImageProducer { /** * Sets the pixels. * - * @param con the con - * @param x the x - * @param y the y - * @param w the w - * @param h the h + * @param con + * the con. + * @param x + * the x. + * @param y + * the y. + * @param w + * the w. + * @param h + * the h. */ - private void setPixels(ImageConsumer con, int x, int y, int w, int h){ + private void setPixels(ImageConsumer con, int x, int y, int w, int h) { int pixelOff = scanline * y + offset + x; - switch(dataType){ - case DATA_TYPE_BYTE: - con.setPixels(x, y, w, h, cm, bData, pixelOff, scanline); - break; - case DATA_TYPE_INT: - con.setPixels(x, y, w, h, cm, iData, pixelOff, scanline); - break; - default: - // awt.22A=Wrong type of pixels array - throw new IllegalArgumentException(Messages.getString("awt.22A")); //$NON-NLS-1$ + switch (dataType) { + case DATA_TYPE_BYTE: + con.setPixels(x, y, w, h, cm, bData, pixelOff, scanline); + break; + case DATA_TYPE_INT: + con.setPixels(x, y, w, h, cm, iData, pixelOff, scanline); + break; + default: + // awt.22A=Wrong type of pixels array + throw new IllegalArgumentException(Messages.getString("awt.22A")); //$NON-NLS-1$ } } /** * Sets the header. * - * @param con the new header + * @param con + * the new header. */ - private synchronized void setHeader(ImageConsumer con){ + private synchronized void setHeader(ImageConsumer con) { con.setDimensions(width, height); con.setProperties(properties); con.setColorModel(cm); - con.setHints(animated ? (fullbuffers ? (ImageConsumer.TOPDOWNLEFTRIGHT | - ImageConsumer.COMPLETESCANLINES) : ImageConsumer.RANDOMPIXELORDER) : - (ImageConsumer.TOPDOWNLEFTRIGHT | ImageConsumer.COMPLETESCANLINES | - ImageConsumer.SINGLEPASS | ImageConsumer.SINGLEFRAME)); + con + .setHints(animated ? (fullbuffers ? (ImageConsumer.TOPDOWNLEFTRIGHT | ImageConsumer.COMPLETESCANLINES) + : ImageConsumer.RANDOMPIXELORDER) + : (ImageConsumer.TOPDOWNLEFTRIGHT | ImageConsumer.COMPLETESCANLINES + | ImageConsumer.SINGLEPASS | ImageConsumer.SINGLEFRAME)); } } - diff --git a/awt/java/awt/image/MultiPixelPackedSampleModel.java b/awt/java/awt/image/MultiPixelPackedSampleModel.java index dd44b49ec41dc..3dc13d8f4df3d 100644 --- a/awt/java/awt/image/MultiPixelPackedSampleModel.java +++ b/awt/java/awt/image/MultiPixelPackedSampleModel.java @@ -18,72 +18,93 @@ * @author Igor V. Stolyarov * @version $Revision$ */ + package java.awt.image; import org.apache.harmony.awt.internal.nls.Messages; /** - * The MultiPixelPackedSampleModel class represents image data with one - * band. This class packs multiple pixels with one sample in one data - * element and supports the following data types: DataBuffer.TYPE_BYTE, - * DataBuffer.TYPE_USHORT, or DataBuffer.TYPE_INT. + * The MultiPixelPackedSampleModel class represents image data with one band. + * This class packs multiple pixels with one sample in one data element and + * supports the following data types: DataBuffer.TYPE_BYTE, + * DataBuffer.TYPE_USHORT, or DataBuffer.TYPE_INT. + * + * @since Android 1.0 */ public class MultiPixelPackedSampleModel extends SampleModel { - /** The pixel bit stride. */ + /** + * The pixel bit stride. + */ private int pixelBitStride; - /** The scanline stride. */ + /** + * The scanline stride. + */ private int scanlineStride; - /** The data bit offset. */ + /** + * The data bit offset. + */ private int dataBitOffset; - /** The bit mask. */ + /** + * The bit mask. + */ private int bitMask; - /** The data element size. */ + /** + * The data element size. + */ private int dataElementSize; - /** The pixels per data element. */ + /** + * The pixels per data element. + */ private int pixelsPerDataElement; /** * Instantiates a new MultiPixelPackedSampleModel with the specified * parameters. * - * @param dataType the data type of the samples. - * @param w the width of the image data. - * @param h the height of the image data. - * @param numberOfBits the number of bits per pixel. - * @param scanlineStride the scanline stride of the of the image data. - * @param dataBitOffset the array of the band offsets. + * @param dataType + * the data type of the samples. + * @param w + * the width of the image data. + * @param h + * the height of the image data. + * @param numberOfBits + * the number of bits per pixel. + * @param scanlineStride + * the scanline stride of the of the image data. + * @param dataBitOffset + * the array of the band offsets. */ - public MultiPixelPackedSampleModel(int dataType, int w, int h, - int numberOfBits, int scanlineStride, int dataBitOffset) { + public MultiPixelPackedSampleModel(int dataType, int w, int h, int numberOfBits, + int scanlineStride, int dataBitOffset) { super(dataType, w, h, 1); - if (dataType != DataBuffer.TYPE_BYTE && - dataType != DataBuffer.TYPE_USHORT && - dataType != DataBuffer.TYPE_INT) { + if (dataType != DataBuffer.TYPE_BYTE && dataType != DataBuffer.TYPE_USHORT + && dataType != DataBuffer.TYPE_INT) { // awt.61=Unsupported data type: {0} throw new IllegalArgumentException(Messages.getString("awt.61", //$NON-NLS-1$ dataType)); } this.scanlineStride = scanlineStride; - if(numberOfBits == 0) { + if (numberOfBits == 0) { // awt.20C=Number of Bits equals to zero throw new RasterFormatException(Messages.getString("awt.20C")); //$NON-NLS-1$ } this.pixelBitStride = numberOfBits; this.dataElementSize = DataBuffer.getDataTypeSize(dataType); - if(dataElementSize % pixelBitStride != 0) { - // awt.20D=The number of bits per pixel is not a power of 2 or pixels span data element boundaries + if (dataElementSize % pixelBitStride != 0) { + // awt.20D=The number of bits per pixel is not a power of 2 or + // pixels span data element boundaries throw new RasterFormatException(Messages.getString("awt.20D")); //$NON-NLS-1$ } - if(dataBitOffset % numberOfBits != 0) { + if (dataBitOffset % numberOfBits != 0) { // awt.20E=Data Bit offset is not a multiple of pixel bit stride throw new RasterFormatException(Messages.getString("awt.20E")); //$NON-NLS-1$ } @@ -97,17 +118,20 @@ public class MultiPixelPackedSampleModel extends SampleModel { * Instantiates a new MultiPixelPackedSampleModel with the specified * parameters. * - * @param dataType the data type of the samples. - * @param w the width of the image data. - * @param h the height of the image data. - * @param numberOfBits the number of bits per pixel. + * @param dataType + * the data type of the samples. + * @param w + * the width of the image data. + * @param h + * the height of the image data. + * @param numberOfBits + * the number of bits per pixel. */ - public MultiPixelPackedSampleModel(int dataType, int w, int h, - int numberOfBits) { + public MultiPixelPackedSampleModel(int dataType, int w, int h, int numberOfBits) { - this(dataType, w, h, numberOfBits, (numberOfBits * w + - DataBuffer.getDataTypeSize(dataType) - 1) / - DataBuffer.getDataTypeSize(dataType), 0); + this(dataType, w, h, numberOfBits, + (numberOfBits * w + DataBuffer.getDataTypeSize(dataType) - 1) + / DataBuffer.getDataTypeSize(dataType), 0); } @Override @@ -117,36 +141,36 @@ public class MultiPixelPackedSampleModel extends SampleModel { throw new ArrayIndexOutOfBoundsException(Messages.getString("awt.63")); //$NON-NLS-1$ } switch (getTransferType()) { - case DataBuffer.TYPE_BYTE: - byte bdata[]; - if (obj == null) { - bdata = new byte[1]; - } else { - bdata = (byte[]) obj; - } - bdata[0] = (byte) getSample(x, y, 0, data); - obj = bdata; - break; - case DataBuffer.TYPE_USHORT: - short sdata[]; - if (obj == null) { - sdata = new short[1]; - } else { - sdata = (short[]) obj; - } - sdata[0] = (short) getSample(x, y, 0, data); - obj = sdata; - break; - case DataBuffer.TYPE_INT: - int idata[]; - if (obj == null) { - idata = new int[1]; - } else { - idata = (int[]) obj; - } - idata[0] = getSample(x, y, 0, data); - obj = idata; - break; + case DataBuffer.TYPE_BYTE: + byte bdata[]; + if (obj == null) { + bdata = new byte[1]; + } else { + bdata = (byte[])obj; + } + bdata[0] = (byte)getSample(x, y, 0, data); + obj = bdata; + break; + case DataBuffer.TYPE_USHORT: + short sdata[]; + if (obj == null) { + sdata = new short[1]; + } else { + sdata = (short[])obj; + } + sdata[0] = (short)getSample(x, y, 0, data); + obj = sdata; + break; + case DataBuffer.TYPE_INT: + int idata[]; + if (obj == null) { + idata = new int[1]; + } else { + idata = (int[])obj; + } + idata[0] = getSample(x, y, 0, data); + obj = idata; + break; } return obj; @@ -158,14 +182,14 @@ public class MultiPixelPackedSampleModel extends SampleModel { } /** - * Compares this MultiPixelPackedSampleModel object with - * the specified object. - * - * @param o the Object to be compared. + * Compares this MultiPixelPackedSampleModel object with the specified + * object. * - * @return true, if the object is a MultiPixelPackedSampleModel - * with the same data parameter values as this MultiPixelPackedSampleModel, - * false otherwise. + * @param o + * the Object to be compared. + * @return true, if the object is a MultiPixelPackedSampleModel with the + * same data parameter values as this MultiPixelPackedSampleModel, + * false otherwise. */ @Override public boolean equals(Object o) { @@ -173,17 +197,14 @@ public class MultiPixelPackedSampleModel extends SampleModel { return false; } - MultiPixelPackedSampleModel model = (MultiPixelPackedSampleModel) o; - return this.width == model.width && - this.height == model.height && - this.numBands == model.numBands && - this.dataType == model.dataType && - this.pixelBitStride == model.pixelBitStride && - this.bitMask == model.bitMask && - this.pixelsPerDataElement == model.pixelsPerDataElement && - this.dataElementSize == model.dataElementSize && - this.dataBitOffset == model.dataBitOffset && - this.scanlineStride == model.scanlineStride; + MultiPixelPackedSampleModel model = (MultiPixelPackedSampleModel)o; + return this.width == model.width && this.height == model.height + && this.numBands == model.numBands && this.dataType == model.dataType + && this.pixelBitStride == model.pixelBitStride && this.bitMask == model.bitMask + && this.pixelsPerDataElement == model.pixelsPerDataElement + && this.dataElementSize == model.dataElementSize + && this.dataBitOffset == model.dataBitOffset + && this.scanlineStride == model.scanlineStride; } @Override @@ -231,8 +252,7 @@ public class MultiPixelPackedSampleModel extends SampleModel { int bitnum = dataBitOffset + x * pixelBitStride; int elem = data.getElem(y * scanlineStride + bitnum / dataElementSize); - int shift = dataElementSize - (bitnum & (dataElementSize - 1)) - - pixelBitStride; + int shift = dataElementSize - (bitnum & (dataElementSize - 1)) - pixelBitStride; return (elem >> shift) & bitMask; } @@ -253,15 +273,15 @@ public class MultiPixelPackedSampleModel extends SampleModel { int size = scanlineStride * height; switch (dataType) { - case DataBuffer.TYPE_BYTE: - dataBuffer = new DataBufferByte(size + (dataBitOffset + 7) / 8); - break; - case DataBuffer.TYPE_USHORT: - dataBuffer = new DataBufferUShort(size + (dataBitOffset + 15) / 16); - break; - case DataBuffer.TYPE_INT: - dataBuffer = new DataBufferInt(size + (dataBitOffset + 31) / 32); - break; + case DataBuffer.TYPE_BYTE: + dataBuffer = new DataBufferByte(size + (dataBitOffset + 7) / 8); + break; + case DataBuffer.TYPE_USHORT: + dataBuffer = new DataBufferUShort(size + (dataBitOffset + 15) / 16); + break; + case DataBuffer.TYPE_INT: + dataBuffer = new DataBufferInt(size + (dataBitOffset + 31) / 32); + break; } return dataBuffer; } @@ -269,14 +289,14 @@ public class MultiPixelPackedSampleModel extends SampleModel { /** * Gets the offset of the specified pixel in the data array. * - * @param x the X coordinate of the specified pixel. - * @param y the Y coordinate of the specified pixel. - * + * @param x + * the X coordinate of the specified pixel. + * @param y + * the Y coordinate of the specified pixel. * @return the offset of the specified pixel. */ public int getOffset(int x, int y) { - return y * scanlineStride + (x * pixelBitStride + dataBitOffset) / - dataElementSize; + return y * scanlineStride + (x * pixelBitStride + dataBitOffset) / dataElementSize; } @Override @@ -285,11 +305,11 @@ public class MultiPixelPackedSampleModel extends SampleModel { } /** - * Gets the bit offset in the data element which - * is stored for the specified pixel of a scanline. - * - * @param x the pixel. + * Gets the bit offset in the data element which is stored for the specified + * pixel of a scanline. * + * @param x + * the pixel. * @return the bit offset of the pixel in the data element. */ public int getBitOffset(int x) { @@ -298,7 +318,9 @@ public class MultiPixelPackedSampleModel extends SampleModel { @Override public int[] getSampleSize() { - int sampleSizes[] = { pixelBitStride }; + int sampleSizes[] = { + pixelBitStride + }; return sampleSizes; } @@ -396,54 +418,58 @@ public class MultiPixelPackedSampleModel extends SampleModel { } /** - * This method is used by other methods of this class. The behaviour of - * this method depends on the method which has been invoke this one. The - * argument methodId is used to choose valid behaviour in a particular case. - * If methodId is equal to 1 it means that this method has been invoked by - * the setDataElements() method, 2 - means setPixel(), and setSample() in - * any other cases. + * This method is used by other methods of this class. The behavior of this + * method depends on the method which has been invoke this one. The argument + * methodId is used to choose valid behavior in a particular case. If + * methodId is equal to 1 it means that this method has been invoked by the + * setDataElements() method, 2 - means setPixel(), and setSample() in any + * other cases. * - * @param x the x - * @param y the y - * @param obj the obj - * @param data the data - * @param methodId the method id - * @param s the s + * @param x + * the x. + * @param y + * the y. + * @param obj + * the obj. + * @param data + * the data. + * @param methodId + * the method id. + * @param s + * the s. */ - private void setSample(final int x, final int y, final Object obj, - final DataBuffer data, final int methodId, int s) { + private void setSample(final int x, final int y, final Object obj, final DataBuffer data, + final int methodId, int s) { if ((x < 0) || (y < 0) || (x >= this.width) || (y >= this.height)) { // awt.63=Coordinates are not in bounds - throw new ArrayIndexOutOfBoundsException(Messages - .getString("awt.63")); //$NON-NLS-1$ + throw new ArrayIndexOutOfBoundsException(Messages.getString("awt.63")); //$NON-NLS-1$ } final int bitnum = dataBitOffset + x * pixelBitStride; final int idx = y * scanlineStride + bitnum / dataElementSize; - final int shift = dataElementSize - (bitnum & (dataElementSize - 1)) - - pixelBitStride; + final int shift = dataElementSize - (bitnum & (dataElementSize - 1)) - pixelBitStride; final int mask = ~(bitMask << shift); int elem = data.getElem(idx); switch (methodId) { - case 1: { // Invoked from setDataElements() - switch (getTransferType()) { - case DataBuffer.TYPE_BYTE: - s = ((byte[]) obj)[0] & 0xff; - break; - case DataBuffer.TYPE_USHORT: - s = ((short[]) obj)[0] & 0xffff; + case 1: { // Invoked from setDataElements() + switch (getTransferType()) { + case DataBuffer.TYPE_BYTE: + s = ((byte[])obj)[0] & 0xff; + break; + case DataBuffer.TYPE_USHORT: + s = ((short[])obj)[0] & 0xffff; + break; + case DataBuffer.TYPE_INT: + s = ((int[])obj)[0]; + break; + } break; - case DataBuffer.TYPE_INT: - s = ((int[]) obj)[0]; + } + case 2: { // Invoked from setPixel() + s = ((int[])obj)[0]; break; } - break; - } - case 2: { // Invoked from setPixel() - s = ((int[]) obj)[0]; - break; - } } elem &= mask; @@ -451,4 +477,3 @@ public class MultiPixelPackedSampleModel extends SampleModel { data.setElem(idx, elem); } } - diff --git a/awt/java/awt/image/PackedColorModel.java b/awt/java/awt/image/PackedColorModel.java index 7aaefbfe5c576..4d1c2e5003d9c 100644 --- a/awt/java/awt/image/PackedColorModel.java +++ b/awt/java/awt/image/PackedColorModel.java @@ -18,6 +18,7 @@ * @author Igor V. Stolyarov * @version $Revision$ */ + package java.awt.image; import java.awt.Transparency; @@ -27,44 +28,57 @@ import java.util.Arrays; import org.apache.harmony.awt.internal.nls.Messages; /** - * The Class PackedColorModel represents a color model where the - * components are just the red, green, and blue bands, plus an alpha - * band if alpha is supported. + * The class PackedColorModel represents a color model where the components are + * just the red, green, and blue bands, plus an alpha band if alpha is + * supported. + * + * @since Android 1.0 */ public abstract class PackedColorModel extends ColorModel { - /** The component masks. */ + /** + * The component masks. + */ int componentMasks[]; - /** The offsets. */ + /** + * The offsets. + */ int offsets[]; - /** The scales. */ + /** + * The scales. + */ float scales[]; /** * Instantiates a new packed color model. * - * @param space the color space - * @param bits the array of component masks - * @param colorMaskArray the array that gives the bitmask corresponding - * to each color band (red, green, and blue) - * @param alphaMask the bitmask corresponding to the alpha band - * @param isAlphaPremultiplied whether the alpha is premultiplied in this color model - * @param trans the transparency strategy, @see java.awt.Transparency - * @param transferType the transfer type (primitive java type - * to use for the components) - * - * @throws IllegalArgumentException if the number of bits in the combined - * bitmasks for the color bands is less than one or greater than 32 + * @param space + * the color space. + * @param bits + * the array of component masks. + * @param colorMaskArray + * the array that gives the bitmask corresponding to each color + * band (red, green, and blue). + * @param alphaMask + * the bitmask corresponding to the alpha band. + * @param isAlphaPremultiplied + * whether the alpha is pre-multiplied in this color model. + * @param trans + * the transparency strategy, @see java.awt.Transparency. + * @param transferType + * the transfer type (primitive java type to use for the + * components). + * @throws IllegalArgumentException + * if the number of bits in the combined bitmasks for the color + * bands is less than one or greater than 32. */ - public PackedColorModel(ColorSpace space, int bits, int colorMaskArray[], - int alphaMask, boolean isAlphaPremultiplied, int trans, - int transferType) { + public PackedColorModel(ColorSpace space, int bits, int colorMaskArray[], int alphaMask, + boolean isAlphaPremultiplied, int trans, int transferType) { - super(bits, createBits(colorMaskArray, alphaMask), space, - (alphaMask == 0 ? false : true), isAlphaPremultiplied, trans, - validateTransferType(transferType)); + super(bits, createBits(colorMaskArray, alphaMask), space, (alphaMask == 0 ? false : true), + isAlphaPremultiplied, trans, validateTransferType(transferType)); if (pixel_bits < 1 || pixel_bits > 32) { // awt.236=The bits is less than 1 or greater than 32 @@ -89,27 +103,34 @@ public abstract class PackedColorModel extends ColorModel { /** * Instantiates a new packed color model. * - * @param space the color space - * @param bits the array of component masks - * @param rmask the bitmask corresponding to the red band - * @param gmask the bitmask corresponding to the green band - * @param bmask the bitmask corresponding to the blue band - * @param amask the bitmask corresponding to the alpha band - * @param isAlphaPremultiplied whether the alpha is premultiplied in this color model - * @param trans the transparency strategy, @see java.awt.Transparency - * @param transferType the transfer type (primitive java type - * to use for the components) - * - * @throws IllegalArgumentException if the number of bits in the combined - * bitmasks for the color bands is less than one or greater than 32 + * @param space + * the color space. + * @param bits + * the array of component masks. + * @param rmask + * the bitmask corresponding to the red band. + * @param gmask + * the bitmask corresponding to the green band. + * @param bmask + * the bitmask corresponding to the blue band. + * @param amask + * the bitmask corresponding to the alpha band. + * @param isAlphaPremultiplied + * whether the alpha is pre-multiplied in this color model. + * @param trans + * the transparency strategy, @see java.awt.Transparency. + * @param transferType + * the transfer type (primitive java type to use for the + * components). + * @throws IllegalArgumentException + * if the number of bits in the combined bitmasks for the color + * bands is less than one or greater than 32. */ - public PackedColorModel(ColorSpace space, int bits, int rmask, int gmask, - int bmask, int amask, boolean isAlphaPremultiplied, int trans, - int transferType) { + public PackedColorModel(ColorSpace space, int bits, int rmask, int gmask, int bmask, int amask, + boolean isAlphaPremultiplied, int trans, int transferType) { - super(bits, createBits(rmask, gmask, bmask, amask), space, - (amask == 0 ? false : true), isAlphaPremultiplied, trans, - validateTransferType(transferType)); + super(bits, createBits(rmask, gmask, bmask, amask), space, (amask == 0 ? false : true), + isAlphaPremultiplied, trans, validateTransferType(transferType)); if (pixel_bits < 1 || pixel_bits > 32) { // awt.236=The bits is less than 1 or greater than 32 @@ -123,7 +144,8 @@ public abstract class PackedColorModel extends ColorModel { for (int i = 0; i < numColorComponents; i++) { if (cs.getMinValue(i) != 0.0f || cs.getMaxValue(i) != 1.0f) { - // awt.23A=The min/max normalized component values are not 0.0/1.0 + // awt.23A=The min/max normalized component values are not + // 0.0/1.0 throw new IllegalArgumentException(Messages.getString("awt.23A")); //$NON-NLS-1$ } } @@ -144,7 +166,7 @@ public abstract class PackedColorModel extends ColorModel { @Override public WritableRaster getAlphaRaster(WritableRaster raster) { - if(!hasAlpha) { + if (!hasAlpha) { return null; } @@ -165,18 +187,16 @@ public abstract class PackedColorModel extends ColorModel { if (!(obj instanceof PackedColorModel)) { return false; } - PackedColorModel cm = (PackedColorModel) obj; - - return (pixel_bits == cm.getPixelSize() && - transferType == cm.getTransferType() && - cs.getType() == cm.getColorSpace().getType() && - hasAlpha == cm.hasAlpha() && - isAlphaPremultiplied == cm.isAlphaPremultiplied() && - transparency == cm.getTransparency() && - numColorComponents == cm.getNumColorComponents()&& - numComponents == cm.getNumComponents() && - Arrays.equals(bits, cm.getComponentSize()) && - Arrays.equals(componentMasks, cm.getMasks())); + PackedColorModel cm = (PackedColorModel)obj; + + return (pixel_bits == cm.getPixelSize() && transferType == cm.getTransferType() + && cs.getType() == cm.getColorSpace().getType() && hasAlpha == cm.hasAlpha() + && isAlphaPremultiplied == cm.isAlphaPremultiplied() + && transparency == cm.getTransparency() + && numColorComponents == cm.getNumColorComponents() + && numComponents == cm.getNumComponents() + && Arrays.equals(bits, cm.getComponentSize()) && Arrays.equals(componentMasks, cm + .getMasks())); } @Override @@ -187,25 +207,23 @@ public abstract class PackedColorModel extends ColorModel { if (!(sm instanceof SinglePixelPackedSampleModel)) { return false; } - SinglePixelPackedSampleModel esm = (SinglePixelPackedSampleModel) sm; + SinglePixelPackedSampleModel esm = (SinglePixelPackedSampleModel)sm; - return ((esm.getNumBands() == numComponents) && - (esm.getTransferType() == transferType) && - Arrays.equals(esm.getBitMasks(), componentMasks)); + return ((esm.getNumBands() == numComponents) && (esm.getTransferType() == transferType) && Arrays + .equals(esm.getBitMasks(), componentMasks)); } @Override public SampleModel createCompatibleSampleModel(int w, int h) { - return new SinglePixelPackedSampleModel(transferType, w, h, - componentMasks); + return new SinglePixelPackedSampleModel(transferType, w, h, componentMasks); } /** * Gets the bitmask corresponding to the specified color component. * - * @param index the index of the desired color - * - * @return the mask + * @param index + * the index of the desired color. + * @return the mask. */ public final int getMask(int index) { return componentMasks[index]; @@ -214,7 +232,7 @@ public abstract class PackedColorModel extends ColorModel { /** * Gets the bitmasks of the components. * - * @return the masks + * @return the masks. */ public final int[] getMasks() { return (componentMasks.clone()); @@ -223,10 +241,11 @@ public abstract class PackedColorModel extends ColorModel { /** * Creates the bits. * - * @param colorMaskArray the color mask array - * @param alphaMask the alpha mask - * - * @return the int[] + * @param colorMaskArray + * the color mask array. + * @param alphaMask + * the alpha mask. + * @return the int[]. */ private static int[] createBits(int colorMaskArray[], int alphaMask) { int bits[]; @@ -262,15 +281,17 @@ public abstract class PackedColorModel extends ColorModel { /** * Creates the bits. * - * @param rmask the rmask - * @param gmask the gmask - * @param bmask the bmask - * @param amask the amask - * - * @return the int[] + * @param rmask + * the rmask. + * @param gmask + * the gmask. + * @param bmask + * the bmask. + * @param amask + * the amask. + * @return the int[]. */ - private static int[] createBits(int rmask, int gmask, int bmask, - int amask) { + private static int[] createBits(int rmask, int gmask, int bmask, int amask) { int numComp; if (amask == 0) { @@ -312,9 +333,9 @@ public abstract class PackedColorModel extends ColorModel { /** * Count comp bits. * - * @param compMask the comp mask - * - * @return the int + * @param compMask + * the comp mask. + * @return the int. */ private static int countCompBits(int compMask) { int bits = 0; @@ -340,20 +361,19 @@ public abstract class PackedColorModel extends ColorModel { /** * Validate transfer type. * - * @param transferType the transfer type - * - * @return the int + * @param transferType + * the transfer type. + * @return the int. */ private static int validateTransferType(int transferType) { - if (transferType != DataBuffer.TYPE_BYTE && - transferType != DataBuffer.TYPE_USHORT && - transferType != DataBuffer.TYPE_INT) { + if (transferType != DataBuffer.TYPE_BYTE && transferType != DataBuffer.TYPE_USHORT + && transferType != DataBuffer.TYPE_INT) { // awt.240=The transferType not is one of DataBuffer.TYPE_BYTE, - // DataBuffer.TYPE_USHORT or DataBuffer.TYPE_INT + // DataBuffer.TYPE_USHORT or DataBuffer.TYPE_INT throw new IllegalArgumentException(Messages.getString("awt.240")); //$NON-NLS-1$ } return transferType; -} + } /** * Parses the components. @@ -380,4 +400,3 @@ public abstract class PackedColorModel extends ColorModel { } } - diff --git a/awt/java/awt/image/PixelInterleavedSampleModel.java b/awt/java/awt/image/PixelInterleavedSampleModel.java index e41473ec93b17..8e646f80b9d76 100644 --- a/awt/java/awt/image/PixelInterleavedSampleModel.java +++ b/awt/java/awt/image/PixelInterleavedSampleModel.java @@ -18,30 +18,39 @@ * @author Igor V. Stolyarov * @version $Revision$ */ + package java.awt.image; import org.apache.harmony.awt.internal.nls.Messages; /** - * The PixelInterleavedSampleModel class represents image data - * as represented as interleaved pixels and for which each sample of - * a pixel takes one data element of the DataBuffer. + * The PixelInterleavedSampleModel class represents image data as represented as + * interleaved pixels and for which each sample of a pixel takes one data + * element of the DataBuffer. + * + * @since Android 1.0 */ public class PixelInterleavedSampleModel extends ComponentSampleModel { /** - * Instantiates a new PixelInterleavedSampleModel with the - * specified parameters. + * Instantiates a new PixelInterleavedSampleModel with the specified + * parameters. * - * @param dataType the data type of the samples. - * @param w the width of the image data. - * @param h the height of the image data. - * @param pixelStride the pixel stride of the image data. - * @param scanlineStride the scanline stride of the of the image data. - * @param bandOffsets the array of the band offsets. + * @param dataType + * the data type of the samples. + * @param w + * the width of the image data. + * @param h + * the height of the image data. + * @param pixelStride + * the pixel stride of the image data. + * @param scanlineStride + * the scanline stride of the of the image data. + * @param bandOffsets + * the array of the band offsets. */ - public PixelInterleavedSampleModel(int dataType, int w, int h, - int pixelStride, int scanlineStride, int bandOffsets[]) { + public PixelInterleavedSampleModel(int dataType, int w, int h, int pixelStride, + int scanlineStride, int bandOffsets[]) { super(dataType, w, h, pixelStride, scanlineStride, bandOffsets); @@ -59,7 +68,8 @@ public class PixelInterleavedSampleModel extends ComponentSampleModel { maxOffset -= minOffset; if (maxOffset > scanlineStride) { - // awt.241=Any offset between bands is greater than the Scanline stride + // awt.241=Any offset between bands is greater than the Scanline + // stride throw new IllegalArgumentException(Messages.getString("awt.241")); //$NON-NLS-1$ } @@ -69,7 +79,8 @@ public class PixelInterleavedSampleModel extends ComponentSampleModel { } if (pixelStride * w > scanlineStride) { - // awt.243=Product of Pixel stride and w is greater than Scanline stride + // awt.243=Product of Pixel stride and w is greater than Scanline + // stride throw new IllegalArgumentException(Messages.getString("awt.243")); //$NON-NLS-1$ } @@ -82,8 +93,8 @@ public class PixelInterleavedSampleModel extends ComponentSampleModel { newOffsets[i] = bandOffsets[bands[i]]; } - return new PixelInterleavedSampleModel(dataType, width, height, - pixelStride, scanlineStride, newOffsets); + return new PixelInterleavedSampleModel(dataType, width, height, pixelStride, + scanlineStride, newOffsets); } @Override @@ -106,8 +117,8 @@ public class PixelInterleavedSampleModel extends ComponentSampleModel { newOffsets = bandOffsets; } - return new PixelInterleavedSampleModel(dataType, w, h, pixelStride, - pixelStride * w, newOffsets); + return new PixelInterleavedSampleModel(dataType, w, h, pixelStride, pixelStride * w, + newOffsets); } @Override @@ -121,4 +132,3 @@ public class PixelInterleavedSampleModel extends ComponentSampleModel { } } - diff --git a/awt/java/awt/image/RGBImageFilter.java b/awt/java/awt/image/RGBImageFilter.java index 9a7699793e23c..f5fe5d9ff9ab6 100644 --- a/awt/java/awt/image/RGBImageFilter.java +++ b/awt/java/awt/image/RGBImageFilter.java @@ -18,46 +18,48 @@ * @author Igor V. Stolyarov * @version $Revision$ */ -package java.awt.image; +package java.awt.image; /** - * The RGBImageFilter class represents a filter which modifies - * pixels of an image in the default RGB ColorModel. + * The RGBImageFilter class represents a filter which modifies pixels of an + * image in the default RGB ColorModel. + * + * @since Android 1.0 */ public abstract class RGBImageFilter extends ImageFilter { - /** - * The origmodel is the ColorModel to be replaced by newmodel - * when substituteColorModel is called. + /** + * The original model is the ColorModel to be replaced by the new model when + * substituteColorModel is called. */ protected ColorModel origmodel; - /** - * The newmodel is the ColorModel with which to replace origmodel - * when substituteColorModel is called. + /** + * The new model is the ColorModel with which to replace the original model + * when substituteColorModel is called. */ protected ColorModel newmodel; - /** - * The canFilterIndexColorModel indicates if it is - * acceptable to apply the color filtering of the filterRGB - * method to the color table entries of an IndexColorModel - * object. - * */ + /** + * The canFilterIndexColorModel indicates if it is acceptable to apply the + * color filtering of the filterRGB method to the color table entries of an + * IndexColorModel object. + */ protected boolean canFilterIndexColorModel; /** * Instantiates a new RGBImageFilter. */ - public RGBImageFilter() {} + public RGBImageFilter() { + } /** - * Filters an IndexColorModel object by calling filterRGB function for - * each entry of IndexColorModel. - * - * @param icm the IndexColorModel to be filtered. + * Filters an IndexColorModel object by calling filterRGB function for each + * entry of IndexColorModel. * + * @param icm + * the IndexColorModel to be filtered. * @return the IndexColorModel. */ public IndexColorModel filterIndexColorModel(IndexColorModel icm) { @@ -69,28 +71,30 @@ public abstract class RGBImageFilter extends ImageFilter { icm.getRGBs(colorMap); int trans = -1; boolean hasAlpha = false; - for(int i = 0; i < mapSize; i++){ + for (int i = 0; i < mapSize; i++) { filteredColorMap[i] = filterRGB(-1, -1, colorMap[i]); int alpha = filteredColorMap[i] >>> 24; - if(alpha != 0xff){ - if(!hasAlpha) { + if (alpha != 0xff) { + if (!hasAlpha) { hasAlpha = true; } - if(alpha == 0 && trans < 0) { + if (alpha == 0 && trans < 0) { trans = i; } } } - return new IndexColorModel(bits, mapSize, filteredColorMap, 0, - hasAlpha, trans, transferType); + return new IndexColorModel(bits, mapSize, filteredColorMap, 0, hasAlpha, trans, + transferType); } /** * Replaces the original color model and the new one. * - * @param oldcm the old ColorModel. - * @param newcm the new ColorModel. + * @param oldcm + * the old ColorModel. + * @param newcm + * the new ColorModel. */ public void substituteColorModel(ColorModel oldcm, ColorModel newcm) { origmodel = oldcm; @@ -99,29 +103,27 @@ public abstract class RGBImageFilter extends ImageFilter { @Override public void setColorModel(ColorModel model) { - if(model instanceof IndexColorModel && - canFilterIndexColorModel){ - IndexColorModel icm = (IndexColorModel) model; + if (model instanceof IndexColorModel && canFilterIndexColorModel) { + IndexColorModel icm = (IndexColorModel)model; ColorModel filteredModel = filterIndexColorModel(icm); substituteColorModel(model, filteredModel); consumer.setColorModel(filteredModel); - }else{ + } else { consumer.setColorModel(ColorModel.getRGBdefault()); } } @Override - public void setPixels(int x, int y, int w, int h, ColorModel model, - int[] pixels, int off, int scansize) { - - if(model == null || model == origmodel){ + public void setPixels(int x, int y, int w, int h, ColorModel model, int[] pixels, int off, + int scansize) { + + if (model == null || model == origmodel) { consumer.setPixels(x, y, w, h, newmodel, pixels, off, scansize); - }else{ + } else { int rgbPixels[] = new int[w]; - for(int sy = y, pixelsOff = off; sy < y + h; - sy++, pixelsOff += scansize){ - - for(int sx = x, idx = 0; sx < x + w; sx++, idx++){ + for (int sy = y, pixelsOff = off; sy < y + h; sy++, pixelsOff += scansize) { + + for (int sx = x, idx = 0; sx < x + w; sx++, idx++) { rgbPixels[idx] = model.getRGB(pixels[pixelsOff + idx]); } filterRGBPixels(x, sy, w, 1, rgbPixels, 0, w); @@ -130,19 +132,17 @@ public abstract class RGBImageFilter extends ImageFilter { } @Override - public void setPixels(int x, int y, int w, int h, ColorModel model, - byte[] pixels, int off, int scansize) { - - if(model == null || model == origmodel){ + public void setPixels(int x, int y, int w, int h, ColorModel model, byte[] pixels, int off, + int scansize) { + + if (model == null || model == origmodel) { consumer.setPixels(x, y, w, h, newmodel, pixels, off, scansize); - }else{ + } else { int rgbPixels[] = new int[w]; - for(int sy = y, pixelsOff = off; sy < y + h; - sy++, pixelsOff += scansize){ - - for(int sx = x, idx = 0; sx < x + w; sx++, idx++){ - rgbPixels[idx] = - model.getRGB(pixels[pixelsOff + idx] & 0xff); + for (int sy = y, pixelsOff = off; sy < y + h; sy++, pixelsOff += scansize) { + + for (int sx = x, idx = 0; sx < x + w; sx++, idx++) { + rgbPixels[idx] = model.getRGB(pixels[pixelsOff + idx] & 0xff); } filterRGBPixels(x, sy, w, 1, rgbPixels, 0, w); } @@ -150,41 +150,46 @@ public abstract class RGBImageFilter extends ImageFilter { } /** - * Filters a region of pixels in the default RGB ColorModel - * by calling the filterRGB method for them. + * Filters a region of pixels in the default RGB ColorModel by calling the + * filterRGB method for them. * - * @param x the X coordinate of region. - * @param y the Y coordinate of region. - * @param w the width ofregion. - * @param h the height of region. - * @param pixels the pixels array. - * @param off the offset of array. - * @param scansize the distance between rows of pixels in the array. + * @param x + * the X coordinate of region. + * @param y + * the Y coordinate of region. + * @param w + * the width of region. + * @param h + * the height of region. + * @param pixels + * the pixels array. + * @param off + * the offset of array. + * @param scansize + * the distance between rows of pixels in the array. */ - public void filterRGBPixels(int x, int y, int w, int h, - int[] pixels, int off, int scansize) { - - for(int sy = y, lineOff = off; sy < y + h; sy++, lineOff += scansize){ - for(int sx = x, idx = 0; sx < x + w; sx++, idx++){ - pixels[lineOff + idx] = - filterRGB(sx, sy, pixels[lineOff + idx]); + public void filterRGBPixels(int x, int y, int w, int h, int[] pixels, int off, int scansize) { + + for (int sy = y, lineOff = off; sy < y + h; sy++, lineOff += scansize) { + for (int sx = x, idx = 0; sx < x + w; sx++, idx++) { + pixels[lineOff + idx] = filterRGB(sx, sy, pixels[lineOff + idx]); } } - consumer.setPixels(x, y, w, h, ColorModel.getRGBdefault(), - pixels, off, scansize); + consumer.setPixels(x, y, w, h, ColorModel.getRGBdefault(), pixels, off, scansize); } /** - * Coverts a single input pixel in the default RGB ColorModel - * to a single output pixel. - * - * @param x the X pixel's coordinate. - * @param y the Y pixel's coordinate. - * @param rgb a pixel in the default RGB color model. + * Converts a single input pixel in the default RGB ColorModel to a single + * output pixel. * + * @param x + * the X pixel's coordinate. + * @param y + * the Y pixel's coordinate. + * @param rgb + * a pixel in the default RGB color model. * @return a filtered pixel in the default RGB color model. */ public abstract int filterRGB(int x, int y, int rgb); } - diff --git a/awt/java/awt/image/Raster.java b/awt/java/awt/image/Raster.java index 4b2426e51a40d..6749fde9e4b97 100644 --- a/awt/java/awt/image/Raster.java +++ b/awt/java/awt/image/Raster.java @@ -18,6 +18,7 @@ * @author Igor V. Stolyarov * @version $Revision$ */ + package java.awt.image; import java.awt.Point; @@ -27,70 +28,95 @@ import org.apache.harmony.awt.gl.image.OrdinaryWritableRaster; import org.apache.harmony.awt.internal.nls.Messages; /** - * The Raster class represents a rectangular area of pixels. - * This class is defined by DataBuffer and SampleModel objects. - * The DataBuffer object stores sample values and DSampleModel defines - * the location of sample in this DataBuffer. + * The Raster class represents a rectangular area of pixels. This class is + * defined by DataBuffer and SampleModel objects. The DataBuffer object stores + * sample values and DSampleModel defines the location of sample in this + * DataBuffer. + * + * @since Android 1.0 */ public class Raster { - /** The DataBuffer of this Raster. */ + /** + * The DataBuffer of this Raster. + */ protected DataBuffer dataBuffer; - /** The height of this Raster. */ + /** + * The height of this Raster. + */ protected int height; - /** The X coordinate of the upper left pixel in this Raster. */ + /** + * The X coordinate of the upper left pixel in this Raster. + */ protected int minX; - /** The Y coordinate of the upper left pixel in this Raster. */ + /** + * The Y coordinate of the upper left pixel in this Raster. + */ protected int minY; - /** The number of bands in this Raster. */ + /** + * The number of bands in this Raster. + */ protected int numBands; - /** The number of data elements. */ + /** + * The number of data elements. + */ protected int numDataElements; - /** The parent of this Raster. */ + /** + * The parent of this Raster. + */ protected Raster parent; - /** The SampleModel of this Raster. */ + /** + * The SampleModel of this Raster. + */ protected SampleModel sampleModel; - /** - * The X translation from the coordinate space of the - * SampleModel of this Raster. + /** + * The X translation from the coordinate space of the SampleModel of this + * Raster. */ protected int sampleModelTranslateX; - /** - * The Y translation from the coordinate space of the - * SampleModel of this Raster. + /** + * The Y translation from the coordinate space of the SampleModel of this + * Raster. */ protected int sampleModelTranslateY; - /** The width of this Raster. */ + /** + * The width of this Raster. + */ protected int width; /** - * Creates a Raster object with a BandedSampleModel and the specified + * Creates a Raster object with a BandedSampleModel and the specified * DataBuffer. The number of bands is defined by the length of bandOffsets * or bankIndices arrays. * - * @param dataBuffer the specified DataBuffer. - * @param w the width of the image data. - * @param h the height of the image data. - * @param bankIndices the bank indices of bands. - * @param bandOffsets the band offsets of bands. - * @param location the location which defines the upper left corner - * of Raster. - * + * @param dataBuffer + * the specified DataBuffer. + * @param w + * the width of the image data. + * @param h + * the height of the image data. + * @param scanlineStride + * the scanline stride of the image data. + * @param bankIndices + * the bank indices of bands. + * @param bandOffsets + * the band offsets of bands. + * @param location + * the location which defines the upper left corner of Raster. * @return the WritableRaster object. */ - public static WritableRaster createBandedRaster(DataBuffer dataBuffer, - int w, int h, int scanlineStride, int bankIndices[], - int bandOffsets[], Point location) { + public static WritableRaster createBandedRaster(DataBuffer dataBuffer, int w, int h, + int scanlineStride, int bankIndices[], int bandOffsets[], Point location) { if (w <= 0 || h <= 0) { // awt.22E=w or h is less than or equal to zero @@ -101,9 +127,9 @@ public class Raster { location = new Point(0, 0); } - if ((long) location.x + w > Integer.MAX_VALUE - || (long) location.y + h > Integer.MAX_VALUE) { - // awt.276=location.x + w or location.y + h results in integer overflow + if ((long)location.x + w > Integer.MAX_VALUE || (long)location.y + h > Integer.MAX_VALUE) { + // awt.276=location.x + w or location.y + h results in integer + // overflow throw new RasterFormatException(Messages.getString("awt.276")); //$NON-NLS-1$ } @@ -119,39 +145,43 @@ public class Raster { int dataType = dataBuffer.getDataType(); - if (dataType != DataBuffer.TYPE_BYTE - && dataType != DataBuffer.TYPE_USHORT + if (dataType != DataBuffer.TYPE_BYTE && dataType != DataBuffer.TYPE_USHORT && dataType != DataBuffer.TYPE_INT) { // awt.230=dataType is not one of the supported data types throw new IllegalArgumentException(Messages.getString("awt.230")); //$NON-NLS-1$ } - BandedSampleModel sampleModel = new BandedSampleModel(dataType, w, h, - scanlineStride, bankIndices, bandOffsets); + BandedSampleModel sampleModel = new BandedSampleModel(dataType, w, h, scanlineStride, + bankIndices, bandOffsets); return new OrdinaryWritableRaster(sampleModel, dataBuffer, location); } /** - * Creates a Raster object with a BandedSampleModel and the specified - * data type. The Data type can be one of the following values: - * TYPE_BYTE, TYPE_USHORT, or TYPE_INT. - * - * @param dataType the data type of the samples: - * TYPE_BYTE, TYPE_USHORT, or TYPE_INT. - * @param w the width of the image data. - * @param h the height of the image data. - * @param scanlineStride the scanline stride of the image data. - * @param bankIndices the bank indices of bands. - * @param bandOffsets the band offsets of bands. - * @param location the location which defines the upper left corner - * of the Raster. - * + * Creates a Raster object with a BandedSampleModel and the specified data + * type. The Data type can be one of the following values: TYPE_BYTE, + * TYPE_USHORT, or TYPE_INT. + * + * @param dataType + * the data type of the samples: TYPE_BYTE, TYPE_USHORT, or + * TYPE_INT. + * @param w + * the width of the image data. + * @param h + * the height of the image data. + * @param scanlineStride + * the scanline stride of the image data. + * @param bankIndices + * the bank indices of bands. + * @param bandOffsets + * the band offsets of bands. + * @param location + * the location which defines the upper left corner of the + * Raster. * @return the WritableRaster object. */ - public static WritableRaster createBandedRaster(int dataType, int w, int h, - int scanlineStride, int bankIndices[], int bandOffsets[], - Point location) { + public static WritableRaster createBandedRaster(int dataType, int w, int h, int scanlineStride, + int bankIndices[], int bandOffsets[], Point location) { if (w <= 0 || h <= 0) { // awt.22E=w or h is less than or equal to zero @@ -162,9 +192,9 @@ public class Raster { location = new Point(0, 0); } - if ((long) location.x + w > Integer.MAX_VALUE - || (long) location.y + h > Integer.MAX_VALUE) { - // awt.276=location.x + w or location.y + h results in integer overflow + if ((long)location.x + w > Integer.MAX_VALUE || (long)location.y + h > Integer.MAX_VALUE) { + // awt.276=location.x + w or location.y + h results in integer + // overflow throw new RasterFormatException(Messages.getString("awt.276")); //$NON-NLS-1$ } @@ -173,8 +203,7 @@ public class Raster { throw new ArrayIndexOutOfBoundsException(Messages.getString("awt.277")); //$NON-NLS-1$ } - if (dataType != DataBuffer.TYPE_BYTE - && dataType != DataBuffer.TYPE_USHORT + if (dataType != DataBuffer.TYPE_BYTE && dataType != DataBuffer.TYPE_USHORT && dataType != DataBuffer.TYPE_INT) { // awt.230=dataType is not one of the supported data types throw new IllegalArgumentException(Messages.getString("awt.230")); //$NON-NLS-1$ @@ -198,37 +227,40 @@ public class Raster { DataBuffer data = null; switch (dataType) { - case DataBuffer.TYPE_BYTE: - data = new DataBufferByte(dataSize, numBanks); - break; - case DataBuffer.TYPE_USHORT: - data = new DataBufferUShort(dataSize, numBanks); - break; - case DataBuffer.TYPE_INT: - data = new DataBufferInt(dataSize, numBanks); - break; - } - return createBandedRaster(data, w, h, scanlineStride, bankIndices, - bandOffsets, location); + case DataBuffer.TYPE_BYTE: + data = new DataBufferByte(dataSize, numBanks); + break; + case DataBuffer.TYPE_USHORT: + data = new DataBufferUShort(dataSize, numBanks); + break; + case DataBuffer.TYPE_INT: + data = new DataBufferInt(dataSize, numBanks); + break; + } + return createBandedRaster(data, w, h, scanlineStride, bankIndices, bandOffsets, location); } /** - * Creates a Raster object with a BandedSampleModel and the specified - * data type. The Data type can be one of the following values: - * TYPE_BYTE, TYPE_USHORT, or TYPE_INT. - * - * @param dataType the data type of the samples: - * TYPE_BYTE, TYPE_USHORT, or TYPE_INT. - * @param w the width of the image data. - * @param h the height of the image data. - * @param bands the number of bands. - * @param location the location which defines the upper left corner - * of the Raster. - * + * Creates a Raster object with a BandedSampleModel and the specified data + * type. The Data type can be one of the following values: TYPE_BYTE, + * TYPE_USHORT, or TYPE_INT. + * + * @param dataType + * the data type of the samples: TYPE_BYTE, TYPE_USHORT, or + * TYPE_INT. + * @param w + * the width of the image data. + * @param h + * the height of the image data. + * @param bands + * the number of bands. + * @param location + * the location which defines the upper left corner of the + * Raster. * @return the WritableRaster object. */ - public static WritableRaster createBandedRaster(int dataType, int w, int h, - int bands, Point location) { + public static WritableRaster createBandedRaster(int dataType, int w, int h, int bands, + Point location) { if (w <= 0 || h <= 0) { // awt.22E=w or h is less than or equal to zero @@ -239,9 +271,9 @@ public class Raster { location = new Point(0, 0); } - if ((long) location.x + w > Integer.MAX_VALUE - || (long) location.y + h > Integer.MAX_VALUE) { - // awt.276=location.x + w or location.y + h results in integer overflow + if ((long)location.x + w > Integer.MAX_VALUE || (long)location.y + h > Integer.MAX_VALUE) { + // awt.276=location.x + w or location.y + h results in integer + // overflow throw new RasterFormatException(Messages.getString("awt.276")); //$NON-NLS-1$ } @@ -257,28 +289,32 @@ public class Raster { bandOffsets[i] = 0; bankIndices[i] = i; } - return createBandedRaster(dataType, w, h, w, bankIndices, bandOffsets, - location); + return createBandedRaster(dataType, w, h, w, bankIndices, bandOffsets, location); } /** - * Creates a Raster object with a PixelInterleavedSampleModel - * and the specified DataBuffer. - * - * @param dataBuffer the DataBuffer. - * @param w the width of image data. - * @param h the height of image data. - * @param scanlineStride the scanline stride of the image data. - * @param pixelStride the pixel stride of image data. - * @param bandOffsets the band offsets of bands. - * @param location the location which defines the upper left corner - * of the Raster. - * + * Creates a Raster object with a PixelInterleavedSampleModel and the + * specified DataBuffer. + * + * @param dataBuffer + * the DataBuffer. + * @param w + * the width of image data. + * @param h + * the height of image data. + * @param scanlineStride + * the scanline stride of the image data. + * @param pixelStride + * the pixel stride of image data. + * @param bandOffsets + * the band offsets of bands. + * @param location + * the location which defines the upper left corner of the + * Raster. * @return the WritableRaster object. */ - public static WritableRaster createInterleavedRaster(DataBuffer dataBuffer, - int w, int h, int scanlineStride, int pixelStride, - int bandOffsets[], Point location) { + public static WritableRaster createInterleavedRaster(DataBuffer dataBuffer, int w, int h, + int scanlineStride, int pixelStride, int bandOffsets[], Point location) { if (w <= 0 || h <= 0) { // awt.22E=w or h is less than or equal to zero @@ -289,9 +325,9 @@ public class Raster { location = new Point(0, 0); } - if ((long) location.x + w > Integer.MAX_VALUE - || (long) location.y + h > Integer.MAX_VALUE) { - // awt.276=location.x + w or location.y + h results in integer overflow + if ((long)location.x + w > Integer.MAX_VALUE || (long)location.y + h > Integer.MAX_VALUE) { + // awt.276=location.x + w or location.y + h results in integer + // overflow throw new RasterFormatException(Messages.getString("awt.276")); //$NON-NLS-1$ } @@ -301,8 +337,7 @@ public class Raster { } int dataType = dataBuffer.getDataType(); - if (dataType != DataBuffer.TYPE_BYTE - && dataType != DataBuffer.TYPE_USHORT) { + if (dataType != DataBuffer.TYPE_BYTE && dataType != DataBuffer.TYPE_USHORT) { // awt.230=dataType is not one of the supported data types throw new IllegalArgumentException(Messages.getString("awt.230")); //$NON-NLS-1$ } @@ -317,35 +352,38 @@ public class Raster { throw new NullPointerException(Messages.getString("awt.27B")); //$NON-NLS-1$ } - PixelInterleavedSampleModel sampleModel = - new PixelInterleavedSampleModel(dataType, w, h, - pixelStride, scanlineStride, bandOffsets); + PixelInterleavedSampleModel sampleModel = new PixelInterleavedSampleModel(dataType, w, h, + pixelStride, scanlineStride, bandOffsets); return new OrdinaryWritableRaster(sampleModel, dataBuffer, location); } /** - * Creates a Raster object with a PixelInterleavedSampleModel - * and the specified data type. The Data type can be one of the - * following values: - * TYPE_BYTE, TYPE_USHORT, or TYPE_INT. - * - * @param dataType the data type of the samples: - * TYPE_BYTE, TYPE_USHORT, or TYPE_INT. - * @param w the width of image data. - * @param h the height of image data. - * @param scanlineStride the scanline stride of the image data. - * @param pixelStride the pixel stride of image data. - * @param bandOffsets the band offsets of bands. - * @param location the location which defines the upper left corner - * of the Raster. - * + * Creates a Raster object with a PixelInterleavedSampleModel and the + * specified data type. The Data type can be one of the following values: + * TYPE_BYTE, TYPE_USHORT, or TYPE_INT. + * + * @param dataType + * the data type of the samples: TYPE_BYTE, TYPE_USHORT, or + * TYPE_INT. + * @param w + * the width of image data. + * @param h + * the height of image data. + * @param scanlineStride + * the scanline stride of the image data. + * @param pixelStride + * the pixel stride of image data. + * @param bandOffsets + * the band offsets of bands. + * @param location + * the location which defines the upper left corner of the + * Raster. * @return the WritableRaster object. */ - public static WritableRaster createInterleavedRaster(int dataType, int w, - int h, int scanlineStride, int pixelStride, int bandOffsets[], - Point location) { + public static WritableRaster createInterleavedRaster(int dataType, int w, int h, + int scanlineStride, int pixelStride, int bandOffsets[], Point location) { if (w <= 0 || h <= 0) { // awt.22E=w or h is less than or equal to zero @@ -356,14 +394,13 @@ public class Raster { location = new Point(0, 0); } - if ((long) location.x + w > Integer.MAX_VALUE - || (long) location.y + h > Integer.MAX_VALUE) { - // awt.276=location.x + w or location.y + h results in integer overflow + if ((long)location.x + w > Integer.MAX_VALUE || (long)location.y + h > Integer.MAX_VALUE) { + // awt.276=location.x + w or location.y + h results in integer + // overflow throw new RasterFormatException(Messages.getString("awt.276")); //$NON-NLS-1$ } - if (dataType != DataBuffer.TYPE_BYTE - && dataType != DataBuffer.TYPE_USHORT) { + if (dataType != DataBuffer.TYPE_BYTE && dataType != DataBuffer.TYPE_USHORT) { // awt.230=dataType is not one of the supported data types throw new IllegalArgumentException(Messages.getString("awt.230")); //$NON-NLS-1$ } @@ -383,36 +420,38 @@ public class Raster { DataBuffer data = null; switch (dataType) { - case DataBuffer.TYPE_BYTE: - data = new DataBufferByte(size); - break; - case DataBuffer.TYPE_USHORT: - data = new DataBufferUShort(size); - break; + case DataBuffer.TYPE_BYTE: + data = new DataBufferByte(size); + break; + case DataBuffer.TYPE_USHORT: + data = new DataBufferUShort(size); + break; } - return createInterleavedRaster(data, w, h, scanlineStride, pixelStride, - bandOffsets, location); + return createInterleavedRaster(data, w, h, scanlineStride, pixelStride, bandOffsets, + location); } /** - * Creates a Raster object with a PixelInterleavedSampleModel - * and the specified data type. The Data type can be one of the - * following values: - * TYPE_BYTE, TYPE_USHORT, or TYPE_INT. - * - * @param dataType the data type of samples: - * TYPE_BYTE, TYPE_USHORT, or TYPE_INT. - * @param w the width of image data. - * @param h the height of image data. - * @param bands the number of bands. - * @param location the location which defines the upper left corner - * of the Raster. - * + * Creates a Raster object with a PixelInterleavedSampleModel and the + * specified data type. The Data type can be one of the following values: + * TYPE_BYTE, TYPE_USHORT, or TYPE_INT. + * + * @param dataType + * the data type of samples: TYPE_BYTE, TYPE_USHORT, or TYPE_INT. + * @param w + * the width of image data. + * @param h + * the height of image data. + * @param bands + * the number of bands. + * @param location + * the location which defines the upper left corner of the + * Raster. * @return the WritableRaster. */ - public static WritableRaster createInterleavedRaster(int dataType, int w, - int h, int bands, Point location) { + public static WritableRaster createInterleavedRaster(int dataType, int w, int h, int bands, + Point location) { if (w <= 0 || h <= 0) { // awt.22E=w or h is less than or equal to zero @@ -423,14 +462,13 @@ public class Raster { location = new Point(0, 0); } - if ((long) location.x + w > Integer.MAX_VALUE - || (long) location.y + h > Integer.MAX_VALUE) { - // awt.276=location.x + w or location.y + h results in integer overflow + if ((long)location.x + w > Integer.MAX_VALUE || (long)location.y + h > Integer.MAX_VALUE) { + // awt.276=location.x + w or location.y + h results in integer + // overflow throw new RasterFormatException(Messages.getString("awt.276")); //$NON-NLS-1$ } - if (dataType != DataBuffer.TYPE_BYTE - && dataType != DataBuffer.TYPE_USHORT) { + if (dataType != DataBuffer.TYPE_BYTE && dataType != DataBuffer.TYPE_USHORT) { // awt.230=dataType is not one of the supported data types throw new IllegalArgumentException(Messages.getString("awt.230")); //$NON-NLS-1$ } @@ -440,26 +478,30 @@ public class Raster { bandOffsets[i] = i; } - return createInterleavedRaster(dataType, w, h, w * bands, bands, - bandOffsets, location); + return createInterleavedRaster(dataType, w, h, w * bands, bands, bandOffsets, location); } /** - * Creates a Raster object with a SinglePixelPackedSampleModel - * and the specified DataBuffer. - * - * @param dataBuffer the DataBuffer. - * @param w the width of the image data. - * @param h the height of the image data. - * @param scanlineStride the scanline stride of the image data. - * @param bandMasks the band masks. - * @param location the location which defines the upper left corner - * of the Raster. - * + * Creates a Raster object with a SinglePixelPackedSampleModel and the + * specified DataBuffer. + * + * @param dataBuffer + * the DataBuffer. + * @param w + * the width of the image data. + * @param h + * the height of the image data. + * @param scanlineStride + * the scanline stride of the image data. + * @param bandMasks + * the band masks. + * @param location + * the location which defines the upper left corner of the + * Raster. * @return the WritableRaster. */ - public static WritableRaster createPackedRaster(DataBuffer dataBuffer, - int w, int h, int scanlineStride, int bandMasks[], Point location) { + public static WritableRaster createPackedRaster(DataBuffer dataBuffer, int w, int h, + int scanlineStride, int bandMasks[], Point location) { if (dataBuffer == null) { // awt.278=dataBuffer is null throw new NullPointerException(Messages.getString("awt.278")); //$NON-NLS-1$ @@ -474,9 +516,9 @@ public class Raster { location = new Point(0, 0); } - if ((long) location.x + w > Integer.MAX_VALUE - || (long) location.y + h > Integer.MAX_VALUE) { - // awt.276=location.x + w or location.y + h results in integer overflow + if ((long)location.x + w > Integer.MAX_VALUE || (long)location.y + h > Integer.MAX_VALUE) { + // awt.276=location.x + w or location.y + h results in integer + // overflow throw new RasterFormatException(Messages.getString("awt.276")); //$NON-NLS-1$ } @@ -491,35 +533,37 @@ public class Raster { } int dataType = dataBuffer.getDataType(); - if (dataType != DataBuffer.TYPE_BYTE - && dataType != DataBuffer.TYPE_USHORT + if (dataType != DataBuffer.TYPE_BYTE && dataType != DataBuffer.TYPE_USHORT && dataType != DataBuffer.TYPE_INT) { // awt.230=dataType is not one of the supported data types throw new IllegalArgumentException(Messages.getString("awt.230")); //$NON-NLS-1$ } - SinglePixelPackedSampleModel sampleModel = - new SinglePixelPackedSampleModel(dataType, w, h, - scanlineStride, bandMasks); + SinglePixelPackedSampleModel sampleModel = new SinglePixelPackedSampleModel(dataType, w, h, + scanlineStride, bandMasks); return new OrdinaryWritableRaster(sampleModel, dataBuffer, location); } /** - * Creates a Raster object with a MultiPixelPackedSampleModel - * and the specified DataBuffer. - * - * @param dataBuffer the DataBuffer. - * @param w the width of the image data. - * @param h the height of the image data. - * @param bitsPerPixel the number of bits per pixel. - * @param location the location which defines the upper left corner - * of the Raster. - * + * Creates a Raster object with a MultiPixelPackedSampleModel and the + * specified DataBuffer. + * + * @param dataBuffer + * the DataBuffer. + * @param w + * the width of the image data. + * @param h + * the height of the image data. + * @param bitsPerPixel + * the number of bits per pixel. + * @param location + * the location which defines the upper left corner of the + * Raster. * @return the WritableRaster. */ - public static WritableRaster createPackedRaster(DataBuffer dataBuffer, - int w, int h, int bitsPerPixel, Point location) { + public static WritableRaster createPackedRaster(DataBuffer dataBuffer, int w, int h, + int bitsPerPixel, Point location) { if (w <= 0 || h <= 0) { // awt.22E=w or h is less than or equal to zero @@ -530,9 +574,9 @@ public class Raster { location = new Point(0, 0); } - if ((long) location.x + w > Integer.MAX_VALUE - || (long) location.y + h > Integer.MAX_VALUE) { - // awt.276=location.x + w or location.y + h results in integer overflow + if ((long)location.x + w > Integer.MAX_VALUE || (long)location.y + h > Integer.MAX_VALUE) { + // awt.276=location.x + w or location.y + h results in integer + // overflow throw new RasterFormatException(Messages.getString("awt.276")); //$NON-NLS-1$ } @@ -547,37 +591,40 @@ public class Raster { } int dataType = dataBuffer.getDataType(); - if (dataType != DataBuffer.TYPE_BYTE - && dataType != DataBuffer.TYPE_USHORT + if (dataType != DataBuffer.TYPE_BYTE && dataType != DataBuffer.TYPE_USHORT && dataType != DataBuffer.TYPE_INT) { // awt.230=dataType is not one of the supported data types throw new IllegalArgumentException(Messages.getString("awt.230")); //$NON-NLS-1$ } - MultiPixelPackedSampleModel sampleModel = - new MultiPixelPackedSampleModel(dataType, w, h, bitsPerPixel); + MultiPixelPackedSampleModel sampleModel = new MultiPixelPackedSampleModel(dataType, w, h, + bitsPerPixel); return new OrdinaryWritableRaster(sampleModel, dataBuffer, location); } /** - * Creates a Raster object with a MultiPixelPackedSampleModel - * and the specified DataBuffer. - * - * @param dataType the data type of samples: - * TYPE_BYTE, TYPE_USHORT, or TYPE_INT. - * @param w the width of the image data. - * @param h the height of the image data. - * @param bands the number of bands. - * @param bitsPerBand the number of bits per band. - * @param location the location which defines the upper left corner - * of the Raster. - * + * Creates a Raster object with a MultiPixelPackedSampleModel and the + * specified DataBuffer. + * + * @param dataType + * the data type of samples: TYPE_BYTE, TYPE_USHORT, or TYPE_INT. + * @param w + * the width of the image data. + * @param h + * the height of the image data. + * @param bands + * the number of bands. + * @param bitsPerBand + * the number of bits per band. + * @param location + * the location which defines the upper left corner of the + * Raster. * @return the WritableRaster. */ - public static WritableRaster createPackedRaster(int dataType, int w, int h, - int bands, int bitsPerBand, Point location) { + public static WritableRaster createPackedRaster(int dataType, int w, int h, int bands, + int bitsPerBand, Point location) { if (w <= 0 || h <= 0) { // awt.22E=w or h is less than or equal to zero @@ -588,9 +635,9 @@ public class Raster { location = new Point(0, 0); } - if ((long) location.x + w > Integer.MAX_VALUE - || (long) location.y + h > Integer.MAX_VALUE) { - // awt.276=location.x + w or location.y + h results in integer overflow + if ((long)location.x + w > Integer.MAX_VALUE || (long)location.y + h > Integer.MAX_VALUE) { + // awt.276=location.x + w or location.y + h results in integer + // overflow throw new RasterFormatException(Messages.getString("awt.276")); //$NON-NLS-1$ } @@ -599,15 +646,15 @@ public class Raster { throw new IllegalArgumentException(Messages.getString("awt.27D")); //$NON-NLS-1$ } - if (dataType != DataBuffer.TYPE_BYTE - && dataType != DataBuffer.TYPE_USHORT + if (dataType != DataBuffer.TYPE_BYTE && dataType != DataBuffer.TYPE_USHORT && dataType != DataBuffer.TYPE_INT) { // awt.230=dataType is not one of the supported data types throw new IllegalArgumentException(Messages.getString("awt.230")); //$NON-NLS-1$ } if (bitsPerBand * bands > DataBuffer.getDataTypeSize(dataType)) { - // awt.27E=The product of bitsPerBand and bands is greater than the number of bits held by dataType + // awt.27E=The product of bitsPerBand and bands is greater than the + // number of bits held by dataType throw new IllegalArgumentException(Messages.getString("awt.27E")); //$NON-NLS-1$ } @@ -623,43 +670,45 @@ public class Raster { return createPackedRaster(dataType, w, h, bandMasks, location); } DataBuffer data = null; - int size = ((bitsPerBand * w + - DataBuffer.getDataTypeSize(dataType) - 1) / - DataBuffer.getDataTypeSize(dataType)) * h; + int size = ((bitsPerBand * w + DataBuffer.getDataTypeSize(dataType) - 1) / DataBuffer + .getDataTypeSize(dataType)) + * h; switch (dataType) { - case DataBuffer.TYPE_BYTE: - data = new DataBufferByte(size); - break; - case DataBuffer.TYPE_USHORT: - data = new DataBufferUShort(size); - break; - case DataBuffer.TYPE_INT: - data = new DataBufferInt(size); - break; + case DataBuffer.TYPE_BYTE: + data = new DataBufferByte(size); + break; + case DataBuffer.TYPE_USHORT: + data = new DataBufferUShort(size); + break; + case DataBuffer.TYPE_INT: + data = new DataBufferInt(size); + break; } return createPackedRaster(data, w, h, bitsPerBand, location); } /** - * Creates a Raster object with a SinglePixelPackedSampleModel - * and the specified DataBuffer. - * - * @param dataType the data type of samples: - * TYPE_BYTE, TYPE_USHORT, or TYPE_INT. - * @param w the width of the image data. - * @param h the height of the image data. - * @param bandMasks the band masks. - * @param location the location which defines the upper left corner - * of the Raster. - * + * Creates a Raster object with a SinglePixelPackedSampleModel and the + * specified DataBuffer. + * + * @param dataType + * the data type of samples: TYPE_BYTE, TYPE_USHORT, or TYPE_INT. + * @param w + * the width of the image data. + * @param h + * the height of the image data. + * @param bandMasks + * the band masks. + * @param location + * the location which defines the upper left corner of the + * Raster. * @return the WritableRaster. */ - public static WritableRaster createPackedRaster(int dataType, int w, int h, - int bandMasks[], Point location) { - - if (dataType != DataBuffer.TYPE_BYTE - && dataType != DataBuffer.TYPE_USHORT + public static WritableRaster createPackedRaster(int dataType, int w, int h, int bandMasks[], + Point location) { + + if (dataType != DataBuffer.TYPE_BYTE && dataType != DataBuffer.TYPE_USHORT && dataType != DataBuffer.TYPE_INT) { // awt.230=dataType is not one of the supported data types throw new IllegalArgumentException(Messages.getString("awt.230")); //$NON-NLS-1$ @@ -674,9 +723,9 @@ public class Raster { location = new Point(0, 0); } - if ((long) location.x + w > Integer.MAX_VALUE - || (long) location.y + h > Integer.MAX_VALUE) { - // awt.276=location.x + w or location.y + h results in integer overflow + if ((long)location.x + w > Integer.MAX_VALUE || (long)location.y + h > Integer.MAX_VALUE) { + // awt.276=location.x + w or location.y + h results in integer + // overflow throw new RasterFormatException(Messages.getString("awt.276")); //$NON-NLS-1$ } @@ -688,15 +737,15 @@ public class Raster { DataBuffer data = null; switch (dataType) { - case DataBuffer.TYPE_BYTE: - data = new DataBufferByte(w * h); - break; - case DataBuffer.TYPE_USHORT: - data = new DataBufferUShort(w * h); - break; - case DataBuffer.TYPE_INT: - data = new DataBufferInt(w * h); - break; + case DataBuffer.TYPE_BYTE: + data = new DataBufferByte(w * h); + break; + case DataBuffer.TYPE_USHORT: + data = new DataBufferUShort(w * h); + break; + case DataBuffer.TYPE_INT: + data = new DataBufferInt(w * h); + break; } return createPackedRaster(data, w, h, w, bandMasks, location); @@ -705,15 +754,16 @@ public class Raster { /** * Creates a Raster object with the specified DataBuffer and SampleModel. * - * @param sm the specified SampleModel. - * @param db the specified DataBuffer. - * @param location the location which defines the upper left corner - * of the Raster. - * + * @param sm + * the specified SampleModel. + * @param db + * the specified DataBuffer. + * @param location + * the location which defines the upper left corner of the + * Raster. * @return the Raster. */ - public static Raster createRaster(SampleModel sm, DataBuffer db, - Point location) { + public static Raster createRaster(SampleModel sm, DataBuffer db, Point location) { if (sm == null || db == null) { // awt.27F=SampleModel or DataBuffer is null @@ -730,15 +780,16 @@ public class Raster { /** * Creates a WritableRaster with the specified SampleModel and DataBuffer. * - * @param sm the specified SampleModel. - * @param db the specified DataBuffer. - * @param location the location which defines the upper left corner - * of the Raster. - * + * @param sm + * the specified SampleModel. + * @param db + * the specified DataBuffer. + * @param location + * the location which defines the upper left corner of the + * Raster. * @return the WritableRaster. */ - public static WritableRaster createWritableRaster(SampleModel sm, - DataBuffer db, Point location) { + public static WritableRaster createWritableRaster(SampleModel sm, DataBuffer db, Point location) { if (sm == null || db == null) { // awt.27F=SampleModel or DataBuffer is null @@ -755,14 +806,14 @@ public class Raster { /** * Creates a WritableRaster with the specified SampleModel. * - * @param sm the specified SampleModel. - * @param location the location which defines the upper left corner - * of the Raster. - * + * @param sm + * the specified SampleModel. + * @param location + * the location which defines the upper left corner of the + * Raster. * @return the WritableRaster. */ - public static WritableRaster createWritableRaster(SampleModel sm, - Point location) { + public static WritableRaster createWritableRaster(SampleModel sm, Point location) { if (sm == null) { // awt.280=SampleModel is null @@ -780,34 +831,42 @@ public class Raster { * Instantiates a new Raster object with the specified SampleModel and * DataBuffer. * - * @param sampleModel the specified SampleModel. - * @param dataBuffer the specified DataBuffer. - * @param origin the specified origin. + * @param sampleModel + * the specified SampleModel. + * @param dataBuffer + * the specified DataBuffer. + * @param origin + * the specified origin. */ - protected Raster(SampleModel sampleModel, DataBuffer dataBuffer, - Point origin) { + protected Raster(SampleModel sampleModel, DataBuffer dataBuffer, Point origin) { - this(sampleModel, dataBuffer, new Rectangle(origin.x, origin.y, - sampleModel.getWidth(), sampleModel.getHeight()), origin, null); + this(sampleModel, dataBuffer, new Rectangle(origin.x, origin.y, sampleModel.getWidth(), + sampleModel.getHeight()), origin, null); } /** * Instantiates a new Raster object with the specified SampleModel, - * DataBuffer, rectangular region and parent Raster. - * - * @param sampleModel the specified SampleModel. - * @param dataBuffer the specified DataBuffer. - * @param aRegion the a rectangular region which defines the new image bounds. - * @param sampleModelTranslate this point defines the translation point - * from the SampleModel coordinates to the new Raster coordinates. - * @param parent the parent of this Raster. + * DataBuffer, rectangular region and parent Raster. + * + * @param sampleModel + * the specified SampleModel. + * @param dataBuffer + * the specified DataBuffer. + * @param aRegion + * the a rectangular region which defines the new image bounds. + * @param sampleModelTranslate + * this point defines the translation point from the SampleModel + * coordinates to the new Raster coordinates. + * @param parent + * the parent of this Raster. */ - protected Raster(SampleModel sampleModel, DataBuffer dataBuffer, - Rectangle aRegion, Point sampleModelTranslate, Raster parent) { + protected Raster(SampleModel sampleModel, DataBuffer dataBuffer, Rectangle aRegion, + Point sampleModelTranslate, Raster parent) { if (sampleModel == null || dataBuffer == null || aRegion == null || sampleModelTranslate == null) { - // awt.281=sampleModel, dataBuffer, aRegion or sampleModelTranslate is null + // awt.281=sampleModel, dataBuffer, aRegion or sampleModelTranslate + // is null throw new NullPointerException(Messages.getString("awt.281")); //$NON-NLS-1$ } @@ -816,27 +875,25 @@ public class Raster { throw new RasterFormatException(Messages.getString("awt.282")); //$NON-NLS-1$ } - if ((long) aRegion.x + (long) aRegion.width > Integer.MAX_VALUE) { + if ((long)aRegion.x + (long)aRegion.width > Integer.MAX_VALUE) { // awt.283=Overflow X coordinate of Raster throw new RasterFormatException(Messages.getString("awt.283")); //$NON-NLS-1$ } - if ((long) aRegion.y + (long) aRegion.height > Integer.MAX_VALUE) { + if ((long)aRegion.y + (long)aRegion.height > Integer.MAX_VALUE) { // awt.284=Overflow Y coordinate of Raster throw new RasterFormatException(Messages.getString("awt.284")); //$NON-NLS-1$ } - + if (sampleModel instanceof ComponentSampleModel) { validateDataBuffer(dataBuffer, aRegion.width, aRegion.height, - ((ComponentSampleModel) sampleModel).getScanlineStride()); + ((ComponentSampleModel)sampleModel).getScanlineStride()); } else if (sampleModel instanceof MultiPixelPackedSampleModel) { validateDataBuffer(dataBuffer, aRegion.width, aRegion.height, - ((MultiPixelPackedSampleModel) sampleModel) - .getScanlineStride()); + ((MultiPixelPackedSampleModel)sampleModel).getScanlineStride()); } else if (sampleModel instanceof SinglePixelPackedSampleModel) { validateDataBuffer(dataBuffer, aRegion.width, aRegion.height, - ((SinglePixelPackedSampleModel) sampleModel) - .getScanlineStride()); + ((SinglePixelPackedSampleModel)sampleModel).getScanlineStride()); } this.sampleModel = sampleModel; @@ -856,36 +913,44 @@ public class Raster { /** * Instantiates a new Raster with the specified SampleModel. * - * @param sampleModel the specified SampleModel. - * @param origin the origin. + * @param sampleModel + * the specified SampleModel. + * @param origin + * the origin. */ protected Raster(SampleModel sampleModel, Point origin) { - this(sampleModel, sampleModel.createDataBuffer(), new Rectangle( - origin.x, origin.y, sampleModel.getWidth(), sampleModel - .getHeight()), origin, null); + this(sampleModel, sampleModel.createDataBuffer(), new Rectangle(origin.x, origin.y, + sampleModel.getWidth(), sampleModel.getHeight()), origin, null); } /** * Creates the child of this Raster by sharing the specified rectangular - * area in this Raste. The parentX, parentY, width - * and height parameters specify the rectangular area to be shared. - * - * @param parentX the X coordinate of the upper left corner of this Raster. - * @param parentY the Y coordinate of the upper left corner of this Raster. - * @param width the width of the child area. - * @param height the height of the child area. - * @param childMinX the X coordinate of child area mapped to the parentX - * coordinate. - * @param childMinY the Y coordinate of child area mapped to the parentY - * coordinate. - * @param bandList the array of band indicies. - * + * area in this raster. The parentX, parentY, width and height parameters + * specify the rectangular area to be shared. + * + * @param parentX + * the X coordinate of the upper left corner of this Raster. + * @param parentY + * the Y coordinate of the upper left corner of this Raster. + * @param width + * the width of the child area. + * @param height + * the height of the child area. + * @param childMinX + * the X coordinate of child area mapped to the parentX + * coordinate. + * @param childMinY + * the Y coordinate of child area mapped to the parentY + * coordinate. + * @param bandList + * the array of band indices. * @return the Raster. */ - public Raster createChild(int parentX, int parentY, int width, int height, - int childMinX, int childMinY, int bandList[]) { + public Raster createChild(int parentX, int parentY, int width, int height, int childMinX, + int childMinY, int bandList[]) { if (width <= 0 || height <= 0) { - // awt.285=Width or Height of child Raster is less than or equal to zero + // awt.285=Width or Height of child Raster is less than or equal to + // zero throw new RasterFormatException(Messages.getString("awt.285")); //$NON-NLS-1$ } @@ -899,22 +964,22 @@ public class Raster { throw new RasterFormatException(Messages.getString("awt.287")); //$NON-NLS-1$ } - if ((long) parentX + width > Integer.MAX_VALUE) { + if ((long)parentX + width > Integer.MAX_VALUE) { // awt.288=parentX + width results in integer overflow throw new RasterFormatException(Messages.getString("awt.288")); //$NON-NLS-1$ } - if ((long) parentY + height > Integer.MAX_VALUE) { + if ((long)parentY + height > Integer.MAX_VALUE) { // awt.289=parentY + height results in integer overflow throw new RasterFormatException(Messages.getString("awt.289")); //$NON-NLS-1$ } - if ((long) childMinX + width > Integer.MAX_VALUE) { + if ((long)childMinX + width > Integer.MAX_VALUE) { // awt.28A=childMinX + width results in integer overflow throw new RasterFormatException(Messages.getString("awt.28A")); //$NON-NLS-1$ } - if ((long) childMinY + height > Integer.MAX_VALUE) { + if ((long)childMinY + height > Integer.MAX_VALUE) { // awt.28B=childMinY + height results in integer overflow throw new RasterFormatException(Messages.getString("awt.28B")); //$NON-NLS-1$ } @@ -930,15 +995,14 @@ public class Raster { int childTranslateX = childMinX - parentX; int childTranslateY = childMinY - parentY; - return new Raster(childModel, dataBuffer, new Rectangle(childMinX, - childMinY, width, height), new Point(childTranslateX - + sampleModelTranslateX, childTranslateY - + sampleModelTranslateY), this); + return new Raster(childModel, dataBuffer, + new Rectangle(childMinX, childMinY, width, height), new Point(childTranslateX + + sampleModelTranslateX, childTranslateY + sampleModelTranslateY), this); } /** - * Create a compatible WritableRaster with the same parameters - * as this Raster. + * Create a compatible WritableRaster with the same parameters as this + * Raster. * * @return the WritableRaster. */ @@ -947,12 +1011,13 @@ public class Raster { } /** - * Create a compatible WritableRaster with the same parameters - * as this Raster and the specified size. - * - * @param w the width of the new WritableRaster. - * @param h the height of the new WritableRaster. + * Create a compatible WritableRaster with the same parameters as this + * Raster and the specified size. * + * @param w + * the width of the new WritableRaster. + * @param h + * the height of the new WritableRaster. * @return the WritableRaster. */ public WritableRaster createCompatibleWritableRaster(int w, int h) { @@ -967,18 +1032,20 @@ public class Raster { } /** - * Create a compatible WritableRaster with the same parameters - * as this Raster and the specified size and location. - * - * @param x the X coordinate of the new WritableRaster. - * @param y the Y coordinate of the new WritableRaster. - * @param w the width of the new WritableRaster. - * @param h the height of the new WritableRaster. - * + * Create a compatible WritableRaster with the same parameters as this + * Raster and the specified size and location. + * + * @param x + * the X coordinate of the new WritableRaster. + * @param y + * the Y coordinate of the new WritableRaster. + * @param w + * the width of the new WritableRaster. + * @param h + * the height of the new WritableRaster. * @return the WritableRaster. */ - public WritableRaster createCompatibleWritableRaster(int x, int y, int w, - int h) { + public WritableRaster createCompatibleWritableRaster(int x, int y, int w, int h) { WritableRaster raster = createCompatibleWritableRaster(w, h); @@ -986,12 +1053,12 @@ public class Raster { } /** - * Create a compatible WritableRaster with the same parameters - * as this Raster and the specified rectangle which determines - * new WritableRaster's location and size. - * - * @param rect the specified Rectangle. + * Create a compatible WritableRaster with the same parameters as this + * Raster and the specified rectangle which determines new WritableRaster's + * location and size. * + * @param rect + * the specified Rectangle. * @return the WritableRaster. */ public WritableRaster createCompatibleWritableRaster(Rectangle rect) { @@ -1000,23 +1067,21 @@ public class Raster { throw new NullPointerException(Messages.getString("awt.28C")); //$NON-NLS-1$ } - return createCompatibleWritableRaster(rect.x, rect.y, rect.width, - rect.height); + return createCompatibleWritableRaster(rect.x, rect.y, rect.width, rect.height); } /** - * Creates the translated child of this Raster. The New Raster - * object is a reference to the this Raster with a - * different location. - * - * @param childMinX the X coordinate of the new Raster. - * @param childMinY the Y coordinate of the new Raster. + * Creates the translated child of this Raster. The New Raster object is a + * reference to the this Raster with a different location. * + * @param childMinX + * the X coordinate of the new Raster. + * @param childMinY + * the Y coordinate of the new Raster. * @return the Raster. */ public Raster createTranslatedChild(int childMinX, int childMinY) { - return createChild(minX, minY, width, height, childMinX, childMinY, - null); + return createChild(minX, minY, width, height, childMinX, childMinY, null); } /** @@ -1038,41 +1103,46 @@ public class Raster { } /** - * Gets the data elements which represent the pixel data of the specified - * rectangle area as a primitive array. The following image data types - * are supported: DataBuffer.TYPE_BYTE, DataBuffer.TYPE_USHORT, - * DataBuffer.TYPE_INT, DataBuffer.TYPE_SHORT, DataBuffer.TYPE_FLOAT, - * or DataBuffer.TYPE_DOUBLE. - * - * @param x the X coordinate of the area of pixels. - * @param y the Y coordinate of the area of pixels. - * @param w the width of the area of pixels. - * @param h the height of the area of pixels. - * @param outData the resulting array. - * + * Gets the data elements which represent the pixel data of the specified + * rectangle area as a primitive array. The following image data types are + * supported: DataBuffer.TYPE_BYTE, DataBuffer.TYPE_USHORT, + * DataBuffer.TYPE_INT, DataBuffer.TYPE_SHORT, DataBuffer.TYPE_FLOAT, or + * DataBuffer.TYPE_DOUBLE. + * + * @param x + * the X coordinate of the area of pixels. + * @param y + * the Y coordinate of the area of pixels. + * @param w + * the width of the area of pixels. + * @param h + * the height of the area of pixels. + * @param outData + * the resulting array. * @return the data elements of the specified area of this Raster. */ public Object getDataElements(int x, int y, int w, int h, Object outData) { - return sampleModel.getDataElements(x - sampleModelTranslateX, y - - sampleModelTranslateY, w, h, outData, dataBuffer); + return sampleModel.getDataElements(x - sampleModelTranslateX, y - sampleModelTranslateY, w, + h, outData, dataBuffer); } /** - * Gets the data elements which represent the specified pixel of - * this Raster as a primitive array. The following image data types - * are supported: DataBuffer.TYPE_BYTE, DataBuffer.TYPE_USHORT, - * DataBuffer.TYPE_INT, DataBuffer.TYPE_SHORT, DataBuffer.TYPE_FLOAT, - * or DataBuffer.TYPE_DOUBLE. - * - * @param x the X coordinate of the pixel. - * @param y the Y coordinate of the pixel. - * @param outData the resulting data. - * + * Gets the data elements which represent the specified pixel of this Raster + * as a primitive array. The following image data types are supported: + * DataBuffer.TYPE_BYTE, DataBuffer.TYPE_USHORT, DataBuffer.TYPE_INT, + * DataBuffer.TYPE_SHORT, DataBuffer.TYPE_FLOAT, or DataBuffer.TYPE_DOUBLE. + * + * @param x + * the X coordinate of the pixel. + * @param y + * the Y coordinate of the pixel. + * @param outData + * the resulting data. * @return the data elements of the specified pixel of this Raster. */ public Object getDataElements(int x, int y, Object outData) { - return sampleModel.getDataElements(x - sampleModelTranslateX, y - - sampleModelTranslateY, outData, dataBuffer); + return sampleModel.getDataElements(x - sampleModelTranslateX, y - sampleModelTranslateY, + outData, dataBuffer); } /** @@ -1121,7 +1191,7 @@ public class Raster { } /** - * Gets the parent Raster for this Raster object. + * Gets the parent Raster for this Raster object. * * @return the parent Raster for this Raster object. */ @@ -1130,150 +1200,173 @@ public class Raster { } /** - * Gets a double array of samples for the specified pixel in this Raster. - * - * @param x the pixel's X coordinate. - * @param y the pixel's Y coordinate. - * @param dArray the double array where result array will be stored. - * - * @return the double array of samples for the specified pixel in - * this Raster. + * Gets a double array of samples for the specified pixel in this Raster. + * + * @param x + * the pixel's X coordinate. + * @param y + * the pixel's Y coordinate. + * @param dArray + * the double array where result array will be stored. + * @return the double array of samples for the specified pixel in this + * Raster. */ public double[] getPixel(int x, int y, double dArray[]) { - return sampleModel.getPixel(x - sampleModelTranslateX, y - - sampleModelTranslateY, dArray, dataBuffer); + return sampleModel.getPixel(x - sampleModelTranslateX, y - sampleModelTranslateY, dArray, + dataBuffer); } /** - * Gets a float array of samples for the specified pixel in this Raster. - * - * @param x the pixel's X coordinate. - * @param y the pixel's Y coordinate. - * @param fArray the float array where the result array will be stored. - * - * @return the float array of samples for the specified pixel in - * this Raster. + * Gets a float array of samples for the specified pixel in this Raster. + * + * @param x + * the pixel's X coordinate. + * @param y + * the pixel's Y coordinate. + * @param fArray + * the float array where the result array will be stored. + * @return the float array of samples for the specified pixel in this + * Raster. */ public float[] getPixel(int x, int y, float fArray[]) { - return sampleModel.getPixel(x - sampleModelTranslateX, y - - sampleModelTranslateY, fArray, dataBuffer); + return sampleModel.getPixel(x - sampleModelTranslateX, y - sampleModelTranslateY, fArray, + dataBuffer); } /** - * Gets an int array of samples for the specified pixel in this Raster. - * - * @param x the pixel's X coordinate. - * @param y the pixel's Y coordinate. - * @param iArray the int array where the result array will be stored. - * - * @return the int array of samples for the specified pixel in - * this Raster. + * Gets an integer array of samples for the specified pixel in this Raster. + * + * @param x + * the pixel's X coordinate. + * @param y + * the pixel's Y coordinate. + * @param iArray + * the integer array where the result array will be stored. + * @return the integer array of samples for the specified pixel in this + * Raster. */ public int[] getPixel(int x, int y, int iArray[]) { - return sampleModel.getPixel(x - sampleModelTranslateX, y - - sampleModelTranslateY, iArray, dataBuffer); + return sampleModel.getPixel(x - sampleModelTranslateX, y - sampleModelTranslateY, iArray, + dataBuffer); } /** - * Gets an double array of samples for the specified rectangular - * area of pixels in this Raster. - * - * @param x the X coordinate of the area of pixels. - * @param y the Y coordinate of the area of pixels. - * @param w the width of the area of pixels. - * @param h the height of the area of pixels. - * @param dArray the resulting array. - * - * @return the double array of samples for the specified rectangular - * area of pixels in this Raster. + * Gets an double array of samples for the specified rectangular area of + * pixels in this Raster. + * + * @param x + * the X coordinate of the area of pixels. + * @param y + * the Y coordinate of the area of pixels. + * @param w + * the width of the area of pixels. + * @param h + * the height of the area of pixels. + * @param dArray + * the resulting array. + * @return the double array of samples for the specified rectangular area of + * pixels in this Raster. */ public double[] getPixels(int x, int y, int w, int h, double dArray[]) { - return sampleModel.getPixels(x - sampleModelTranslateX, y - - sampleModelTranslateY, w, h, dArray, dataBuffer); + return sampleModel.getPixels(x - sampleModelTranslateX, y - sampleModelTranslateY, w, h, + dArray, dataBuffer); } /** - * Gets an float array of samples for the specified rectangular - * area of pixels in this Raster. - * - * @param x the X coordinate of the area of pixels. - * @param y the Y coordinate of the area of pixels. - * @param w the width of the area of pixels. - * @param h the height of the area of pixels. - * @param fArray the resulting array. - * - * @return the float array of samples for the specified rectangular - * area of pixels in this Raster. + * Gets an float array of samples for the specified rectangular area of + * pixels in this Raster. + * + * @param x + * the X coordinate of the area of pixels. + * @param y + * the Y coordinate of the area of pixels. + * @param w + * the width of the area of pixels. + * @param h + * the height of the area of pixels. + * @param fArray + * the resulting array. + * @return the float array of samples for the specified rectangular area of + * pixels in this Raster. */ public float[] getPixels(int x, int y, int w, int h, float fArray[]) { - return sampleModel.getPixels(x - sampleModelTranslateX, y - - sampleModelTranslateY, w, h, fArray, dataBuffer); + return sampleModel.getPixels(x - sampleModelTranslateX, y - sampleModelTranslateY, w, h, + fArray, dataBuffer); } /** - * Gets an int array of samples for the specified rectangular - * area of pixels in this Raster. - * - * @param x the X coordinate of the area of pixels. - * @param y the Y coordinate of the area of pixels. - * @param w the width of pixel's the area of pixels. - * @param h the height of pixel's the area of pixels. - * @param iArray the resulting array. - * - * @return the int array of samples for the specified rectangular - * area of pixels in this Raster. + * Gets an integer array of samples for the specified rectangular area of + * pixels in this raster. + * + * @param x + * the X coordinate of the area of pixels. + * @param y + * the Y coordinate of the area of pixels. + * @param w + * the width of pixel's the area of pixels. + * @param h + * the height of pixel's the area of pixels. + * @param iArray + * the resulting array. + * @return the integer array of samples for the specified rectangular area + * of pixels in this Raster. */ public int[] getPixels(int x, int y, int w, int h, int iArray[]) { - return sampleModel.getPixels(x - sampleModelTranslateX, y - - sampleModelTranslateY, w, h, iArray, dataBuffer); + return sampleModel.getPixels(x - sampleModelTranslateX, y - sampleModelTranslateY, w, h, + iArray, dataBuffer); } /** - * Gets the sample for the specified band of the specified - * pixel as an int. - * - * @param x the X coordinate of the pixel. - * @param y the Y coordinate of the pixel. - * @param b the band. - * - * @return the sample for the specified band of the specified - * pixel as an int. + * Gets the sample for the specified band of the specified pixel as an + * integer. + * + * @param x + * the X coordinate of the pixel. + * @param y + * the Y coordinate of the pixel. + * @param b + * the band. + * @return the sample for the specified band of the specified pixel as an + * integer. */ public int getSample(int x, int y, int b) { - return sampleModel.getSample(x - sampleModelTranslateX, y - - sampleModelTranslateY, b, dataBuffer); + return sampleModel.getSample(x - sampleModelTranslateX, y - sampleModelTranslateY, b, + dataBuffer); } /** - * Gets the sample for the specified band of the specified - * pixel as a double. - * - * @param x the X coordinate of the pixel. - * @param y the Y coordinate of the pixel. - * @param b the band. - * - * @return the sample for the specified band of the specified - * pixel as a double. + * Gets the sample for the specified band of the specified pixel as a + * double. + * + * @param x + * the X coordinate of the pixel. + * @param y + * the Y coordinate of the pixel. + * @param b + * the band. + * @return the sample for the specified band of the specified pixel as a + * double. */ public double getSampleDouble(int x, int y, int b) { - return sampleModel.getSampleDouble(x - sampleModelTranslateX, y - - sampleModelTranslateY, b, dataBuffer); + return sampleModel.getSampleDouble(x - sampleModelTranslateX, y - sampleModelTranslateY, b, + dataBuffer); } /** - * Gets the sample for the specified band of the specified - * pixel as a float. - * - * @param x the X coordinate of the pixel. - * @param y the Y coordinate of the pixel. - * @param b the band. - * - * @return the sample for the specified band of the specified - * pixel as a float. + * Gets the sample for the specified band of the specified pixel as a float. + * + * @param x + * the X coordinate of the pixel. + * @param y + * the Y coordinate of the pixel. + * @param b + * the band. + * @return the sample for the specified band of the specified pixel as a + * float. */ public float getSampleFloat(int x, int y, int b) { - return sampleModel.getSampleFloat(x - sampleModelTranslateX, y - - sampleModelTranslateY, b, dataBuffer); + return sampleModel.getSampleFloat(x - sampleModelTranslateX, y - sampleModelTranslateY, b, + dataBuffer); } /** @@ -1286,97 +1379,105 @@ public class Raster { } /** - * Gets the translation of the X coordinate from the SampleModel - * coordinate system to the Rasters's coordinate system. + * Gets the translation of the X coordinate from the SampleModel coordinate + * system to the Rasters's coordinate system. * - * @return the value of the translation of the X coordinate from - * the SampleModel coordinate system to the Rasters's - * coordinate system. + * @return the value of the translation of the X coordinate from the + * SampleModel coordinate system to the Rasters's coordinate system. */ public final int getSampleModelTranslateX() { return sampleModelTranslateX; } /** - * Gets the translation of the Y coordinate from the SampleModel - * coordinate system to the Rasters's coordinate system. + * Gets the translation of the Y coordinate from the SampleModel coordinate + * system to the Rasters's coordinate system. * - * @return the value of the translation of the Y coordinate from - * the SampleModel coordinate system to the Rasters's - * coordinate system. - + * @return the value of the translation of the Y coordinate from the + * SampleModel coordinate system to the Rasters's coordinate system. */ public final int getSampleModelTranslateY() { return sampleModelTranslateY; } /** - * Gets the double array of samples for the specified band - * of the specified rectangular area of pixels in this Raster - * as a double array. - * - * @param x the X coordinate of the rectangular area of pixels. - * @param y the Y coordinate of the rectangular area of pixels. - * @param w the width of the rectangular area of pixels. - * @param h the height of the rectangular area of pixels. - * @param b the band. - * @param dArray the resulting double array. - * - * @return the double array of samples for the specified band - * of the specified rectangular area of pixels. + * Gets the double array of samples for the specified band of the specified + * rectangular area of pixels in this Raster as a double array. + * + * @param x + * the X coordinate of the rectangular area of pixels. + * @param y + * the Y coordinate of the rectangular area of pixels. + * @param w + * the width of the rectangular area of pixels. + * @param h + * the height of the rectangular area of pixels. + * @param b + * the band. + * @param dArray + * the resulting double array. + * @return the double array of samples for the specified band of the + * specified rectangular area of pixels. */ - public double[] getSamples(int x, int y, int w, int h, int b, - double dArray[]) { + public double[] getSamples(int x, int y, int w, int h, int b, double dArray[]) { - return sampleModel.getSamples(x - sampleModelTranslateX, y - - sampleModelTranslateY, w, h, b, dArray, dataBuffer); + return sampleModel.getSamples(x - sampleModelTranslateX, y - sampleModelTranslateY, w, h, + b, dArray, dataBuffer); } /** - * Gets the float array of samples for the specified band - * of the specified rectangular area of pixels in this Raster - * as a float array. - * - * @param x the X coordinate of the rectangular area of pixels. - * @param y the Y coordinate of the rectangular area of pixels. - * @param w the width of the rectangular area of pixels. - * @param h the height of the rectangular area of pixels. - * @param b the band. - * @param fArray the resulting float array. - * - * @return the float array of samples for the specified band - * of the specified rectangular area of pixels. + * Gets the float array of samples for the specified band of the specified + * rectangular area of pixels in this Raster as a float array. + * + * @param x + * the X coordinate of the rectangular area of pixels. + * @param y + * the Y coordinate of the rectangular area of pixels. + * @param w + * the width of the rectangular area of pixels. + * @param h + * the height of the rectangular area of pixels. + * @param b + * the band. + * @param fArray + * the resulting float array. + * @return the float array of samples for the specified band of the + * specified rectangular area of pixels. */ public float[] getSamples(int x, int y, int w, int h, int b, float fArray[]) { - return sampleModel.getSamples(x - sampleModelTranslateX, y - - sampleModelTranslateY, w, h, b, fArray, dataBuffer); + return sampleModel.getSamples(x - sampleModelTranslateX, y - sampleModelTranslateY, w, h, + b, fArray, dataBuffer); } /** - * Gets the int array of samples for the specified band - * of the specified rectangular area of pixels in this Raster - * as a int array. - * - * @param x the X coordinate of the rectangular area of pixels. - * @param y the Y coordinate of the rectangular area of pixels. - * @param w the width of the rectangular area of pixels. - * @param h the height of the rectangular area of pixels. - * @param b the band. - * @param iArray the resulting int array. - * - * @return the int array of samples for the specified band - * of the specified rectangular area of pixels. + * Gets the integer array of samples for the specified band of the specified + * rectangular area of pixels in this Raster as a integer array. + * + * @param x + * the X coordinate of the rectangular area of pixels. + * @param y + * the Y coordinate of the rectangular area of pixels. + * @param w + * the width of the rectangular area of pixels. + * @param h + * the height of the rectangular area of pixels. + * @param b + * the band. + * @param iArray + * the resulting integer array. + * @return the integer array of samples for the specified band of the + * specified rectangular area of pixels. */ public int[] getSamples(int x, int y, int w, int h, int b, int iArray[]) { - return sampleModel.getSamples(x - sampleModelTranslateX, y - - sampleModelTranslateY, w, h, b, iArray, dataBuffer); + return sampleModel.getSamples(x - sampleModelTranslateX, y - sampleModelTranslateY, w, h, + b, iArray, dataBuffer); } /** * Gets the transfer type for pixels of this Raster. - * @see SampleModel#getTransferType() * + * @see SampleModel#getTransferType() * @return the transfer type for pixels of this Raster. */ public final int getTransferType() { @@ -1395,18 +1496,20 @@ public class Raster { /** * Validate data buffer. * - * @param dataBuffer the data buffer - * @param w the w - * @param h the h - * @param scanlineStride the scanline stride + * @param dataBuffer + * the data buffer. + * @param w + * the w. + * @param h + * the h. + * @param scanlineStride + * the scanline stride. */ - private static void validateDataBuffer(final DataBuffer dataBuffer, final int w, - final int h, final int scanlineStride) { + private static void validateDataBuffer(final DataBuffer dataBuffer, final int w, final int h, + final int scanlineStride) { if (dataBuffer.getSize() < (scanlineStride * (h - 1) + w - 1)) { // awt.298=dataBuffer is too small throw new RasterFormatException(Messages.getString("awt.298")); //$NON-NLS-1$ } } } - - diff --git a/awt/java/awt/image/RasterFormatException.java b/awt/java/awt/image/RasterFormatException.java index 8577dad4b075d..c667141ff52f4 100644 --- a/awt/java/awt/image/RasterFormatException.java +++ b/awt/java/awt/image/RasterFormatException.java @@ -18,28 +18,31 @@ * @author Igor V. Stolyarov * @version $Revision$ */ -package java.awt.image; +package java.awt.image; /** - * The RasterFormatException class represents the exception - * that is thrown when there's an invalid layout - * in the Raster. + * The RasterFormatException class represents the exception that is thrown when + * there's an invalid layout in the Raster. + * + * @since Android 1.0 */ public class RasterFormatException extends RuntimeException { - /** The Constant serialVersionUID. */ + /** + * The Constant serialVersionUID. + */ private static final long serialVersionUID = 96598996116164315L; /** - * Instantiates a new RasterFormatException with the - * specified detail message. + * Instantiates a new RasterFormatException with the specified detail + * message. * - * @param s the detail message. + * @param s + * the detail message. */ public RasterFormatException(String s) { super(s); } } - diff --git a/awt/java/awt/image/RasterOp.java b/awt/java/awt/image/RasterOp.java index e8933ee4b6704..19a84c9df0ed1 100644 --- a/awt/java/awt/image/RasterOp.java +++ b/awt/java/awt/image/RasterOp.java @@ -18,6 +18,7 @@ * @author Alexey A. Petrenko * @version $Revision$ */ + package java.awt.image; import java.awt.RenderingHints; @@ -25,20 +26,22 @@ import java.awt.geom.Point2D; import java.awt.geom.Rectangle2D; /** - * The RasterOp interface provides methods for performing transformations - * from source data to destination data for Raster objects. The source and - * destination objects should contain the appropriate number of bands for - * the particular classes which implement this interface. + * The RasterOp interface provides methods for performing transformations from + * source data to destination data for Raster objects. The source and + * destination objects should contain the appropriate number of bands for the + * particular classes which implement this interface. + * + * @since Android 1.0 */ public interface RasterOp { - + /** - * Creates a destination WritableRaster with the specified Raster; - * this destination image data is empty and has the correct size - * and number of bands. - * - * @param src the source Raster. + * Creates a destination WritableRaster with the specified Raster; this + * destination image data is empty and has the correct size and number of + * bands. * + * @param src + * the source Raster. * @return the WritableRaster. */ public WritableRaster createCompatibleDestRaster(Raster src); @@ -47,9 +50,10 @@ public interface RasterOp { * Performs a filter operation on the source Raster and stores the resulting * image data to the destination WritableRaster. * - * @param src the source Raster. - * @param dst the destination WritableRaster, where the result is stored. - * + * @param src + * the source Raster. + * @param dst + * the destination WritableRaster, where the result is stored. * @return the filtered WritableRaster. */ public WritableRaster filter(Raster src, WritableRaster dst); @@ -57,19 +61,20 @@ public interface RasterOp { /** * Gets the bounds of the filtered Raster. * - * @param src the source Raster to be filtered. - * + * @param src + * the source Raster to be filtered. * @return the rectangle bounds of the filtered Raster. */ public Rectangle2D getBounds2D(Raster src); /** - * Gets the point of the destination image which corresponds - * to the specified point in the source raster. - * - * @param srcPoint the point of the source raster. - * @param dstPoint the point where the result will be stored. + * Gets the point of the destination image which corresponds to the + * specified point in the source raster. * + * @param srcPoint + * the point of the source raster. + * @param dstPoint + * the point where the result will be stored. * @return the destination point. */ public Point2D getPoint2D(Point2D srcPoint, Point2D dstPoint); diff --git a/awt/java/awt/image/RenderedImage.java b/awt/java/awt/image/RenderedImage.java index db3a4c842dd4e..5eafa649a1598 100644 --- a/awt/java/awt/image/RenderedImage.java +++ b/awt/java/awt/image/RenderedImage.java @@ -18,35 +18,37 @@ * @author Igor V. Stolyarov * @version $Revision$ */ + package java.awt.image; import java.awt.Rectangle; import java.util.Vector; /** - * The RenderedImage interface should be implemented by all objects which - * contains image data. The image data is represented as a single tile or - * an array of tiles. + * The RenderedImage interface should be implemented by all objects which + * contains image data. The image data is represented as a single tile or an + * array of tiles. + * + * @since Android 1.0 */ public interface RenderedImage { /** - * Gets the property with the specified name from the property set - * of this RenderedImage. - * - * @param name the property's name. + * Gets the property with the specified name from the property set of this + * RenderedImage. * + * @param name + * the property's name. * @return the property value corresponded to this property's name. */ public Object getProperty(String name); /** - * Copies the region of this RenderedImage to the specified - * WritableRaster. The bounds of the region are the bounds of the - * WritableRaster. - * - * @param raster the WritableRaster. + * Copies the region of this RenderedImage to the specified WritableRaster. + * The bounds of the region are the bounds of the WritableRaster. * + * @param raster + * the WritableRaster. * @return the created WritableRaster. */ public WritableRaster copyData(WritableRaster raster); @@ -54,19 +56,19 @@ public interface RenderedImage { /** * Gets the image data of the image's region as one tile. * - * @param rect the rectangular region of RenderedImage. - * + * @param rect + * the rectangular region of RenderedImage. * @return the image data of the image's region as one tile. */ public Raster getData(Rectangle rect); /** - * Gets all RenderedImage objects which are the source of this - * RenderedImage object. + * Gets all RenderedImage objects which are the source of this RenderedImage + * object. * - * @return a Vector of RenderedImage objects which are the source - * of this RenderedImage object or null, if there is no information - * about them. + * @return a Vector of RenderedImage objects which are the source of this + * RenderedImage object or null, if there is no information about + * them. */ public Vector getSources(); @@ -85,14 +87,13 @@ public interface RenderedImage { public SampleModel getSampleModel(); /** - * Gets the tile corresponded to the specified indices in the tile - * array. - * - * @param tileX the X index of the tile. - * @param tileY the Y index of the tile. + * Gets the tile corresponded to the specified indices in the tile array. * - * @return the tile corresponded to the specified indices in the tile - * array. + * @param tileX + * the X index of the tile. + * @param tileY + * the Y index of the tile. + * @return the tile corresponded to the specified indices in the tile array. */ public Raster getTile(int tileX, int tileY); @@ -195,4 +196,3 @@ public interface RenderedImage { public int getHeight(); } - diff --git a/awt/java/awt/image/ReplicateScaleFilter.java b/awt/java/awt/image/ReplicateScaleFilter.java index 9298125e0de24..51c0f4994200b 100644 --- a/awt/java/awt/image/ReplicateScaleFilter.java +++ b/awt/java/awt/image/ReplicateScaleFilter.java @@ -18,53 +18,69 @@ * @author Igor V. Stolyarov * @version $Revision$ */ + package java.awt.image; import java.util.Hashtable; import org.apache.harmony.awt.internal.nls.Messages; - /** - * The ReplicateScaleFilter class scales an source image - * by replicating rows and columns of pixels to scale up or - * omitting rows and columns of pixels to scale down. + * The ReplicateScaleFilter class scales an source image by replicating rows and + * columns of pixels to scale up or omitting rows and columns of pixels to scale + * down. + * + * @since Android 1.0 */ public class ReplicateScaleFilter extends ImageFilter { - /** The width of a source image. */ + /** + * The width of a source image. + */ protected int srcWidth; - /** The height of a source image. */ + /** + * The height of a source image. + */ protected int srcHeight; - /** The width of a destination image. */ + /** + * The width of a destination image. + */ protected int destWidth; - /** The height of a destination image. */ + /** + * The height of a destination image. + */ protected int destHeight; - /** The int array of source rows. */ + /** + * The integer array of source rows. + */ protected int[] srcrows; - /** The int array of source columns. */ + /** + * The integer array of source columns. + */ protected int[] srccols; - /** - * An Object (byte array with a destination width) provides - * a row of pixel data to the ImageConsumer. + /** + * An Object (byte array with a destination width) provides a row of pixel + * data to the ImageConsumer. */ protected Object outpixbuf; /** - * Instantiates a new ReplicateScaleFilter that filters - * the image with the specified width and height. + * Instantiates a new ReplicateScaleFilter that filters the image with the + * specified width and height. * - * @param width the width of scaled image. - * @param height the height of scaled image. + * @param width + * the width of scaled image. + * @param height + * the height of scaled image. */ public ReplicateScaleFilter(int width, int height) { - if(width == 0 || height == 0) { + if (width == 0 || height == 0) { // awt.234=Width or Height equals zero throw new IllegalArgumentException(Messages.getString("awt.234")); //$NON-NLS-1$ } @@ -77,40 +93,40 @@ public class ReplicateScaleFilter extends ImageFilter { @Override public void setProperties(Hashtable props) { Hashtable fprops; - if(props == null) { + if (props == null) { fprops = new Hashtable(); } else { - fprops = (Hashtable) props.clone(); + fprops = (Hashtable)props.clone(); } String propName = "Rescale Filters"; //$NON-NLS-1$ - String prop = "destWidth=" + destWidth + "; " + //$NON-NLS-1$ //$NON-NLS-2$ - "destHeight=" + destHeight; //$NON-NLS-1$ + String prop = "destWidth=" + destWidth + "; " + //$NON-NLS-1$ //$NON-NLS-2$ + "destHeight=" + destHeight; //$NON-NLS-1$ Object o = fprops.get(propName); - if(o != null){ - if(o instanceof String){ + if (o != null) { + if (o instanceof String) { prop = (String)o + "; " + prop; //$NON-NLS-1$ - }else{ - prop = o.toString() + "; " + prop; //$NON-NLS-1$ + } else { + prop = o.toString() + "; " + prop; //$NON-NLS-1$ } } fprops.put(propName, prop); consumer.setProperties(fprops); - } + } // setPixels methods produce pixels according to Java API Spacification @Override - public void setPixels(int x, int y, int w, int h, - ColorModel model, int[] pixels, int off, int scansize) { - - if(srccols == null) { + public void setPixels(int x, int y, int w, int h, ColorModel model, int[] pixels, int off, + int scansize) { + + if (srccols == null) { initArrays(); } int buff[]; - if(outpixbuf == null || !(outpixbuf instanceof int[])){ + if (outpixbuf == null || !(outpixbuf instanceof int[])) { buff = new int[destWidth]; outpixbuf = buff; - }else{ + } else { buff = (int[])outpixbuf; } @@ -121,32 +137,31 @@ public class ReplicateScaleFilter extends ImageFilter { int sx, sy, dx, dy; dy = dstY; - while((dy < destHeight) && ((sy = srcrows[dy]) < y + h)){ + while ((dy < destHeight) && ((sy = srcrows[dy]) < y + h)) { dx = dstX; int srcOff = off + (sy - y) * scansize; - while((dx < destWidth) && ((sx = srccols[dx]) < x + w)){ + while ((dx < destWidth) && ((sx = srccols[dx]) < x + w)) { buff[dx] = pixels[srcOff + (sx - x)]; dx++; } - consumer.setPixels(dstX, dy, dx - dstX, 1, model, buff, - dstX, destWidth); + consumer.setPixels(dstX, dy, dx - dstX, 1, model, buff, dstX, destWidth); dy++; } } @Override - public void setPixels(int x, int y, int w, int h, - ColorModel model, byte[] pixels, int off, int scansize) { - - if(srccols == null) { + public void setPixels(int x, int y, int w, int h, ColorModel model, byte[] pixels, int off, + int scansize) { + + if (srccols == null) { initArrays(); } byte buff[]; - if(outpixbuf == null || !(outpixbuf instanceof byte[])){ + if (outpixbuf == null || !(outpixbuf instanceof byte[])) { buff = new byte[destWidth]; outpixbuf = buff; - }else{ + } else { buff = (byte[])outpixbuf; } @@ -157,16 +172,15 @@ public class ReplicateScaleFilter extends ImageFilter { int sx, sy, dx, dy; dy = dstY; - while((dy < destHeight) && ((sy = srcrows[dy]) < y + h)){ + while ((dy < destHeight) && ((sy = srcrows[dy]) < y + h)) { dx = dstX; int srcOff = off + (sy - y) * scansize; - while((dx < destWidth) && ((sx = srccols[dx]) < x + w)){ + while ((dx < destWidth) && ((sx = srccols[dx]) < x + w)) { buff[dx] = pixels[srcOff + (sx - x)]; dx++; } - consumer.setPixels(dstX, dy, dx - dstX, 1, model, buff, - dstX, destWidth); + consumer.setPixels(dstX, dy, dx - dstX, 1, model, buff, dstX, destWidth); dy++; } } @@ -176,12 +190,12 @@ public class ReplicateScaleFilter extends ImageFilter { srcWidth = w; srcHeight = h; - if(destWidth < 0 && destHeight < 0){ + if (destWidth < 0 && destHeight < 0) { destWidth = srcWidth; destHeight = srcHeight; - }else if(destWidth < 0){ + } else if (destWidth < 0) { destWidth = destHeight * srcWidth / srcHeight; - }else if(destHeight < 0){ + } else if (destHeight < 0) { destHeight = destWidth * srcHeight / srcWidth; } consumer.setDimensions(destWidth, destHeight); @@ -190,24 +204,22 @@ public class ReplicateScaleFilter extends ImageFilter { /** * Initialization of srccols and srcrows arrays. */ - private void initArrays(){ + private void initArrays() { if ((destWidth < 0) || (destHeight < 0)) { throw new IndexOutOfBoundsException(); } - + srccols = new int[destWidth]; int ca = srcWidth >>> 1; - for(int i = 0; i < destWidth; i++){ + for (int i = 0; i < destWidth; i++) { srccols[i] = (i * srcWidth + ca) / destWidth; } srcrows = new int[destHeight]; int ra = srcHeight >>> 1; - for(int i = 0; i < destHeight; i++){ + for (int i = 0; i < destHeight; i++) { srcrows[i] = (i * srcHeight + ra) / destHeight; } } } - - diff --git a/awt/java/awt/image/RescaleOp.java b/awt/java/awt/image/RescaleOp.java index 0e96031cd8971..d7e2bd7684a9c 100644 --- a/awt/java/awt/image/RescaleOp.java +++ b/awt/java/awt/image/RescaleOp.java @@ -32,33 +32,43 @@ import org.apache.harmony.awt.gl.AwtImageBackdoorAccessor; import org.apache.harmony.awt.internal.nls.Messages; /** - * The Class RescaleOp performs rescaling of the source image data - * by multiplying the pixel values with a scale factor - * and then adding an offset. + * The Class RescaleOp performs rescaling of the source image data by + * multiplying the pixel values with a scale factor and then adding an offset. + * + * @since Android 1.0 */ public class RescaleOp implements BufferedImageOp, RasterOp { - - /** The scale factors. */ + + /** + * The scale factors. + */ private float scaleFactors[]; - - /** The offsets. */ + + /** + * The offsets. + */ private float offsets[]; - - /** The hints. */ + + /** + * The hints. + */ private RenderingHints hints; static { // TODO - //System.loadLibrary("imageops"); + // System.loadLibrary("imageops"); } /** - * Instantiates a new RescaleOp object with the specified - * scale factors and offsets. + * Instantiates a new RescaleOp object with the specified scale factors and + * offsets. * - * @param scaleFactors the array of scale factor values. - * @param offsets the array of offset values. - * @param hints the RenderingHints or null. + * @param scaleFactors + * the array of scale factor values. + * @param offsets + * the array of offset values. + * @param hints + * the RenderingHints or null. */ public RescaleOp(float[] scaleFactors, float[] offsets, RenderingHints hints) { int numFactors = Math.min(scaleFactors.length, offsets.length); @@ -73,12 +83,15 @@ public class RescaleOp implements BufferedImageOp, RasterOp { } /** - * Instantiates a new RescaleOp object with the specified - * scale factor and offset. + * Instantiates a new RescaleOp object with the specified scale factor and + * offset. * - * @param scaleFactor the scale factor. - * @param offset the offset. - * @param hints the RenderingHints or null. + * @param scaleFactor + * the scale factor. + * @param offset + * the offset. + * @param hints + * the RenderingHints or null. */ public RescaleOp(float scaleFactor, float offset, RenderingHints hints) { scaleFactors = new float[1]; @@ -106,9 +119,8 @@ public class RescaleOp implements BufferedImageOp, RasterOp { /** * Gets the scale factors of this RescaleOp. * - * @param scaleFactors the desired scale factors array will be copied - * to this array. - * + * @param scaleFactors + * the desired scale factors array will be copied to this array. * @return the scale factors array. */ public final float[] getScaleFactors(float[] scaleFactors) { @@ -124,8 +136,8 @@ public class RescaleOp implements BufferedImageOp, RasterOp { /** * Gets the offsets array of this RescaleOp. * - * @param offsets the desired offsets array will be copied to this array. - * + * @param offsets + * the desired offsets array will be copied to this array. * @return the offsets array of this RescaleOp. */ public final float[] getOffsets(float[] offsets) { @@ -168,17 +180,11 @@ public class RescaleOp implements BufferedImageOp, RasterOp { dstCM = ColorModel.getRGBdefault(); } - WritableRaster r = - dstCM.isCompatibleSampleModel(src.getSampleModel()) ? - src.getRaster().createCompatibleWritableRaster(src.getWidth(), src.getHeight()) : - dstCM.createCompatibleWritableRaster(src.getWidth(), src.getHeight()); - - return new BufferedImage( - dstCM, - r, - dstCM.isAlphaPremultiplied(), - null - ); + WritableRaster r = dstCM.isCompatibleSampleModel(src.getSampleModel()) ? src.getRaster() + .createCompatibleWritableRaster(src.getWidth(), src.getHeight()) : dstCM + .createCompatibleWritableRaster(src.getWidth(), src.getHeight()); + + return new BufferedImage(dstCM, r, dstCM.isAlphaPremultiplied(), null); } public final WritableRaster filter(Raster src, WritableRaster dst) { @@ -186,26 +192,25 @@ public class RescaleOp implements BufferedImageOp, RasterOp { dst = createCompatibleDestRaster(src); } else { if (src.getNumBands() != dst.getNumBands()) { - // awt.21D=Number of src bands ({0}) does not match number of dst bands ({1}) + // awt.21D=Number of src bands ({0}) does not match number of + // dst bands ({1}) throw new IllegalArgumentException(Messages.getString("awt.21D", //$NON-NLS-1$ src.getNumBands(), dst.getNumBands())); } } - if ( - this.scaleFactors.length != 1 && - this.scaleFactors.length != src.getNumBands() - ) { - // awt.21E=Number of scaling constants is not equal to the number of bands + if (this.scaleFactors.length != 1 && this.scaleFactors.length != src.getNumBands()) { + // awt.21E=Number of scaling constants is not equal to the number of + // bands throw new IllegalArgumentException(Messages.getString("awt.21E")); //$NON-NLS-1$ } // TODO - //if (ippFilter(src, dst, BufferedImage.TYPE_CUSTOM, false) != 0) - if (slowFilter(src, dst, false) != 0) { - // awt.21F=Unable to transform source - throw new ImagingOpException (Messages.getString("awt.21F")); //$NON-NLS-1$ - } + // if (ippFilter(src, dst, BufferedImage.TYPE_CUSTOM, false) != 0) + if (slowFilter(src, dst, false) != 0) { + // awt.21F=Unable to transform source + throw new ImagingOpException(Messages.getString("awt.21F")); //$NON-NLS-1$ + } return dst; } @@ -213,11 +218,13 @@ public class RescaleOp implements BufferedImageOp, RasterOp { /** * Slow filter. * - * @param src the src - * @param dst the dst - * @param skipAlpha the skip alpha - * - * @return the int + * @param src + * the src. + * @param dst + * the dst. + * @param skipAlpha + * the skip alpha. + * @return the int. */ private final int slowFilter(Raster src, WritableRaster dst, boolean skipAlpha) { SampleModel sm = src.getSampleModel(); @@ -235,7 +242,7 @@ public class RescaleOp implements BufferedImageOp, RasterOp { int[] masks = new int[numBands]; int[] sampleSizes = sm.getSampleSize(); - for (int i=0; i < numBands; i++){ + for (int i = 0; i < numBands; i++) { maxValues[i] = (1 << sampleSizes[i]) - 1; masks[i] = ~(maxValues[i]); } @@ -247,8 +254,8 @@ public class RescaleOp implements BufferedImageOp, RasterOp { // Cycle over pixels to be calculated if (skipAlpha) { // Always suppose that alpha channel is the last band if (scaleFactors.length > 1) { - for (int i = 0; i < pixels.length; ){ - for (int bandIdx = 0; bandIdx < numBands-1; bandIdx++, i++){ + for (int i = 0; i < pixels.length;) { + for (int bandIdx = 0; bandIdx < numBands - 1; bandIdx++, i++) { pixels[i] = pixels[i] * scaleFactors[bandIdx] + offsets[bandIdx]; // Check for overflow now if (((int)pixels[i] & masks[bandIdx]) != 0) { @@ -263,8 +270,8 @@ public class RescaleOp implements BufferedImageOp, RasterOp { i++; } } else { - for (int i = 0; i < pixels.length; ){ - for (int bandIdx = 0; bandIdx < numBands-1; bandIdx++, i++){ + for (int i = 0; i < pixels.length;) { + for (int bandIdx = 0; bandIdx < numBands - 1; bandIdx++, i++) { pixels[i] = pixels[i] * scaleFactors[0] + offsets[0]; // Check for overflow now if (((int)pixels[i] & masks[bandIdx]) != 0) { @@ -281,8 +288,8 @@ public class RescaleOp implements BufferedImageOp, RasterOp { } } else { if (scaleFactors.length > 1) { - for (int i = 0; i < pixels.length; ){ - for (int bandIdx = 0; bandIdx < numBands; bandIdx++, i++){ + for (int i = 0; i < pixels.length;) { + for (int bandIdx = 0; bandIdx < numBands; bandIdx++, i++) { pixels[i] = pixels[i] * scaleFactors[bandIdx] + offsets[bandIdx]; // Check for overflow now if (((int)pixels[i] & masks[bandIdx]) != 0) { @@ -295,8 +302,8 @@ public class RescaleOp implements BufferedImageOp, RasterOp { } } } else { - for (int i = 0; i < pixels.length; ){ - for (int bandIdx = 0; bandIdx < numBands; bandIdx++, i++){ + for (int i = 0; i < pixels.length;) { + for (int bandIdx = 0; bandIdx < numBands; bandIdx++, i++) { pixels[i] = pixels[i] * scaleFactors[0] + offsets[0]; // Check for overflow now if (((int)pixels[i] & masks[bandIdx]) != 0) { @@ -328,18 +335,20 @@ public class RescaleOp implements BufferedImageOp, RasterOp { int nComponents = srcCM.getNumComponents(); boolean skipAlpha; if (srcCM.hasAlpha()) { - if (scaleFactors.length == 1 || scaleFactors.length == nComponents-1) { + if (scaleFactors.length == 1 || scaleFactors.length == nComponents - 1) { skipAlpha = true; } else if (scaleFactors.length == nComponents) { skipAlpha = false; } else { - // awt.21E=Number of scaling constants is not equal to the number of bands + // awt.21E=Number of scaling constants is not equal to the + // number of bands throw new IllegalArgumentException(Messages.getString("awt.21E")); //$NON-NLS-1$ } } else if (scaleFactors.length == 1 || scaleFactors.length == nComponents) { skipAlpha = false; } else { - // awt.21E=Number of scaling constants is not equal to the number of bands + // awt.21E=Number of scaling constants is not equal to the number of + // bands throw new IllegalArgumentException(Messages.getString("awt.21E")); //$NON-NLS-1$ } @@ -348,24 +357,22 @@ public class RescaleOp implements BufferedImageOp, RasterOp { finalDst = dst; dst = createCompatibleDestImage(src, srcCM); } else if (!srcCM.equals(dst.getColorModel())) { - // Treat BufferedImage.TYPE_INT_RGB and BufferedImage.TYPE_INT_ARGB as same - if ( - !((src.getType() == BufferedImage.TYPE_INT_RGB || - src.getType() == BufferedImage.TYPE_INT_ARGB) && - (dst.getType() == BufferedImage.TYPE_INT_RGB || - dst.getType() == BufferedImage.TYPE_INT_ARGB)) - ) { + // Treat BufferedImage.TYPE_INT_RGB and BufferedImage.TYPE_INT_ARGB + // as same + if (!((src.getType() == BufferedImage.TYPE_INT_RGB || src.getType() == BufferedImage.TYPE_INT_ARGB) && (dst + .getType() == BufferedImage.TYPE_INT_RGB || dst.getType() == BufferedImage.TYPE_INT_ARGB))) { finalDst = dst; dst = createCompatibleDestImage(src, srcCM); } } // TODO - //if (ippFilter(src.getRaster(), dst.getRaster(), src.getType(), skipAlpha) != 0) - if (slowFilter(src.getRaster(), dst.getRaster(), skipAlpha) != 0) { - // awt.21F=Unable to transform source - throw new ImagingOpException (Messages.getString("awt.21F")); //$NON-NLS-1$ - } + // if (ippFilter(src.getRaster(), dst.getRaster(), src.getType(), + // skipAlpha) != 0) + if (slowFilter(src.getRaster(), dst.getRaster(), skipAlpha) != 0) { + // awt.21F=Unable to transform source + throw new ImagingOpException(Messages.getString("awt.21F")); //$NON-NLS-1$ + } if (finalDst != null) { Graphics2D g = finalDst.createGraphics(); @@ -378,21 +385,26 @@ public class RescaleOp implements BufferedImageOp, RasterOp { return finalDst; } - // Don't forget to pass allocated arrays for levels and values, size should be numBands*4 + // Don't forget to pass allocated arrays for levels and values, size should + // be numBands*4 /** * Creates the levels. * - * @param sm the sm - * @param numBands the num bands - * @param skipAlpha the skip alpha - * @param levels the levels - * @param values the values - * @param channelsOrder the channels order + * @param sm + * the sm. + * @param numBands + * the num bands. + * @param skipAlpha + * the skip alpha. + * @param levels + * the levels. + * @param values + * the values. + * @param channelsOrder + * the channels order. */ - private final void createLevels( - SampleModel sm, int numBands, boolean skipAlpha, - int levels[], int values[], int channelsOrder[] - ) { + private final void createLevels(SampleModel sm, int numBands, boolean skipAlpha, int levels[], + int values[], int channelsOrder[]) { // Suppose same sample size for all channels, otherwise use slow filter int maxValue = (1 << sm.getSampleSize(0)) - 1; @@ -411,17 +423,17 @@ public class RescaleOp implements BufferedImageOp, RasterOp { } if (skipAlpha) { - extScaleFactors[numBands-1] = 1; - extOffsets[numBands-1] = 0; + extScaleFactors[numBands - 1] = 1; + extOffsets[numBands - 1] = 0; } // Create a levels - for (int i=0; i maxValue){ + } else if (minLevel > maxValue) { minLevel = maxValue; } if (maxLevel < 0) { maxLevel = 0; - } else if (maxLevel > maxValue){ + } else if (maxLevel > maxValue) { maxLevel = maxValue; } - levels[i*4] = 0; + levels[i * 4] = 0; if (minLevel > maxLevel) { - levels[i*4+1] = (int) maxLevel; - levels[i*4+2] = (int) minLevel; + levels[i * 4 + 1] = (int)maxLevel; + levels[i * 4 + 2] = (int)minLevel; } else { - levels[i*4+1] = (int) minLevel; - levels[i*4+2] = (int) maxLevel; + levels[i * 4 + 1] = (int)minLevel; + levels[i * 4 + 2] = (int)maxLevel; } - levels[i*4+3] = maxValue+1; + levels[i * 4 + 3] = maxValue + 1; // Fill values - for (int k=0; k<4; k++) { - int idx = i*4+k; - values[idx] = (int) (extScaleFactors[i] * levels[idx] + extOffsets[i]); + for (int k = 0; k < 4; k++) { + int idx = i * 4 + k; + values[idx] = (int)(extScaleFactors[i] * levels[idx] + extOffsets[i]); if (values[idx] < 0) { values[idx] = 0; - } else if (values[idx] > maxValue){ + } else if (values[idx] > maxValue) { values[idx] = maxValue; } } @@ -463,14 +475,14 @@ public class RescaleOp implements BufferedImageOp, RasterOp { // Reorder data if channels are stored in different order if (channelsOrder != null) { - int len = numBands*4; + int len = numBands * 4; int savedLevels[] = new int[len]; int savedValues[] = new int[len]; System.arraycopy(levels, 0, savedLevels, 0, len); System.arraycopy(values, 0, savedValues, 0, len); for (int i = 0; i < channelsOrder.length; i++) { - System.arraycopy(savedLevels, i*4, levels, channelsOrder[i]*4, 4); - System.arraycopy(savedValues, i*4, values, channelsOrder[i]*4, 4); + System.arraycopy(savedLevels, i * 4, levels, channelsOrder[i] * 4, 4); + System.arraycopy(savedValues, i * 4, values, channelsOrder[i] * 4, 4); } } } @@ -479,18 +491,18 @@ public class RescaleOp implements BufferedImageOp, RasterOp { /** * Ipp filter. * - * @param src the src - * @param dst the dst - * @param imageType the image type - * @param skipAlpha the skip alpha - * - * @return the int + * @param src + * the src. + * @param dst + * the dst. + * @param imageType + * the image type. + * @param skipAlpha + * the skip alpha. + * @return the int. */ @SuppressWarnings("unused") - private final int ippFilter( - Raster src, WritableRaster dst, - int imageType, boolean skipAlpha - ) { + private final int ippFilter(Raster src, WritableRaster dst, int imageType, boolean skipAlpha) { int res; int srcStride, dstStride; @@ -503,9 +515,11 @@ public class RescaleOp implements BufferedImageOp, RasterOp { case BufferedImage.TYPE_INT_ARGB_PRE: case BufferedImage.TYPE_INT_RGB: { channels = 4; - srcStride = src.getWidth()*4; - dstStride = dst.getWidth()*4; - channelsOrder = new int[] {2, 1, 0, 3}; + srcStride = src.getWidth() * 4; + dstStride = dst.getWidth() * 4; + channelsOrder = new int[] { + 2, 1, 0, 3 + }; break; } @@ -513,8 +527,8 @@ public class RescaleOp implements BufferedImageOp, RasterOp { case BufferedImage.TYPE_4BYTE_ABGR_PRE: case BufferedImage.TYPE_INT_BGR: { channels = 4; - srcStride = src.getWidth()*4; - dstStride = dst.getWidth()*4; + srcStride = src.getWidth() * 4; + dstStride = dst.getWidth() * 4; break; } @@ -527,9 +541,11 @@ public class RescaleOp implements BufferedImageOp, RasterOp { case BufferedImage.TYPE_3BYTE_BGR: { channels = 3; - srcStride = src.getWidth()*3; - dstStride = dst.getWidth()*3; - channelsOrder = new int[] {2, 1, 0}; + srcStride = src.getWidth() * 3; + dstStride = dst.getWidth() * 3; + channelsOrder = new int[] { + 2, 1, 0 + }; break; } @@ -544,55 +560,46 @@ public class RescaleOp implements BufferedImageOp, RasterOp { SampleModel srcSM = src.getSampleModel(); SampleModel dstSM = dst.getSampleModel(); - if ( - srcSM instanceof PixelInterleavedSampleModel && - dstSM instanceof PixelInterleavedSampleModel - ) { + if (srcSM instanceof PixelInterleavedSampleModel + && dstSM instanceof PixelInterleavedSampleModel) { // Check PixelInterleavedSampleModel - if ( - srcSM.getDataType() != DataBuffer.TYPE_BYTE || - dstSM.getDataType() != DataBuffer.TYPE_BYTE - ) { + if (srcSM.getDataType() != DataBuffer.TYPE_BYTE + || dstSM.getDataType() != DataBuffer.TYPE_BYTE) { return slowFilter(src, dst, skipAlpha); } - channels = srcSM.getNumBands(); // Have IPP functions for 1, 3 and 4 channels + channels = srcSM.getNumBands(); // Have IPP functions for 1, + // 3 and 4 channels if (!(channels == 1 || channels == 3 || channels == 4)) { return slowFilter(src, dst, skipAlpha); } - srcStride = ((ComponentSampleModel) srcSM).getScanlineStride(); - dstStride = ((ComponentSampleModel) dstSM).getScanlineStride(); + srcStride = ((ComponentSampleModel)srcSM).getScanlineStride(); + dstStride = ((ComponentSampleModel)dstSM).getScanlineStride(); - channelsOrder = ((ComponentSampleModel) srcSM).getBandOffsets(); - } else if ( - srcSM instanceof SinglePixelPackedSampleModel && - dstSM instanceof SinglePixelPackedSampleModel - ) { + channelsOrder = ((ComponentSampleModel)srcSM).getBandOffsets(); + } else if (srcSM instanceof SinglePixelPackedSampleModel + && dstSM instanceof SinglePixelPackedSampleModel) { // Check SinglePixelPackedSampleModel - SinglePixelPackedSampleModel sppsm1 = (SinglePixelPackedSampleModel) srcSM; - SinglePixelPackedSampleModel sppsm2 = (SinglePixelPackedSampleModel) dstSM; + SinglePixelPackedSampleModel sppsm1 = (SinglePixelPackedSampleModel)srcSM; + SinglePixelPackedSampleModel sppsm2 = (SinglePixelPackedSampleModel)dstSM; channels = sppsm1.getNumBands(); - // TYPE_INT_RGB, TYPE_INT_ARGB... - if ( - sppsm1.getDataType() != DataBuffer.TYPE_INT || - sppsm2.getDataType() != DataBuffer.TYPE_INT || - !(channels == 3 || channels == 4) - ) { + // TYPE_INT_RGB, TYPE_INT_ARGB... + if (sppsm1.getDataType() != DataBuffer.TYPE_INT + || sppsm2.getDataType() != DataBuffer.TYPE_INT + || !(channels == 3 || channels == 4)) { return slowFilter(src, dst, skipAlpha); } // Check compatibility of sample models - if ( - !Arrays.equals(sppsm1.getBitOffsets(), sppsm2.getBitOffsets()) || - !Arrays.equals(sppsm1.getBitMasks(), sppsm2.getBitMasks()) - ) { + if (!Arrays.equals(sppsm1.getBitOffsets(), sppsm2.getBitOffsets()) + || !Arrays.equals(sppsm1.getBitMasks(), sppsm2.getBitMasks())) { return slowFilter(src, dst, skipAlpha); } - for (int i=0; i - * The image data is represented as a Raster with a DataBuffer - * and a SampleModel. The SampleModel allows access to the samples in the - * DataBuffer. + * The SampleModel class is abstract class for retrieving pixel's samples in the + * data of an image. Each pixel contains several samples. A sample is the set of + * values of the bands for single pixel. For example, each pixel in the RGB + * model contains three samples and there are three corresponding bands in the + * image data of such pixels representing red, green and blue components. + *

    + * The image data is represented as a Raster with a DataBuffer and a + * SampleModel. The SampleModel allows access to the samples in the DataBuffer. + * + * @since Android 1.0 */ public abstract class SampleModel { - /** The width of the image data which this SampleModel describes. */ + /** + * The width of the image data which this SampleModel describes. + */ protected int width; - /** The height of the image data which this SampleModel describes. */ + /** + * The height of the image data which this SampleModel describes. + */ protected int height; - /** The number of bands of image data which this SampleModel describes. */ + /** + * The number of bands of image data which this SampleModel describes. + */ protected int numBands; - /** The data type of the image data which this SampleModel describes. */ + /** + * The data type of the image data which this SampleModel describes. + */ protected int dataType; /** - * Instantiates a new SampleModel with the specified data type, - * width, height and number of bands. + * Instantiates a new SampleModel with the specified data type, width, + * height and number of bands. * - * @param dataType the data type of the image data. - * @param w the width of the image data. - * @param h the height of the image data. - * @param numBands the number of bands of the image data. + * @param dataType + * the data type of the image data. + * @param w + * the width of the image data. + * @param h + * the height of the image data. + * @param numBands + * the number of bands of the image data. */ public SampleModel(int dataType, int w, int h, int numBands) { if (w <= 0 || h <= 0) { @@ -63,15 +76,14 @@ public abstract class SampleModel { throw new IllegalArgumentException(Messages.getString("awt.22E")); //$NON-NLS-1$ } - double squre = ((double) w) * ((double) h); + double squre = ((double)w) * ((double)h); if (squre >= Integer.MAX_VALUE) { // awt.22F=The product of w and h is greater than Integer.MAX_VALUE throw new IllegalArgumentException(Messages.getString("awt.22F")); //$NON-NLS-1$ } - if (dataType < DataBuffer.TYPE_BYTE || - dataType > DataBuffer.TYPE_DOUBLE && - dataType != DataBuffer.TYPE_UNDEFINED) { + if (dataType < DataBuffer.TYPE_BYTE || dataType > DataBuffer.TYPE_DOUBLE + && dataType != DataBuffer.TYPE_UNDEFINED) { // awt.230=dataType is not one of the supported data types throw new IllegalArgumentException(Messages.getString("awt.230")); //$NON-NLS-1$ } @@ -89,154 +101,156 @@ public abstract class SampleModel { } /** - * Gets the data array for the specified pixel of the specified - * DataBuffer with one of the following types: - * DataBuffer.TYPE_BYTE, DataBuffer.TYPE_USHORT, - * DataBuffer.TYPE_INT, DataBuffer.TYPE_SHORT, + * Gets the data array for the specified pixel of the specified DataBuffer + * with one of the following types: DataBuffer.TYPE_BYTE, + * DataBuffer.TYPE_USHORT, DataBuffer.TYPE_INT, DataBuffer.TYPE_SHORT, * DataBuffer.TYPE_FLOAT, or DataBuffer.TYPE_DOUBLE. * - * @param x the X coordinate of pixel. - * @param y the Y coordinate of pixel. - * @param obj the Object is a data where the result will be stored. - * @param data the image data. - * - * @return the data array for the specified pixel of the specified - * DataBuffer. + * @param x + * the X coordinate of pixel. + * @param y + * the Y coordinate of pixel. + * @param obj + * the Object is a data where the result will be stored. + * @param data + * the image data. + * @return the data array for the specified pixel of the specified + * DataBuffer. */ - public abstract Object getDataElements(int x, int y, Object obj, - DataBuffer data); + public abstract Object getDataElements(int x, int y, Object obj, DataBuffer data); /** - * Gets the array of pixel data for the specified rectangular - * area of pixels of the specified DataBuffer with one of - * the following types: - * DataBuffer.TYPE_BYTE, DataBuffer.TYPE_USHORT, - * DataBuffer.TYPE_INT, DataBuffer.TYPE_SHORT, - * DataBuffer.TYPE_FLOAT, or DataBuffer.TYPE_DOUBLE. + * Gets the array of pixel data for the specified rectangular area of pixels + * of the specified DataBuffer with one of the following types: + * DataBuffer.TYPE_BYTE, DataBuffer.TYPE_USHORT, DataBuffer.TYPE_INT, + * DataBuffer.TYPE_SHORT, DataBuffer.TYPE_FLOAT, or DataBuffer.TYPE_DOUBLE. * - * - * @param x the X coordinate of the rectangular pixel area. - * @param y the Y coordinate of the rectangular pixel area. - * @param w the width of the rectangular pixel area. - * @param h the height of the rectangular pixel area. - * @param obj the Object is an array with the primitive type, - * where the result array will be stored. - * @param data the image data. - * - * @return the array of pixel data for the specified rectangular - * area of pixels of the specified DataBuffer object. + * @param x + * the X coordinate of the rectangular pixel area. + * @param y + * the Y coordinate of the rectangular pixel area. + * @param w + * the width of the rectangular pixel area. + * @param h + * the height of the rectangular pixel area. + * @param obj + * the Object is an array with the primitive type, where the + * result array will be stored. + * @param data + * the image data. + * @return the array of pixel data for the specified rectangular area of + * pixels of the specified DataBuffer object. */ - public Object getDataElements(int x, int y, int w, int h, Object obj, - DataBuffer data) { + public Object getDataElements(int x, int y, int w, int h, Object obj, DataBuffer data) { int numDataElements = getNumDataElements(); int idx = 0; switch (getTransferType()) { - case DataBuffer.TYPE_BYTE: - byte bdata[]; - byte bbuf[] = null; - - if (obj == null) { - bdata = new byte[numDataElements * w * h]; - } else { - bdata = (byte[]) obj; - } + case DataBuffer.TYPE_BYTE: + byte bdata[]; + byte bbuf[] = null; + + if (obj == null) { + bdata = new byte[numDataElements * w * h]; + } else { + bdata = (byte[])obj; + } - for (int i = y; i < y + h; i++) { - for (int j = x; j < x + w; j++) { - bbuf = (byte[]) getDataElements(j, i, bbuf, data); - for (int n = 0; n < numDataElements; n++) { - bdata[idx++] = bbuf[n]; + for (int i = y; i < y + h; i++) { + for (int j = x; j < x + w; j++) { + bbuf = (byte[])getDataElements(j, i, bbuf, data); + for (int n = 0; n < numDataElements; n++) { + bdata[idx++] = bbuf[n]; + } } } - } - obj = bdata; - break; - - case DataBuffer.TYPE_SHORT: - case DataBuffer.TYPE_USHORT: - short sdata[]; - short sbuf[] = null; - - if (obj == null) { - sdata = new short[numDataElements * w * h]; - } else { - sdata = (short[]) obj; - } + obj = bdata; + break; + + case DataBuffer.TYPE_SHORT: + case DataBuffer.TYPE_USHORT: + short sdata[]; + short sbuf[] = null; + + if (obj == null) { + sdata = new short[numDataElements * w * h]; + } else { + sdata = (short[])obj; + } - for (int i = y; i < y + h; i++) { - for (int j = x; j < x + w; j++) { - sbuf = (short[]) getDataElements(j, i, sbuf, data); - for (int n = 0; n < numDataElements; n++) { - sdata[idx++] = sbuf[n]; + for (int i = y; i < y + h; i++) { + for (int j = x; j < x + w; j++) { + sbuf = (short[])getDataElements(j, i, sbuf, data); + for (int n = 0; n < numDataElements; n++) { + sdata[idx++] = sbuf[n]; + } } } - } - obj = sdata; - break; + obj = sdata; + break; - case DataBuffer.TYPE_INT: - int idata[]; - int ibuf[] = null; + case DataBuffer.TYPE_INT: + int idata[]; + int ibuf[] = null; - if (obj == null) { - idata = new int[numDataElements * w * h]; - } else { - idata = (int[]) obj; - } + if (obj == null) { + idata = new int[numDataElements * w * h]; + } else { + idata = (int[])obj; + } - for (int i = y; i < y + h; i++) { - for (int j = x; j < x + w; j++) { - ibuf = (int[]) getDataElements(j, i, ibuf, data); - for (int n = 0; n < numDataElements; n++) { - idata[idx++] = ibuf[n]; + for (int i = y; i < y + h; i++) { + for (int j = x; j < x + w; j++) { + ibuf = (int[])getDataElements(j, i, ibuf, data); + for (int n = 0; n < numDataElements; n++) { + idata[idx++] = ibuf[n]; + } } } - } - obj = idata; - break; + obj = idata; + break; - case DataBuffer.TYPE_FLOAT: - float fdata[]; - float fbuf[] = null; + case DataBuffer.TYPE_FLOAT: + float fdata[]; + float fbuf[] = null; - if (obj == null) { - fdata = new float[numDataElements * w * h]; - } else { - fdata = (float[]) obj; - } + if (obj == null) { + fdata = new float[numDataElements * w * h]; + } else { + fdata = (float[])obj; + } - for (int i = y; i < y + h; i++) { - for (int j = x; j < x + w; j++) { - fbuf = (float[]) getDataElements(j, i, fbuf, data); - for (int n = 0; n < numDataElements; n++) { - fdata[idx++] = fbuf[n]; + for (int i = y; i < y + h; i++) { + for (int j = x; j < x + w; j++) { + fbuf = (float[])getDataElements(j, i, fbuf, data); + for (int n = 0; n < numDataElements; n++) { + fdata[idx++] = fbuf[n]; + } } } - } - obj = fdata; - break; + obj = fdata; + break; - case DataBuffer.TYPE_DOUBLE: - double ddata[]; - double dbuf[] = null; + case DataBuffer.TYPE_DOUBLE: + double ddata[]; + double dbuf[] = null; - if (obj == null) { - ddata = new double[numDataElements * w * h]; - } else { - ddata = (double[]) obj; - } + if (obj == null) { + ddata = new double[numDataElements * w * h]; + } else { + ddata = (double[])obj; + } - for (int i = y; i < y + h; i++) { - for (int j = x; j < x + w; j++) { - dbuf = (double[]) getDataElements(j, i, dbuf, data); - for (int n = 0; n < numDataElements; n++) { - ddata[idx++] = dbuf[n]; + for (int i = y; i < y + h; i++) { + for (int j = x; j < x + w; j++) { + dbuf = (double[])getDataElements(j, i, dbuf, data); + for (int n = 0; n < numDataElements; n++) { + ddata[idx++] = dbuf[n]; + } } } - } - obj = ddata; - break; + obj = ddata; + break; } @@ -244,140 +258,145 @@ public abstract class SampleModel { } /** - * Sets the data for a single pixel in the specified DataBuffer - * from a primitive array with one of the following types: - * DataBuffer.TYPE_BYTE, DataBuffer.TYPE_USHORT, - * DataBuffer.TYPE_INT, DataBuffer.TYPE_SHORT, - * DataBuffer.TYPE_FLOAT, or DataBuffer.TYPE_DOUBLE. + * Sets the data for a single pixel in the specified DataBuffer from a + * primitive array with one of the following types: DataBuffer.TYPE_BYTE, + * DataBuffer.TYPE_USHORT, DataBuffer.TYPE_INT, DataBuffer.TYPE_SHORT, + * DataBuffer.TYPE_FLOAT, or DataBuffer.TYPE_DOUBLE. * - * @param x the X coordinate of pixel. - * @param y the Y coordinate of pixel. - * @param obj the Object - the array of primitive pixel data - * to be set. - * @param data the image data. + * @param x + * the X coordinate of pixel. + * @param y + * the Y coordinate of pixel. + * @param obj + * the Object - the array of primitive pixel data to be set. + * @param data + * the image data. */ - public abstract void setDataElements(int x, int y, Object obj, - DataBuffer data); + public abstract void setDataElements(int x, int y, Object obj, DataBuffer data); /** - * Sets the data elements for a rectangular area of pixels in - * the specified DataBuffer from a primitive array with one of - * the following types: DataBuffer.TYPE_BYTE, DataBuffer.TYPE_USHORT, - * DataBuffer.TYPE_INT, DataBuffer.TYPE_SHORT, - * DataBuffer.TYPE_FLOAT, or DataBuffer.TYPE_DOUBLE. + * Sets the data elements for a rectangular area of pixels in the specified + * DataBuffer from a primitive array with one of the following types: + * DataBuffer.TYPE_BYTE, DataBuffer.TYPE_USHORT, DataBuffer.TYPE_INT, + * DataBuffer.TYPE_SHORT, DataBuffer.TYPE_FLOAT, or DataBuffer.TYPE_DOUBLE. * - * @param x the X coordinate of the specified rectangular area. - * @param y the Y coordinate of the specified rectangular area. - * @param w the width of rectangle. - * @param h the height of rectangle. - * @param obj the Object - the array of primitive pixel data - * to be set. - * @param data the image data. + * @param x + * the X coordinate of the specified rectangular area. + * @param y + * the Y coordinate of the specified rectangular area. + * @param w + * the width of rectangle. + * @param h + * the height of rectangle. + * @param obj + * the Object - the array of primitive pixel data to be set. + * @param data + * the image data. */ - public void setDataElements(int x, int y, int w, int h, Object obj, - DataBuffer data) { + public void setDataElements(int x, int y, int w, int h, Object obj, DataBuffer data) { int numDataElements = getNumDataElements(); int idx = 0; switch (getTransferType()) { - case DataBuffer.TYPE_BYTE: - byte bbuf[] = new byte[numDataElements]; - for (int i = y; i < y + h; i++) { - for (int j = x; j < x + w; j++) { - for (int n = 0; n < numDataElements; n++) { - bbuf[n] = ((byte[]) obj)[idx++]; + case DataBuffer.TYPE_BYTE: + byte bbuf[] = new byte[numDataElements]; + for (int i = y; i < y + h; i++) { + for (int j = x; j < x + w; j++) { + for (int n = 0; n < numDataElements; n++) { + bbuf[n] = ((byte[])obj)[idx++]; + } + setDataElements(j, i, bbuf, data); } - setDataElements(j, i, bbuf, data); } - } - break; - - case DataBuffer.TYPE_SHORT: - case DataBuffer.TYPE_USHORT: - short sbuf[] = new short[numDataElements]; - for (int i = y; i < y + h; i++) { - for (int j = x; j < x + w; j++) { - for (int n = 0; n < numDataElements; n++) { - sbuf[n] = ((short[]) obj)[idx++]; + break; + + case DataBuffer.TYPE_SHORT: + case DataBuffer.TYPE_USHORT: + short sbuf[] = new short[numDataElements]; + for (int i = y; i < y + h; i++) { + for (int j = x; j < x + w; j++) { + for (int n = 0; n < numDataElements; n++) { + sbuf[n] = ((short[])obj)[idx++]; + } + setDataElements(j, i, sbuf, data); } - setDataElements(j, i, sbuf, data); } - } - break; - - case DataBuffer.TYPE_INT: - int ibuf[] = new int[numDataElements]; - for (int i = y; i < y + h; i++) { - for (int j = x; j < x + w; j++) { - for (int n = 0; n < numDataElements; n++) { - ibuf[n] = ((int[]) obj)[idx++]; + break; + + case DataBuffer.TYPE_INT: + int ibuf[] = new int[numDataElements]; + for (int i = y; i < y + h; i++) { + for (int j = x; j < x + w; j++) { + for (int n = 0; n < numDataElements; n++) { + ibuf[n] = ((int[])obj)[idx++]; + } + setDataElements(j, i, ibuf, data); } - setDataElements(j, i, ibuf, data); } - } - break; - - case DataBuffer.TYPE_FLOAT: - float fbuf[] = new float[numDataElements]; - for (int i = y; i < y + h; i++) { - for (int j = x; j < x + w; j++) { - for (int n = 0; n < numDataElements; n++) { - fbuf[n] = ((float[]) obj)[idx++]; + break; + + case DataBuffer.TYPE_FLOAT: + float fbuf[] = new float[numDataElements]; + for (int i = y; i < y + h; i++) { + for (int j = x; j < x + w; j++) { + for (int n = 0; n < numDataElements; n++) { + fbuf[n] = ((float[])obj)[idx++]; + } + setDataElements(j, i, fbuf, data); } - setDataElements(j, i, fbuf, data); } - } - break; - - case DataBuffer.TYPE_DOUBLE: - double dbuf[] = new double[numDataElements]; - for (int i = y; i < y + h; i++) { - for (int j = x; j < x + w; j++) { - for (int n = 0; n < numDataElements; n++) { - dbuf[n] = ((double[]) obj)[idx++]; + break; + + case DataBuffer.TYPE_DOUBLE: + double dbuf[] = new double[numDataElements]; + for (int i = y; i < y + h; i++) { + for (int j = x; j < x + w; j++) { + for (int n = 0; n < numDataElements; n++) { + dbuf[n] = ((double[])obj)[idx++]; + } + setDataElements(j, i, dbuf, data); } - setDataElements(j, i, dbuf, data); } - } - break; + break; } } /** - * Creates a new SampleModel with the specified bands of - * this SampleModel. + * Creates a new SampleModel with the specified bands of this SampleModel. * - * @param bands the array of bands from this SampleModel. - * - * @return the SampleModel with the specified bands of - * this SampleModel. + * @param bands + * the array of bands from this SampleModel. + * @return the SampleModel with the specified bands of this SampleModel. */ public abstract SampleModel createSubsetSampleModel(int bands[]); /** - * Creates the SampleModel which has the same data as in - * this SampleModel with a different width and height. - * - * @param a0 the width of the image data. - * @param a1 the height of the image data. + * Creates the SampleModel which has the same data as in this SampleModel + * with a different width and height. * - * @return the SampleModel which has the same data as in - * this SampleModel with a different width and height. + * @param a0 + * the width of the image data. + * @param a1 + * the height of the image data. + * @return the SampleModel which has the same data as in this SampleModel + * with a different width and height. */ public abstract SampleModel createCompatibleSampleModel(int a0, int a1); /** - * Gets the samples of the specified pixel as a int array. + * Gets the samples of the specified pixel as an integer array. * - * @param x the X coordinate of pixel. - * @param y the Y coordinate of pixel. - * @param iArray the int array where result will be stored. - * @param data the image data. - * - * @return the int array with the samples of the specified pixel. - + * @param x + * the X coordinate of pixel. + * @param y + * the Y coordinate of pixel. + * @param iArray + * the integer array where result will be stored. + * @param data + * the image data. + * @return the integer array with the samples of the specified pixel. */ public int[] getPixel(int x, int y, int iArray[], DataBuffer data) { if (x < 0 || y < 0 || x >= this.width || y >= this.height) { @@ -400,12 +419,16 @@ public abstract class SampleModel { } /** - * Sets a pixel of the DataBuffer from a int array of samples. + * Sets a pixel of the DataBuffer from a integer array of samples. * - * @param x the X coordinate of pixel. - * @param y the Y coordinate of pixel. - * @param iArray the int array. - * @param data the image data. + * @param x + * the X coordinate of pixel. + * @param y + * the Y coordinate of pixel. + * @param iArray + * the integer array. + * @param data + * the image data. */ public void setPixel(int x, int y, int iArray[], DataBuffer data) { if (x < 0 || y < 0 || x >= this.width || y >= this.height) { @@ -420,11 +443,14 @@ public abstract class SampleModel { /** * Gets the samples of the specified pixel as a float array. * - * @param x the X coordinate of pixel. - * @param y the Y coordinate of pixel. - * @param fArray the float array where result will be stored. - * @param data the image data. - * + * @param x + * the X coordinate of pixel. + * @param y + * the Y coordinate of pixel. + * @param fArray + * the float array where result will be stored. + * @param data + * the image data. * @return the float array with the samples of the specified pixel. */ public float[] getPixel(int x, int y, float fArray[], DataBuffer data) { @@ -448,12 +474,16 @@ public abstract class SampleModel { } /** - * Sets a pixel of the DataBuffer from a float array of samples. + * Sets a pixel of the DataBuffer from a float array of samples. * - * @param x the X coordinate of pixel. - * @param y the Y coordinate of pixel. - * @param fArray the float array. - * @param data the image data. + * @param x + * the X coordinate of pixel. + * @param y + * the Y coordinate of pixel. + * @param fArray + * the float array. + * @param data + * the image data. */ public void setPixel(int x, int y, float fArray[], DataBuffer data) { if (x < 0 || y < 0 || x >= this.width || y >= this.height) { @@ -468,11 +498,14 @@ public abstract class SampleModel { /** * Gets the samples of the specified pixel as a double array. * - * @param x the X coordinate of pixel. - * @param y the Y coordinate of pixel. - * @param dArray the double array where result will be stored. - * @param data the image data. - * + * @param x + * the X coordinate of pixel. + * @param y + * the Y coordinate of pixel. + * @param dArray + * the double array where result will be stored. + * @param data + * the image data. * @return the double array with the samples of the specified pixel. */ public double[] getPixel(int x, int y, double dArray[], DataBuffer data) { @@ -496,12 +529,16 @@ public abstract class SampleModel { } /** - * Sets a pixel of the DataBuffer from a double array of samples. + * Sets a pixel of the DataBuffer from a double array of samples. * - * @param x the X coordinate of pixel. - * @param y the Y coordinate of pixel. - * @param dArray the double array. - * @param data the image data. + * @param x + * the X coordinate of pixel. + * @param y + * the Y coordinate of pixel. + * @param dArray + * the double array. + * @param data + * the image data. */ public void setPixel(int x, int y, double dArray[], DataBuffer data) { if (x < 0 || y < 0 || x >= this.width || y >= this.height) { @@ -514,43 +551,49 @@ public abstract class SampleModel { } /** - * Gets the sample of a specified band for the specified pixel - * as an int. - * - * @param x the X coordinate of pixel. - * @param y the Y coordinate of pixel. - * @param b the specified band. - * @param data the image data. + * Gets the sample of a specified band for the specified pixel as an + * integer. * + * @param x + * the X coordinate of pixel. + * @param y + * the Y coordinate of pixel. + * @param b + * the specified band. + * @param data + * the image data. * @return the sample of a specified band for the specified pixel. */ public abstract int getSample(int x, int y, int b, DataBuffer data); /** - * Gets the sample of a specified band for the specified pixel - * as a float. - * - * @param x the X coordinate of pixel. - * @param y the Y coordinate of pixel. - * @param b the specified band. - * @param data the image data. + * Gets the sample of a specified band for the specified pixel as a float. * + * @param x + * the X coordinate of pixel. + * @param y + * the Y coordinate of pixel. + * @param b + * the specified band. + * @param data + * the image data. * @return the sample of a specified band for the specified pixel. - */ public float getSampleFloat(int x, int y, int b, DataBuffer data) { return getSample(x, y, b, data); } /** - * Gets the sample of a specified band for the specified pixel - * as a double. - * - * @param x the X coordinate of pixel. - * @param y the Y coordinate of pixel. - * @param b the specified band. - * @param data the image data. + * Gets the sample of a specified band for the specified pixel as a double. * + * @param x + * the X coordinate of pixel. + * @param y + * the Y coordinate of pixel. + * @param b + * the specified band. + * @param data + * the image data. * @return the sample of a specified band for the specified pixel. */ public double getSampleDouble(int x, int y, int b, DataBuffer data) { @@ -558,21 +601,25 @@ public abstract class SampleModel { } /** - * Gets the samples of the specified rectangular area of pixels - * as a int array. - * - * @param x the X coordinate of the rectangle of pixels. - * @param y the Y coordinate of the rectangle of pixels. - * @param w the width of the rectangle of pixels. - * @param h the height of the rectangle of pixels. - * @param iArray the int array where result will be stored. - * @param data the image data. + * Gets the samples of the specified rectangular area of pixels as an + * integer array. * - * @return the int array with the samples of the specified - * rectangular area of pixels. + * @param x + * the X coordinate of the rectangle of pixels. + * @param y + * the Y coordinate of the rectangle of pixels. + * @param w + * the width of the rectangle of pixels. + * @param h + * the height of the rectangle of pixels. + * @param iArray + * the integer array where result will be stored. + * @param data + * the image data. + * @return the integer array with the samples of the specified rectangular + * area of pixels. */ - public int[] getPixels(int x, int y, int w, int h, int iArray[], - DataBuffer data) { + public int[] getPixels(int x, int y, int w, int h, int iArray[], DataBuffer data) { if (x < 0 || y < 0 || x + w > this.width || y + h > this.height) { // awt.63=Coordinates are not in bounds throw new ArrayIndexOutOfBoundsException(Messages.getString("awt.63")); //$NON-NLS-1$ @@ -597,18 +644,23 @@ public abstract class SampleModel { } /** - * Sets all of the samples for a rectangular area of pixels of the DataBuffer - * from an int array. + * Sets all of the samples for a rectangular area of pixels of the + * DataBuffer from an integer array. * - * @param x the X coordinate of the rectangle of pixels. - * @param y the Y coordinate of the rectangle of pixels. - * @param w the width of the rectangle of pixels. - * @param h the height of the rectangle of pixels. - * @param iArray the int array. - * @param data the image data. + * @param x + * the X coordinate of the rectangle of pixels. + * @param y + * the Y coordinate of the rectangle of pixels. + * @param w + * the width of the rectangle of pixels. + * @param h + * the height of the rectangle of pixels. + * @param iArray + * the integer array. + * @param data + * the image data. */ - public void setPixels(int x, int y, int w, int h, int iArray[], - DataBuffer data) { + public void setPixels(int x, int y, int w, int h, int iArray[], DataBuffer data) { if (x < 0 || y < 0 || x + w > this.width || y + h > this.height) { // awt.63=Coordinates are not in bounds throw new ArrayIndexOutOfBoundsException(Messages.getString("awt.63")); //$NON-NLS-1$ @@ -624,21 +676,25 @@ public abstract class SampleModel { } /** - * Gets the samples of the specified rectangular area of pixels - * as a float array. + * Gets the samples of the specified rectangular area of pixels as a float + * array. * - * @param x the X coordinate of the rectangle of pixels. - * @param y the Y coordinate of the rectangle of pixels. - * @param w the width of the rectangle of pixels. - * @param h the height of the rectangle of pixels. - * @param fArray the float array where result will be stored. - * @param data the image data. - * - * @return the float array with the samples of the specified - * rectangular area of pixels. + * @param x + * the X coordinate of the rectangle of pixels. + * @param y + * the Y coordinate of the rectangle of pixels. + * @param w + * the width of the rectangle of pixels. + * @param h + * the height of the rectangle of pixels. + * @param fArray + * the float array where result will be stored. + * @param data + * the image data. + * @return the float array with the samples of the specified rectangular + * area of pixels. */ - public float[] getPixels(int x, int y, int w, int h, float fArray[], - DataBuffer data) { + public float[] getPixels(int x, int y, int w, int h, float fArray[], DataBuffer data) { if (x < 0 || y < 0 || x + w > this.width || y + h > this.height) { // awt.63=Coordinates are not in bounds throw new ArrayIndexOutOfBoundsException(Messages.getString("awt.63")); //$NON-NLS-1$ @@ -663,18 +719,23 @@ public abstract class SampleModel { } /** - * Sets all of the samples for a rectangular area of pixels of the DataBuffer - * from a float array. + * Sets all of the samples for a rectangular area of pixels of the + * DataBuffer from a float array. * - * @param x the X coordinate of the rectangle of pixels. - * @param y the Y coordinate of the rectangle of pixels. - * @param w the width of the rectangle of pixels. - * @param h the height of the rectangle of pixels. - * @param fArray the float array. - * @param data the image data. + * @param x + * the X coordinate of the rectangle of pixels. + * @param y + * the Y coordinate of the rectangle of pixels. + * @param w + * the width of the rectangle of pixels. + * @param h + * the height of the rectangle of pixels. + * @param fArray + * the float array. + * @param data + * the image data. */ - public void setPixels(int x, int y, int w, int h, float fArray[], - DataBuffer data) { + public void setPixels(int x, int y, int w, int h, float fArray[], DataBuffer data) { if (x < 0 || y < 0 || x + w > this.width || y + h > this.height) { // awt.63=Coordinates are not in bounds throw new ArrayIndexOutOfBoundsException(Messages.getString("awt.63")); //$NON-NLS-1$ @@ -690,21 +751,25 @@ public abstract class SampleModel { } /** - * Gets the samples of the specified rectangular area of pixels - * as a double array. - * - * @param x the X coordinate of the rectangle of pixels. - * @param y the Y coordinate of the rectangle of pixels. - * @param w the width of the rectangle of pixels. - * @param h the height of the rectangle of pixels. - * @param dArray the double array where result will be stored. - * @param data the image data. + * Gets the samples of the specified rectangular area of pixels as a double + * array. * - * @return the double array with the samples of the specified - * rectangular area of pixels. + * @param x + * the X coordinate of the rectangle of pixels. + * @param y + * the Y coordinate of the rectangle of pixels. + * @param w + * the width of the rectangle of pixels. + * @param h + * the height of the rectangle of pixels. + * @param dArray + * the double array where result will be stored. + * @param data + * the image data. + * @return the double array with the samples of the specified rectangular + * area of pixels. */ - public double[] getPixels(int x, int y, int w, int h, double dArray[], - DataBuffer data) { + public double[] getPixels(int x, int y, int w, int h, double dArray[], DataBuffer data) { if (x < 0 || y < 0 || x + w > this.width || y + h > this.height) { // awt.63=Coordinates are not in bounds throw new ArrayIndexOutOfBoundsException(Messages.getString("awt.63")); //$NON-NLS-1$ @@ -729,18 +794,23 @@ public abstract class SampleModel { } /** - * Sets all of the samples for a rectangular area of pixels of the DataBuffer - * from a double array. + * Sets all of the samples for a rectangular area of pixels of the + * DataBuffer from a double array. * - * @param x the X coordinate of the rectangle of pixels. - * @param y the Y coordinate of the rectangle of pixels. - * @param w the width of the rectangle of pixels. - * @param h the height of the rectangle of pixels. - * @param dArray the double array. - * @param data the image data. + * @param x + * the X coordinate of the rectangle of pixels. + * @param y + * the Y coordinate of the rectangle of pixels. + * @param w + * the width of the rectangle of pixels. + * @param h + * the height of the rectangle of pixels. + * @param dArray + * the double array. + * @param data + * the image data. */ - public void setPixels(int x, int y, int w, int h, double dArray[], - DataBuffer data) { + public void setPixels(int x, int y, int w, int h, double dArray[], DataBuffer data) { if (x < 0 || y < 0 || x + w > this.width || y + h > this.height) { // awt.63=Coordinates are not in bounds throw new ArrayIndexOutOfBoundsException(Messages.getString("awt.63")); //$NON-NLS-1$ @@ -756,34 +826,44 @@ public abstract class SampleModel { } /** - * Sets a sample of the specified band for the specified pixel - * in the DataBuffer as int value. + * Sets a sample of the specified band for the specified pixel in the + * DataBuffer as integer value. * - * @param x the X coordinate of the pixel. - * @param y the Y coordinate of the pixel. - * @param b the specified band. - * @param s the sample as an int value. - * @param data the image data. + * @param x + * the X coordinate of the pixel. + * @param y + * the Y coordinate of the pixel. + * @param b + * the specified band. + * @param s + * the sample as an integer value. + * @param data + * the image data. */ public abstract void setSample(int x, int y, int b, int s, DataBuffer data); /** - * Gets the samples of a specified band for a specified rectangular - * area of pixels as a int array. - * - * @param x the X coordinate of the rectangle. - * @param y the Y coordinate of the rectangle. - * @param w the width of the rectangle. - * @param h the height of the rectangle. - * @param b the specified band. - * @param iArray the int array where result will be stored. - * @param data the image data. + * Gets the samples of a specified band for a specified rectangular area of + * pixels as a integer array. * - * @return the samples of a specified band for a specified rectangular - * area of pixels. + * @param x + * the X coordinate of the rectangle. + * @param y + * the Y coordinate of the rectangle. + * @param w + * the width of the rectangle. + * @param h + * the height of the rectangle. + * @param b + * the specified band. + * @param iArray + * the integer array where result will be stored. + * @param data + * the image data. + * @return the samples of a specified band for a specified rectangular area + * of pixels. */ - public int[] getSamples(int x, int y, int w, int h, int b, int iArray[], - DataBuffer data) { + public int[] getSamples(int x, int y, int w, int h, int b, int iArray[], DataBuffer data) { int samples[]; int idx = 0; @@ -803,19 +883,25 @@ public abstract class SampleModel { } /** - * Sets the samples from an int array in the specified band for - * the specified rectangle of pixels. + * Sets the samples from an integer array in the specified band for the + * specified rectangle of pixels. * - * @param x the X coordinate of the rectangle. - * @param y the Y coordinate of the rectangle. - * @param w the width of the rectangle. - * @param h the height of the rectangle. - * @param b the specified band. - * @param iArray the int array. - * @param data the image data. + * @param x + * the X coordinate of the rectangle. + * @param y + * the Y coordinate of the rectangle. + * @param w + * the width of the rectangle. + * @param h + * the height of the rectangle. + * @param b + * the specified band. + * @param iArray + * the integer array. + * @param data + * the image data. */ - public void setSamples(int x, int y, int w, int h, int b, int iArray[], - DataBuffer data) { + public void setSamples(int x, int y, int w, int h, int b, int iArray[], DataBuffer data) { int idx = 0; for (int i = y; i < y + h; i++) { for (int j = x; j < x + w; j++) { @@ -825,22 +911,27 @@ public abstract class SampleModel { } /** - * Gets the samples of a specified band for a specified rectangular - * area of pixels as a float array. + * Gets the samples of a specified band for a specified rectangular area of + * pixels as a float array. * - * @param x the X coordinate of the rectangle. - * @param y the Y coordinate of the rectangle. - * @param w the width of the rectangle. - * @param h the height of the rectangle. - * @param b the specified band. - * @param fArray the float array where result will be stored. - * @param data the image data. - * - * @return the samples of a specified band for a specified rectangular - * area of pixels. + * @param x + * the X coordinate of the rectangle. + * @param y + * the Y coordinate of the rectangle. + * @param w + * the width of the rectangle. + * @param h + * the height of the rectangle. + * @param b + * the specified band. + * @param fArray + * the float array where result will be stored. + * @param data + * the image data. + * @return the samples of a specified band for a specified rectangular area + * of pixels. */ - public float[] getSamples(int x, int y, int w, int h, int b, - float fArray[], DataBuffer data) { + public float[] getSamples(int x, int y, int w, int h, int b, float fArray[], DataBuffer data) { float samples[]; int idx = 0; @@ -860,19 +951,25 @@ public abstract class SampleModel { } /** - * Sets the samples from an float array in the specified band for - * the specified rectangle of pixels. + * Sets the samples from an float array in the specified band for the + * specified rectangle of pixels. * - * @param x the X coordinate of the rectangle. - * @param y the Y coordinate of the rectangle. - * @param w the width of the rectangle. - * @param h the height of the rectangle. - * @param b the specified band. - * @param fArray the float array - * @param data the image data. + * @param x + * the X coordinate of the rectangle. + * @param y + * the Y coordinate of the rectangle. + * @param w + * the width of the rectangle. + * @param h + * the height of the rectangle. + * @param b + * the specified band. + * @param fArray + * the float array. + * @param data + * the image data. */ - public void setSamples(int x, int y, int w, int h, int b, float fArray[], - DataBuffer data) { + public void setSamples(int x, int y, int w, int h, int b, float fArray[], DataBuffer data) { int idx = 0; for (int i = y; i < y + h; i++) { for (int j = x; j < x + w; j++) { @@ -882,22 +979,27 @@ public abstract class SampleModel { } /** - * Gets the samples of a specified band for a specified rectangular - * area of pixels as a double array. - * - * @param x the X coordinate of the rectangle. - * @param y the Y coordinate of the rectangle. - * @param w the width of the rectangle. - * @param h the height of the rectangle. - * @param b the specified band. - * @param dArray the double array where result will be stored. - * @param data the image data. + * Gets the samples of a specified band for a specified rectangular area of + * pixels as a double array. * - * @return the samples of a specified band for a specified rectangular - * area of pixels. + * @param x + * the X coordinate of the rectangle. + * @param y + * the Y coordinate of the rectangle. + * @param w + * the width of the rectangle. + * @param h + * the height of the rectangle. + * @param b + * the specified band. + * @param dArray + * the double array where result will be stored. + * @param data + * the image data. + * @return the samples of a specified band for a specified rectangular area + * of pixels. */ - public double[] getSamples(int x, int y, int w, int h, int b, - double dArray[], DataBuffer data) { + public double[] getSamples(int x, int y, int w, int h, int b, double dArray[], DataBuffer data) { double samples[]; int idx = 0; @@ -917,19 +1019,25 @@ public abstract class SampleModel { } /** - * Sets the samples from an double array in the specified band for - * the specified rectangle of pixels. + * Sets the samples from an double array in the specified band for the + * specified rectangle of pixels. * - * @param x the X coordinate of the rectangle. - * @param y the Y coordinate of the rectangle. - * @param w the width of the rectangle. - * @param h the height of the rectangle. - * @param b the specified band. - * @param dArray the double array - * @param data the image data. + * @param x + * the X coordinate of the rectangle. + * @param y + * the Y coordinate of the rectangle. + * @param w + * the width of the rectangle. + * @param h + * the height of the rectangle. + * @param b + * the specified band. + * @param dArray + * the double array. + * @param data + * the image data. */ - public void setSamples(int x, int y, int w, int h, int b, double dArray[], - DataBuffer data) { + public void setSamples(int x, int y, int w, int h, int b, double dArray[], DataBuffer data) { int idx = 0; for (int i = y; i < y + h; i++) { for (int j = x; j < x + w; j++) { @@ -939,53 +1047,62 @@ public abstract class SampleModel { } /** - * Sets a sample of the specified band for the specified pixel - * in the DataBuffer as float value. + * Sets a sample of the specified band for the specified pixel in the + * DataBuffer as float value. * - * @param x the X coordinate of the pixel. - * @param y the Y coordinate of the pixel. - * @param b the specified band. - * @param s the sample as float value. - * @param data the image data. + * @param x + * the X coordinate of the pixel. + * @param y + * the Y coordinate of the pixel. + * @param b + * the specified band. + * @param s + * the sample as float value. + * @param data + * the image data. */ public void setSample(int x, int y, int b, float s, DataBuffer data) { - setSample(x, y, b, (int) s, data); + setSample(x, y, b, (int)s, data); } /** - * Sets a sample of the specified band for the specified pixel - * in the DataBuffer as double value. + * Sets a sample of the specified band for the specified pixel in the + * DataBuffer as double value. * - * @param x the X coordinate of the pixel. - * @param y the Y coordinate of the pixel. - * @param b the specified band. - * @param s the sample as double value. - * @param data the image data. + * @param x + * the X coordinate of the pixel. + * @param y + * the Y coordinate of the pixel. + * @param b + * the specified band. + * @param s + * the sample as double value. + * @param data + * the image data. */ public void setSample(int x, int y, int b, double s, DataBuffer data) { - setSample(x, y, b, (int) s, data); + setSample(x, y, b, (int)s, data); } /** - * Creates a DataBuffer object which corresponds to the SampleModel. - * - * @return the DataBuffer object which corresponds to - * the SampleModel. + * Creates a DataBuffer object which corresponds to the SampleModel. + * + * @return the DataBuffer object which corresponds to the SampleModel. */ public abstract DataBuffer createDataBuffer(); /** * Gets the sample size in bits for the specified band. * - * @param band the specified band. - * + * @param band + * the specified band. * @return the sample size in bits for the specified band. */ public abstract int getSampleSize(int band); /** * Gets an array of the sample size in bits for all bands. - * + * * @return an array of the sample size in bits for all bands. */ public abstract int[] getSampleSize(); @@ -1000,10 +1117,9 @@ public abstract class SampleModel { } /** - * Gets the transfer type used to transfer pixels via - * the getDataElements and setDataElements methods. - * Transfer type value can be one of the predefined type - * from DataBuffer class or not. + * Gets the transfer type used to transfer pixels via the getDataElements + * and setDataElements methods. Transfer type value can be one of the + * predefined type from DataBuffer class or not. * * @return the transfer type. */ @@ -1012,20 +1128,18 @@ public abstract class SampleModel { } /** - * Returns the number of data elements for pixel transfering - * via the getDataElements and setDataElements methods. + * Returns the number of data elements for pixel transferring via the + * getDataElements and setDataElements methods. * - * @return the number of data elements for pixel transfering - * via the getDataElements and setDataElements methods. + * @return the number of data elements for pixel transferring via the + * getDataElements and setDataElements methods. */ public abstract int getNumDataElements(); /** - * Gets the number of bands in the image data of this - * SampleModel object. + * Gets the number of bands in the image data of this SampleModel object. * - * @return the number of bands in the image data of this - * SampleModel object. + * @return the number of bands in the image data of this SampleModel object. */ public final int getNumBands() { return numBands; @@ -1050,4 +1164,3 @@ public abstract class SampleModel { } } - diff --git a/awt/java/awt/image/ShortLookupTable.java b/awt/java/awt/image/ShortLookupTable.java index 77c9c457223b8..4319d58056a3b 100644 --- a/awt/java/awt/image/ShortLookupTable.java +++ b/awt/java/awt/image/ShortLookupTable.java @@ -23,27 +23,30 @@ package java.awt.image; - /** - * The ShortLookupTable class provides provides functionality for - * lookup operations, and is defined by an input short array for - * bands or components of image and an offset value. - * The offset value will be subtracted from the input values before - * indexing the input arrays. The output of a lookup operation is + * The ShortLookupTable class provides provides functionality for lookup + * operations, and is defined by an input short array for bands or components of + * image and an offset value. The offset value will be subtracted from the input + * values before indexing the input arrays. The output of a lookup operation is * represented as an unsigned short array. + * + * @since Android 1.0 */ public class ShortLookupTable extends LookupTable { - - /** The data. */ + + /** + * The data. + */ private short data[][]; /** - * Instantiates a new ShortLookupTable with the specified offset value - * and the specified short array which represents lookup table for - * all bands. + * Instantiates a new ShortLookupTable with the specified offset value and + * the specified short array which represents lookup table for all bands. * - * @param offset the offset value. - * @param data the data array. + * @param offset + * the offset value. + * @param data + * the data array. */ public ShortLookupTable(int offset, short[] data) { super(offset, 1); @@ -53,12 +56,14 @@ public class ShortLookupTable extends LookupTable { } /** - * Instantiates a new ShortLookupTable with the specified offset value - * and the specified short array of arrays which represents lookup table - * for each band. + * Instantiates a new ShortLookupTable with the specified offset value and + * the specified short array of arrays which represents lookup table for + * each band. * - * @param offset the offset value. - * @param data the data array of arrays for each band. + * @param offset + * the offset value. + * @param data + * the data array of arrays for each band. */ public ShortLookupTable(int offset, short[][] data) { super(offset, data.length); @@ -70,9 +75,9 @@ public class ShortLookupTable extends LookupTable { } /** - * Gets the lookup table of this ShortLookupTable object. If - * this ShortLookupTable object has one short array for all bands, - * the returned array length is one. + * Gets the lookup table of this ShortLookupTable object. If this + * ShortLookupTable object has one short array for all bands, the returned + * array length is one. * * @return the lookup table of this ShortLookupTable object. */ @@ -81,14 +86,14 @@ public class ShortLookupTable extends LookupTable { } /** - * Returns a short array which contains samples of the specified - * pixel which is translated with the lookup table of this - * ShortLookupTable object. The resulted array is stored to - * the dst array. - * - * @param src the source array. - * @param dst the destination array where the result can be stored. + * Returns a short array which contains samples of the specified pixel which + * is translated with the lookup table of this ShortLookupTable object. The + * resulted array is stored to the dst array. * + * @param src + * the source array. + * @param dst + * the destination array where the result can be stored. * @return the short array of translated samples of a pixel. */ public short[] lookupPixel(short[] src, short[] dst) { @@ -99,11 +104,11 @@ public class ShortLookupTable extends LookupTable { int offset = getOffset(); if (getNumComponents() == 1) { for (int i = 0; i < src.length; i++) { - dst[i] = data[0][src[i]-offset]; + dst[i] = data[0][src[i] - offset]; } } else { for (int i = 0; i < getNumComponents(); i++) { - dst[i] = data[i][src[i]-offset]; + dst[i] = data[i][src[i] - offset]; } } @@ -119,11 +124,11 @@ public class ShortLookupTable extends LookupTable { int offset = getOffset(); if (getNumComponents() == 1) { for (int i = 0; i < src.length; i++) { - dst[i] = data[0][src[i]-offset]; + dst[i] = data[0][src[i] - offset]; } } else { for (int i = 0; i < getNumComponents(); i++) { - dst[i] = data[i][src[i]-offset]; + dst[i] = data[i][src[i] - offset]; } } diff --git a/awt/java/awt/image/SinglePixelPackedSampleModel.java b/awt/java/awt/image/SinglePixelPackedSampleModel.java index 311395a1d63fb..69f3353b3af88 100644 --- a/awt/java/awt/image/SinglePixelPackedSampleModel.java +++ b/awt/java/awt/image/SinglePixelPackedSampleModel.java @@ -18,6 +18,7 @@ * @author Igor V. Stolyarov * @version $Revision$ */ + package java.awt.image; import java.util.Arrays; @@ -25,39 +26,54 @@ import java.util.Arrays; import org.apache.harmony.awt.internal.nls.Messages; /** - * The SinglePixelPackedSampleModel class represents pixel data - * where several samples combine to create a single pixel and - * are stored in a single data array element. This class - * supports TYPE_BYTE, TYPE_USHORT, TYPE_INT data types. + * The SinglePixelPackedSampleModel class represents pixel data where several + * samples combine to create a single pixel and are stored in a single data + * array element. This class supports TYPE_BYTE, TYPE_USHORT, TYPE_INT data + * types. + * + * @since Android 1.0 */ public class SinglePixelPackedSampleModel extends SampleModel { - /** The bit masks. */ + /** + * The bit masks. + */ private int bitMasks[]; - /** The bit offsets. */ + /** + * The bit offsets. + */ private int bitOffsets[]; - /** The bit sizes. */ + /** + * The bit sizes. + */ private int bitSizes[]; - /** The scanline stride. */ + /** + * The scanline stride. + */ private int scanlineStride; - /** The max bit size. */ + /** + * The max bit size. + */ private int maxBitSize; /** * Instantiates a new SinglePixelPackedSampleModel with the specified * parameters. * - * @param dataType the data type of samples. - * @param w the width of the image data. - * @param h the height of the image data. - * @param bitMasks the bit masks for all the bands. + * @param dataType + * the data type of samples. + * @param w + * the width of the image data. + * @param h + * the height of the image data. + * @param bitMasks + * the bit masks for all the bands. */ - public SinglePixelPackedSampleModel(int dataType, int w, int h, - int bitMasks[]) { + public SinglePixelPackedSampleModel(int dataType, int w, int h, int bitMasks[]) { this(dataType, w, h, w, bitMasks); } @@ -65,20 +81,24 @@ public class SinglePixelPackedSampleModel extends SampleModel { * Instantiates a new SinglePixelPackedSampleModel with the specified * parameters. * - * @param dataType the data type of the samples. - * @param w the width of the image data. - * @param h the height of the image data. - * @param scanlineStride The scanline stride of the image data. - * @param bitMasks the bit masks for all the bands. + * @param dataType + * the data type of the samples. + * @param w + * the width of the image data. + * @param h + * the height of the image data. + * @param scanlineStride + * the scanline stride of the image data. + * @param bitMasks + * the bit masks for all the bands. */ - public SinglePixelPackedSampleModel(int dataType, int w, int h, - int scanlineStride, int bitMasks[]) { + public SinglePixelPackedSampleModel(int dataType, int w, int h, int scanlineStride, + int bitMasks[]) { super(dataType, w, h, bitMasks.length); - if (dataType != DataBuffer.TYPE_BYTE && - dataType != DataBuffer.TYPE_USHORT && - dataType != DataBuffer.TYPE_INT) { + if (dataType != DataBuffer.TYPE_BYTE && dataType != DataBuffer.TYPE_USHORT + && dataType != DataBuffer.TYPE_INT) { // awt.61=Unsupported data type: {0} throw new IllegalArgumentException(Messages.getString("awt.61", //$NON-NLS-1$ dataType)); @@ -109,8 +129,7 @@ public class SinglePixelPackedSampleModel extends SampleModel { if (mask != 0) { // awt.62=Wrong mask : {0} - throw new IllegalArgumentException(Messages.getString( - "awt.62", bitMasks[i])); //$NON-NLS-1$ + throw new IllegalArgumentException(Messages.getString("awt.62", bitMasks[i])); //$NON-NLS-1$ } } @@ -132,39 +151,39 @@ public class SinglePixelPackedSampleModel extends SampleModel { throw new ArrayIndexOutOfBoundsException(Messages.getString("awt.63")); //$NON-NLS-1$ } switch (getTransferType()) { - case DataBuffer.TYPE_BYTE: - byte bdata[]; - if (obj == null) { - bdata = new byte[1]; - } else { - bdata = (byte[]) obj; - } + case DataBuffer.TYPE_BYTE: + byte bdata[]; + if (obj == null) { + bdata = new byte[1]; + } else { + bdata = (byte[])obj; + } - bdata[0] = (byte) data.getElem(y * scanlineStride + x); - obj = bdata; - break; - case DataBuffer.TYPE_USHORT: - short sdata[]; - if (obj == null) { - sdata = new short[1]; - } else { - sdata = (short[]) obj; - } + bdata[0] = (byte)data.getElem(y * scanlineStride + x); + obj = bdata; + break; + case DataBuffer.TYPE_USHORT: + short sdata[]; + if (obj == null) { + sdata = new short[1]; + } else { + sdata = (short[])obj; + } - sdata[0] = (short) data.getElem(y * scanlineStride + x); - obj = sdata; - break; - case DataBuffer.TYPE_INT: - int idata[]; - if (obj == null) { - idata = new int[1]; - } else { - idata = (int[]) obj; - } + sdata[0] = (short)data.getElem(y * scanlineStride + x); + obj = sdata; + break; + case DataBuffer.TYPE_INT: + int idata[]; + if (obj == null) { + idata = new int[1]; + } else { + idata = (int[])obj; + } - idata[0] = data.getElem(y * scanlineStride + x); - obj = idata; - break; + idata[0] = data.getElem(y * scanlineStride + x); + obj = idata; + break; } return obj; } @@ -176,26 +195,26 @@ public class SinglePixelPackedSampleModel extends SampleModel { throw new ArrayIndexOutOfBoundsException(Messages.getString("awt.63")); //$NON-NLS-1$ } switch (getTransferType()) { - case DataBuffer.TYPE_BYTE: - data.setElem(y * scanlineStride + x, ((byte[]) obj)[0] & 0xff); - break; - case DataBuffer.TYPE_USHORT: - data.setElem(y * scanlineStride + x, ((short[]) obj)[0] & 0xffff); - break; - case DataBuffer.TYPE_INT: - data.setElem(y * scanlineStride + x, ((int[]) obj)[0]); - break; + case DataBuffer.TYPE_BYTE: + data.setElem(y * scanlineStride + x, ((byte[])obj)[0] & 0xff); + break; + case DataBuffer.TYPE_USHORT: + data.setElem(y * scanlineStride + x, ((short[])obj)[0] & 0xffff); + break; + case DataBuffer.TYPE_INT: + data.setElem(y * scanlineStride + x, ((int[])obj)[0]); + break; } } /** - * Compares this SinglePixelPackedSampleModel object with - * the specified object. - * - * @param o the Object to be compared. + * Compares this SinglePixelPackedSampleModel object with the specified + * object. * - * @return true, if this SinglePixelPackedSampleModel object is - * equal to the specified object, false otherwise. + * @param o + * the Object to be compared. + * @return true, if this SinglePixelPackedSampleModel object is equal to the + * specified object, false otherwise. */ @Override public boolean equals(Object o) { @@ -203,21 +222,20 @@ public class SinglePixelPackedSampleModel extends SampleModel { return false; } - SinglePixelPackedSampleModel model = (SinglePixelPackedSampleModel) o; - return this.width == model.width && - this.height == model.height && - this.numBands == model.numBands && - this.dataType == model.dataType && - Arrays.equals(this.bitMasks, model.bitMasks) && - Arrays.equals(this.bitOffsets, model.bitOffsets) && - Arrays.equals(this.bitSizes, model.bitSizes) && - this.scanlineStride == model.scanlineStride; + SinglePixelPackedSampleModel model = (SinglePixelPackedSampleModel)o; + return this.width == model.width && this.height == model.height + && this.numBands == model.numBands && this.dataType == model.dataType + && Arrays.equals(this.bitMasks, model.bitMasks) + && Arrays.equals(this.bitOffsets, model.bitOffsets) + && Arrays.equals(this.bitSizes, model.bitSizes) + && this.scanlineStride == model.scanlineStride; } @Override public SampleModel createSubsetSampleModel(int bands[]) { if (bands.length > this.numBands) { - // awt.64=The number of the bands in the subset is greater than the number of bands in the sample model + // awt.64=The number of the bands in the subset is greater than the + // number of bands in the sample model throw new RasterFormatException(Messages.getString("awt.64")); //$NON-NLS-1$ } @@ -225,14 +243,13 @@ public class SinglePixelPackedSampleModel extends SampleModel { for (int i = 0; i < bands.length; i++) { masks[i] = this.bitMasks[bands[i]]; } - return new SinglePixelPackedSampleModel(this.dataType, this.width, - this.height, this.scanlineStride, masks); + return new SinglePixelPackedSampleModel(this.dataType, this.width, this.height, + this.scanlineStride, masks); } @Override public SampleModel createCompatibleSampleModel(int w, int h) { - return new SinglePixelPackedSampleModel(this.dataType, w, h, - this.bitMasks); + return new SinglePixelPackedSampleModel(this.dataType, w, h, this.bitMasks); } @Override @@ -277,10 +294,9 @@ public class SinglePixelPackedSampleModel extends SampleModel { } @Override - public int[] getPixels(int x, int y, int w, int h, int iArray[], - DataBuffer data) { - if ((x < 0) || (y < 0) || ((long) x + (long) w > this.width) - || ((long) y + (long) h > this.height)) { + public int[] getPixels(int x, int y, int w, int h, int iArray[], DataBuffer data) { + if ((x < 0) || (y < 0) || ((long)x + (long)w > this.width) + || ((long)y + (long)h > this.height)) { // awt.63=Coordinates are not in bounds throw new ArrayIndexOutOfBoundsException(Messages.getString("awt.63")); //$NON-NLS-1$ } @@ -306,13 +322,11 @@ public class SinglePixelPackedSampleModel extends SampleModel { } @Override - public void setPixels(int x, int y, int w, int h, int iArray[], - DataBuffer data) { - if ((x < 0) || (y < 0) || ((long) x + (long) w > this.width) - || ((long) y + (long) h > this.height)) { + public void setPixels(int x, int y, int w, int h, int iArray[], DataBuffer data) { + if ((x < 0) || (y < 0) || ((long)x + (long)w > this.width) + || ((long)y + (long)h > this.height)) { // awt.63=Coordinates are not in bounds - throw new ArrayIndexOutOfBoundsException(Messages - .getString("awt.63")); //$NON-NLS-1$ + throw new ArrayIndexOutOfBoundsException(Messages.getString("awt.63")); //$NON-NLS-1$ } int idx = 0; @@ -339,13 +353,11 @@ public class SinglePixelPackedSampleModel extends SampleModel { } @Override - public int[] getSamples(int x, int y, int w, int h, int b, int iArray[], - DataBuffer data) { - if ((x < 0) || (y < 0) || ((long) x + (long) w > this.width) - || ((long) y + (long) h > this.height)) { + public int[] getSamples(int x, int y, int w, int h, int b, int iArray[], DataBuffer data) { + if ((x < 0) || (y < 0) || ((long)x + (long)w > this.width) + || ((long)y + (long)h > this.height)) { // awt.63=Coordinates are not in bounds - throw new ArrayIndexOutOfBoundsException(Messages - .getString("awt.63")); //$NON-NLS-1$ + throw new ArrayIndexOutOfBoundsException(Messages.getString("awt.63")); //$NON-NLS-1$ } int samples[]; @@ -367,10 +379,9 @@ public class SinglePixelPackedSampleModel extends SampleModel { } @Override - public void setSamples(int x, int y, int w, int h, int b, int iArray[], - DataBuffer data) { - if ((x < 0) || (y < 0) || ((long) x + (long) w > this.width) - || ((long) y + (long) h > this.height)) { + public void setSamples(int x, int y, int w, int h, int b, int iArray[], DataBuffer data) { + if ((x < 0) || (y < 0) || ((long)x + (long)w > this.width) + || ((long)y + (long)h > this.height)) { // awt.63=Coordinates are not in bounds throw new ArrayIndexOutOfBoundsException(Messages.getString("awt.63")); //$NON-NLS-1$ } @@ -389,15 +400,15 @@ public class SinglePixelPackedSampleModel extends SampleModel { int size = (this.height - 1) * scanlineStride + width; switch (this.dataType) { - case DataBuffer.TYPE_BYTE: - data = new DataBufferByte(size); - break; - case DataBuffer.TYPE_USHORT: - data = new DataBufferUShort(size); - break; - case DataBuffer.TYPE_INT: - data = new DataBufferInt(size); - break; + case DataBuffer.TYPE_BYTE: + data = new DataBufferByte(size); + break; + case DataBuffer.TYPE_USHORT: + data = new DataBufferUShort(size); + break; + case DataBuffer.TYPE_INT: + data = new DataBufferInt(size); + break; } return data; } @@ -405,9 +416,10 @@ public class SinglePixelPackedSampleModel extends SampleModel { /** * Gets the offset of the specified pixel in the data array. * - * @param x the X coordinate of the specified pixel. - * @param y the Y coordinate of the specified pixel. - * + * @param x + * the X coordinate of the specified pixel. + * @param y + * the Y coordinate of the specified pixel. * @return the offset of the specified pixel. */ public int getOffset(int x, int y) { @@ -425,7 +437,7 @@ public class SinglePixelPackedSampleModel extends SampleModel { } /** - * Gets an array of the bit offsets of the data array elements. + * Gets an array of the bit offsets of the data array elements. * * @return an array of the bit offsets. */ @@ -505,4 +517,3 @@ public class SinglePixelPackedSampleModel extends SampleModel { } } - diff --git a/awt/java/awt/image/TileObserver.java b/awt/java/awt/image/TileObserver.java index 39ded02ef42aa..7dd97e29b5caf 100644 --- a/awt/java/awt/image/TileObserver.java +++ b/awt/java/awt/image/TileObserver.java @@ -18,27 +18,32 @@ * @author Igor V. Stolyarov * @version $Revision$ */ -package java.awt.image; +package java.awt.image; /** - * An asynchronous update interface for receiving notifications - * about tile information when tiles of a WritableRenderedImage - * become modifiable or unmodifiable. + * An asynchronous update interface for receiving notifications about tile + * information when tiles of a WritableRenderedImage become modifiable or + * unmodifiable. + * + * @since Android 1.0 */ public interface TileObserver { /** - * This method is called when information about a tile - * update is available. + * This method is called when information about a tile update is available. * - * @param source the source image. - * @param tileX the X index of the tile. - * @param tileY the Y index of the tile. - * @param willBeWritable parameter which indicates whether - * the tile will be grabbed for writing or be released. + * @param source + * the source image. + * @param tileX + * the X index of the tile. + * @param tileY + * the Y index of the tile. + * @param willBeWritable + * parameter which indicates whether the tile will be grabbed for + * writing or be released. */ - public void tileUpdate(WritableRenderedImage source, int tileX, int tileY, boolean willBeWritable); + public void tileUpdate(WritableRenderedImage source, int tileX, int tileY, + boolean willBeWritable); } - diff --git a/awt/java/awt/image/VolatileImage.java b/awt/java/awt/image/VolatileImage.java index 3b0cfb2d37f7f..f24e866bdb135 100644 --- a/awt/java/awt/image/VolatileImage.java +++ b/awt/java/awt/image/VolatileImage.java @@ -18,6 +18,7 @@ * @author Alexey A. Petrenko * @version $Revision$ */ + package java.awt.image; import java.awt.Graphics; @@ -28,35 +29,36 @@ import java.awt.ImageCapabilities; import java.awt.Transparency; /** - * The VolatileImage abstract class represents an image which can lose - * its contents at any point. VolatileImage objects are device specific. - * This class provies methods for checking if operation of this image - * are compatible for the GraphicsConfiguration. + * The VolatileImage abstract class represents an image which can lose its + * contents at any point. VolatileImage objects are device specific. This class + * provides methods for checking if operation of this image are compatible for + * the GraphicsConfiguration. + * + * @since Android 1.0 */ public abstract class VolatileImage extends Image - // Volatile image implements Transparency since 1.5 - implements Transparency { - - /** - * The Constant IMAGE_INCOMPATIBLE indicates that this VolatileImage - * is not applicable for the GraphicsConfiguration object. +// Volatile image implements Transparency since 1.5 + implements Transparency { + + /** + * The Constant IMAGE_INCOMPATIBLE indicates that this VolatileImage is not + * applicable for the GraphicsConfiguration object. */ public static final int IMAGE_INCOMPATIBLE = 2; - /** - * The Constant IMAGE_OK indicates that VolatileImage is ready - * for using. + /** + * The Constant IMAGE_OK indicates that VolatileImage is ready for using. */ public static final int IMAGE_OK = 0; - /** - * The Constant IMAGE_RESTORED indicates that VolatileImage - * will be ready to use after restoring. + /** + * The Constant IMAGE_RESTORED indicates that VolatileImage will be ready to + * use after restoring. */ public static final int IMAGE_RESTORED = 1; - /** - * The transparency value of this image. + /** + * The transparency value of this image. */ protected int transparency = OPAQUE; @@ -68,8 +70,8 @@ public abstract class VolatileImage extends Image } /** - * Returns true if rendering data is lost during validating. - * This method should be called after rendering operation of image. + * Returns true if rendering data is lost during validating. This method + * should be called after rendering operation of image. * * @return true, if contents lost during validating, false otherwise. */ @@ -98,8 +100,8 @@ public abstract class VolatileImage extends Image public abstract int getHeight(); /** - * Gets a BufferedImage representation of current VolatileImage that - * won't be affected by any changes to this VolatileImage. + * Gets a BufferedImage representation of current VolatileImage that won't + * be affected by any changes to this VolatileImage. * * @return a BufferedImage representation of current VolatileImage. */ @@ -113,14 +115,14 @@ public abstract class VolatileImage extends Image public abstract int getWidth(); /** - * Validates the drawing surface of the image if the surface had been - * lost and if the spacified GraphicsConfiguration object is - * applicable to this image. - * - * @param gc GraphicsConfiguration object. + * Validates the drawing surface of the image if the surface had been lost + * and if the specified GraphicsConfiguration object is applicable to this + * image. * + * @param gc + * the GraphicsConfiguration object. * @return one of the image status constants: IMAGE_OK, IMAGE_RESTORED or - * IMAGE_INCOMPATIBLE. + * IMAGE_INCOMPATIBLE. */ public abstract int validate(GraphicsConfiguration gc); diff --git a/awt/java/awt/image/WritableRaster.java b/awt/java/awt/image/WritableRaster.java index 0893915ea4258..51366ee64c13c 100644 --- a/awt/java/awt/image/WritableRaster.java +++ b/awt/java/awt/image/WritableRaster.java @@ -18,6 +18,7 @@ * @author Igor V. Stolyarov * @version $Revision$ */ + package java.awt.image; import java.awt.Point; @@ -26,114 +27,136 @@ import java.awt.Rectangle; import org.apache.harmony.awt.internal.nls.Messages; /** - * The WritableRaster class provides functionality for - * writing samples and pixel capabilities to the Raster. + * The WritableRaster class provides functionality for writing samples and pixel + * capabilities to the Raster. + * + * @since Android 1.0 */ public class WritableRaster extends Raster { /** - * Instantiates a new WritableRaster object with the specified - * SampleModel, DataBuffer, rectangular region and parent - * WritableRaster. + * Instantiates a new WritableRaster object with the specified SampleModel, + * DataBuffer, rectangular region and parent WritableRaster. * - * @param sampleModel the specified SampleModel. - * @param dataBuffer the specified DataBuffer. - * @param aRegion the rectangular region which defines the new image bounds. - * @param sampleModelTranslate this point defines the translation point - * from the SampleModel to the new WritableRaster coordinates. - * @param parent the parent of this WritableRaster. + * @param sampleModel + * the specified SampleModel. + * @param dataBuffer + * the specified DataBuffer. + * @param aRegion + * the rectangular region which defines the new image bounds. + * @param sampleModelTranslate + * this point defines the translation point from the SampleModel + * to the new WritableRaster coordinates. + * @param parent + * the parent of this WritableRaster. */ - protected WritableRaster(SampleModel sampleModel, DataBuffer dataBuffer, - Rectangle aRegion, Point sampleModelTranslate, - WritableRaster parent) { + protected WritableRaster(SampleModel sampleModel, DataBuffer dataBuffer, Rectangle aRegion, + Point sampleModelTranslate, WritableRaster parent) { super(sampleModel, dataBuffer, aRegion, sampleModelTranslate, parent); } /** - * Instantiates a new WritableRaster object with the specified - * SampleModel which defines a layout of this WritableRaster and - * DataBuffer objects which defines the image data. + * Instantiates a new WritableRaster object with the specified SampleModel + * which defines a layout of this WritableRaster and DataBuffer objects + * which defines the image data. * - * @param sampleModel the specified SampleModel. - * @param dataBuffer the specified DataBuffer. - * @param origin the point of origin. + * @param sampleModel + * the specified SampleModel. + * @param dataBuffer + * the specified DataBuffer. + * @param origin + * the point of origin. */ - protected WritableRaster(SampleModel sampleModel, DataBuffer dataBuffer, - Point origin) { - this(sampleModel, dataBuffer, new Rectangle(origin.x, origin.y, - sampleModel.width, sampleModel.height), origin, null); + protected WritableRaster(SampleModel sampleModel, DataBuffer dataBuffer, Point origin) { + this(sampleModel, dataBuffer, new Rectangle(origin.x, origin.y, sampleModel.width, + sampleModel.height), origin, null); } /** * Instantiates a new WritableRaster with the specified SampleModel. * - * @param sampleModel the specified SampleModel. - * @param origin the origin. + * @param sampleModel + * the specified SampleModel. + * @param origin + * the origin. */ protected WritableRaster(SampleModel sampleModel, Point origin) { - this(sampleModel, sampleModel.createDataBuffer(), new Rectangle( - origin.x, origin.y, sampleModel.width, sampleModel.height), - origin, null); + this(sampleModel, sampleModel.createDataBuffer(), new Rectangle(origin.x, origin.y, + sampleModel.width, sampleModel.height), origin, null); } /** - * Sets the data for a single pixel from an input Object which - * represents an array of primitive types: DataBuffer.TYPE_BYTE, - * DataBuffer.TYPE_USHORT, DataBuffer.TYPE_INT, DataBuffer.TYPE_SHORT, - * DataBuffer.TYPE_FLOAT, or DataBuffer.TYPE_DOUBLE. + * Sets the data for a single pixel from an input Object which represents an + * array of primitive types: DataBuffer.TYPE_BYTE, DataBuffer.TYPE_USHORT, + * DataBuffer.TYPE_INT, DataBuffer.TYPE_SHORT, DataBuffer.TYPE_FLOAT, or + * DataBuffer.TYPE_DOUBLE. * - * @param x the X coordinate of the pixel. - * @param y the Y coordinate of the pixel. - * @param inData the input data. + * @param x + * the X coordinate of the pixel. + * @param y + * the Y coordinate of the pixel. + * @param inData + * the input data. */ public void setDataElements(int x, int y, Object inData) { - sampleModel.setDataElements(x - sampleModelTranslateX, - y - sampleModelTranslateY, inData, dataBuffer); + sampleModel.setDataElements(x - sampleModelTranslateX, y - sampleModelTranslateY, inData, + dataBuffer); } /** - * Sets the data elements which represent pixel data to the specified - * rectangle area as a primitive array. The following image data types - * are supported: DataBuffer.TYPE_BYTE, DataBuffer.TYPE_USHORT, - * DataBuffer.TYPE_INT, DataBuffer.TYPE_SHORT, DataBuffer.TYPE_FLOAT, - * or DataBuffer.TYPE_DOUBLE. + * Sets the data elements which represent pixel data to the specified + * rectangle area as a primitive array. The following image data types are + * supported: DataBuffer.TYPE_BYTE, DataBuffer.TYPE_USHORT, + * DataBuffer.TYPE_INT, DataBuffer.TYPE_SHORT, DataBuffer.TYPE_FLOAT, or + * DataBuffer.TYPE_DOUBLE. * - * @param x the X coordinate of the rectangle of pixels. - * @param y the Y coordinate of the rectangle of pixels. - * @param w the width of the rectangle of pixels. - * @param h the height of the rectangle of pixels. - * @param inData the array of primitive type data to be set to the - * specified area. + * @param x + * the X coordinate of the rectangle of pixels. + * @param y + * the Y coordinate of the rectangle of pixels. + * @param w + * the width of the rectangle of pixels. + * @param h + * the height of the rectangle of pixels. + * @param inData + * the array of primitive type data to be set to the specified + * area. */ public void setDataElements(int x, int y, int w, int h, Object inData) { - sampleModel.setDataElements(x - sampleModelTranslateX, - y - sampleModelTranslateY, w, h, inData, dataBuffer); + sampleModel.setDataElements(x - sampleModelTranslateX, y - sampleModelTranslateY, w, h, + inData, dataBuffer); } /** - * Creates the child of this WritableRaster by sharing the specified - * rectangular area in this WritableRaster. - * The parentX, parentY, width and height parameters specify rectangular - * area to be shared. - * - * @param parentX the X coordinate of the upper left corner of - * the shared rectangle with respect to this WritableRaster' coordinates. - * @param parentY the Y coordinate of the upper left corner of - * the shared rectangle with respect to this WritableRaster' coordinates. - * @param w the width of the child area. - * @param h the height of the child area. - * @param childMinX the X coordinate of child area mapped to the parentX - * coordinate. - * @param childMinY the Y coordinate of child area mapped to the parentY - * coordinate. - * @param bandList the array of band indicies. + * Creates the child of this WritableRaster by sharing the specified + * rectangular area in this WritableRaster. The parentX, parentY, width and + * height parameters specify rectangular area to be shared. * + * @param parentX + * the X coordinate of the upper left corner of the shared + * rectangle with respect to this WritableRaster' coordinates. + * @param parentY + * the Y coordinate of the upper left corner of the shared + * rectangle with respect to this WritableRaster' coordinates. + * @param w + * the width of the child area. + * @param h + * the height of the child area. + * @param childMinX + * the X coordinate of child area mapped to the parentX + * coordinate. + * @param childMinY + * the Y coordinate of child area mapped to the parentY + * coordinate. + * @param bandList + * the array of band indices. * @return the child WritableRaster. */ - public WritableRaster createWritableChild(int parentX, int parentY, int w, - int h, int childMinX, int childMinY, int bandList[]) { + public WritableRaster createWritableChild(int parentX, int parentY, int w, int h, + int childMinX, int childMinY, int bandList[]) { if (w <= 0 || h <= 0) { - // awt.244=Width or Height of child Raster is less than or equal to zero + // awt.244=Width or Height of child Raster is less than or equal to + // zero throw new RasterFormatException(Messages.getString("awt.244")); //$NON-NLS-1$ } @@ -147,22 +170,22 @@ public class WritableRaster extends Raster { throw new RasterFormatException(Messages.getString("awt.246")); //$NON-NLS-1$ } - if ((long) parentX + w > Integer.MAX_VALUE) { + if ((long)parentX + w > Integer.MAX_VALUE) { // awt.247=parentX + w results in integer overflow throw new RasterFormatException(Messages.getString("awt.247")); //$NON-NLS-1$ } - if ((long) parentY + h > Integer.MAX_VALUE) { + if ((long)parentY + h > Integer.MAX_VALUE) { // awt.248=parentY + h results in integer overflow throw new RasterFormatException(Messages.getString("awt.248")); //$NON-NLS-1$ } - if ((long) childMinX + w > Integer.MAX_VALUE) { + if ((long)childMinX + w > Integer.MAX_VALUE) { // awt.249=childMinX + w results in integer overflow throw new RasterFormatException(Messages.getString("awt.249")); //$NON-NLS-1$ } - if ((long) childMinY + h > Integer.MAX_VALUE) { + if ((long)childMinY + h > Integer.MAX_VALUE) { // awt.24A=childMinY + h results in integer overflow throw new RasterFormatException(Messages.getString("awt.24A")); //$NON-NLS-1$ } @@ -179,59 +202,60 @@ public class WritableRaster extends Raster { int childTranslateY = childMinY - parentY; return new WritableRaster(childModel, dataBuffer, - new Rectangle(childMinX, childMinY, w, h), - new Point(childTranslateX + sampleModelTranslateX, - childTranslateY + sampleModelTranslateY), - this); + new Rectangle(childMinX, childMinY, w, h), new Point(childTranslateX + + sampleModelTranslateX, childTranslateY + sampleModelTranslateY), this); } /** - * Creates the translated child of this WritableRaster. - * New WritableRaster object is a reference to the this - * WritableRaster and with different location. - * - * @param childMinX the X coordinate of the new WritableRaster. - * @param childMinY the Y coordinate of the new WritableRaster. + * Creates the translated child of this WritableRaster. New WritableRaster + * object is a reference to the this WritableRaster and with different + * location. * + * @param childMinX + * the X coordinate of the new WritableRaster. + * @param childMinY + * the Y coordinate of the new WritableRaster. * @return the WritableRaster. */ - public WritableRaster createWritableTranslatedChild(int childMinX, - int childMinY) { - return createWritableChild(minX, minY, width, height, childMinX, - childMinY, null); + public WritableRaster createWritableTranslatedChild(int childMinX, int childMinY) { + return createWritableChild(minX, minY, width, height, childMinX, childMinY, null); } /** - * Gets the parent WritableRaster for this WritableRaster object. + * Gets the parent WritableRaster for this WritableRaster object. * * @return the parent WritableRaster for this WritableRaster object. */ public WritableRaster getWritableParent() { - return (WritableRaster) parent; + return (WritableRaster)parent; } /** - * Sets pixels from the specified source Raster srcRaster to this + * Sets pixels from the specified source Raster srcRaster to this * WritableRaster. * - * @param srcRaster the source Raster. + * @param srcRaster + * the source Raster. */ public void setRect(Raster srcRaster) { setRect(0, 0, srcRaster); } /** - * Sets pixels from the specified source Raster srcRaster to this - * WritableRaster. Each pixel with (x, y) coordinates from the source - * Raster is copied to pixel with (x+dx, y+dy) coordinates in this - * WritableRaster. The pixels with (x+dx, y+dy) coordinates which - * are out the bounds of this raster are ignored. - * - * @param dx the distance the pixel's X coordinate in the source - * Raster is translated when writtien to this WritableRaster. - * @param dy the distance the pixel's Y coordinate in the source - * Raster is translated when writtien to this WritableRaster. - * @param srcRaster the source Raster. + * Sets pixels from the specified source Raster srcRaster to this + * WritableRaster. Each pixel with (x, y) coordinates from the source Raster + * is copied to pixel with (x+dx, y+dy) coordinates in this WritableRaster. + * The pixels with (x+dx, y+dy) coordinates which are out the bounds of this + * raster are ignored. + * + * @param dx + * the distance the pixel's X coordinate in the source Raster is + * translated when writtien to this WritableRaster. + * @param dy + * the distance the pixel's Y coordinate in the source Raster is + * translated when writtien to this WritableRaster. + * @param srcRaster + * the source Raster. */ public void setRect(int dx, int dy, Raster srcRaster) { int w = srcRaster.getWidth(); @@ -272,47 +296,47 @@ public class WritableRaster extends Raster { } switch (sampleModel.getDataType()) { - case DataBuffer.TYPE_BYTE: - case DataBuffer.TYPE_SHORT: - case DataBuffer.TYPE_USHORT: - case DataBuffer.TYPE_INT: - int iPixelsLine[] = null; - for (int i = 0; i < h; i++) { - iPixelsLine = srcRaster.getPixels(srcX, srcY + i, w, 1, - iPixelsLine); - setPixels(dstX, dstY + i, w, 1, iPixelsLine); - } - break; - - case DataBuffer.TYPE_FLOAT: - float fPixelsLine[] = null; - for (int i = 0; i < h; i++) { - fPixelsLine = srcRaster.getPixels(srcX, srcY + i, w, 1, - fPixelsLine); - setPixels(dstX, dstY + i, w, 1, fPixelsLine); - } - break; - - case DataBuffer.TYPE_DOUBLE: - double dPixelsLine[] = null; - for (int i = 0; i < h; i++) { - dPixelsLine = srcRaster.getPixels(srcX, srcY + i, w, 1, - dPixelsLine); - setPixels(dstX, dstY + i, w, 1, dPixelsLine); - } - break; + case DataBuffer.TYPE_BYTE: + case DataBuffer.TYPE_SHORT: + case DataBuffer.TYPE_USHORT: + case DataBuffer.TYPE_INT: + int iPixelsLine[] = null; + for (int i = 0; i < h; i++) { + iPixelsLine = srcRaster.getPixels(srcX, srcY + i, w, 1, iPixelsLine); + setPixels(dstX, dstY + i, w, 1, iPixelsLine); + } + break; + + case DataBuffer.TYPE_FLOAT: + float fPixelsLine[] = null; + for (int i = 0; i < h; i++) { + fPixelsLine = srcRaster.getPixels(srcX, srcY + i, w, 1, fPixelsLine); + setPixels(dstX, dstY + i, w, 1, fPixelsLine); + } + break; + + case DataBuffer.TYPE_DOUBLE: + double dPixelsLine[] = null; + for (int i = 0; i < h; i++) { + dPixelsLine = srcRaster.getPixels(srcX, srcY + i, w, 1, dPixelsLine); + setPixels(dstX, dstY + i, w, 1, dPixelsLine); + } + break; } } /** - * Sets the data for a rectangle of pixels from an input Raster to - * this WritableRaster. + * Sets the data for a rectangle of pixels from an input Raster to this + * WritableRaster. * - * @param x the X coordinate of the point where the data of - * the input Raster is to be written. - * @param y the Y coordinate of the point where the data of - * the input Raster is to be written. - * @param inRaster the input Raster. + * @param x + * the X coordinate of the point where the data of the input + * Raster is to be written. + * @param y + * the Y coordinate of the point where the data of the input + * Raster is to be written. + * @param inRaster + * the input Raster. */ public void setDataElements(int x, int y, Raster inRaster) { int dstX = x + inRaster.getMinX(); @@ -321,8 +345,8 @@ public class WritableRaster extends Raster { int w = inRaster.getWidth(); int h = inRaster.getHeight(); - if (dstX < this.minX || dstX + w > this.minX + this.width || - dstY < this.minY || dstY + h > this.minY + this.height) { + if (dstX < this.minX || dstX + w > this.minX + this.width || dstY < this.minY + || dstY + h > this.minY + this.height) { // awt.63=Coordinates are not in bounds throw new ArrayIndexOutOfBoundsException(Messages.getString("awt.63")); //$NON-NLS-1$ } @@ -338,179 +362,231 @@ public class WritableRaster extends Raster { } /** - * Sets a int array of samples for the specified pixel - * in this WritableRaster. + * Sets an integer array of samples for the specified pixel in this + * WritableRaster. * - * @param x the pixel's X coordinate. - * @param y the pixel's Y coordinate. - * @param iArray the int array of samples. + * @param x + * the pixel's X coordinate. + * @param y + * the pixel's Y coordinate. + * @param iArray + * the integer array of samples. */ public void setPixel(int x, int y, int iArray[]) { - sampleModel.setPixel(x - sampleModelTranslateX, - y - sampleModelTranslateY, iArray, dataBuffer); + sampleModel.setPixel(x - sampleModelTranslateX, y - sampleModelTranslateY, iArray, + dataBuffer); } /** - * Sets a float array of samples for the specified pixel - * in this WritableRaster. + * Sets a float array of samples for the specified pixel in this + * WritableRaster. * - * @param x the pixel's X coordinate. - * @param y the pixel's Y coordinate. - * @param fArray the float array of samples. + * @param x + * the pixel's X coordinate. + * @param y + * the pixel's Y coordinate. + * @param fArray + * the float array of samples. */ public void setPixel(int x, int y, float fArray[]) { - sampleModel.setPixel(x - sampleModelTranslateX, - y - sampleModelTranslateY, fArray, dataBuffer); + sampleModel.setPixel(x - sampleModelTranslateX, y - sampleModelTranslateY, fArray, + dataBuffer); } /** - * Sets a double array of samples for the specified pixel - * in this WritableRaster. + * Sets a double array of samples for the specified pixel in this + * WritableRaster. * - * @param x the pixel's X coordinate. - * @param y the pixel's Y coordinate. - * @param dArray the double array of samples. + * @param x + * the pixel's X coordinate. + * @param y + * the pixel's Y coordinate. + * @param dArray + * the double array of samples. */ public void setPixel(int x, int y, double dArray[]) { - sampleModel.setPixel(x - sampleModelTranslateX, - y - sampleModelTranslateY, dArray, dataBuffer); + sampleModel.setPixel(x - sampleModelTranslateX, y - sampleModelTranslateY, dArray, + dataBuffer); } /** - * Sets a int array of samples for the specified rectangular area - * of pixels in this WritableRaster. + * Sets a integer array of samples for the specified rectangular area of + * pixels in this WritableRaster. * - * @param x the X coordinate of rectangular area. - * @param y the Y coordinate of rectangular area. - * @param w the width of rectangular area. - * @param h the height of rectangular area. - * @param iArray the int array of samples. + * @param x + * the X coordinate of rectangular area. + * @param y + * the Y coordinate of rectangular area. + * @param w + * the width of rectangular area. + * @param h + * the height of rectangular area. + * @param iArray + * the integer array of samples. */ public void setPixels(int x, int y, int w, int h, int iArray[]) { - sampleModel.setPixels(x - sampleModelTranslateX, - y - sampleModelTranslateY, w, h, iArray, dataBuffer); + sampleModel.setPixels(x - sampleModelTranslateX, y - sampleModelTranslateY, w, h, iArray, + dataBuffer); } /** - * Sets a float array of samples for the specified rectangular area - * of pixels in this WritableRaster. + * Sets a float array of samples for the specified rectangular area of + * pixels in this WritableRaster. * - * @param x the X coordinate of rectangular area. - * @param y the Y coordinate of rectangular area. - * @param w the width of rectangular area. - * @param h the height of rectangular area. - * @param fArray the float array of samples. + * @param x + * the X coordinate of rectangular area. + * @param y + * the Y coordinate of rectangular area. + * @param w + * the width of rectangular area. + * @param h + * the height of rectangular area. + * @param fArray + * the float array of samples. */ public void setPixels(int x, int y, int w, int h, float fArray[]) { - sampleModel.setPixels(x - sampleModelTranslateX, - y - sampleModelTranslateY, w, h, fArray, dataBuffer); + sampleModel.setPixels(x - sampleModelTranslateX, y - sampleModelTranslateY, w, h, fArray, + dataBuffer); } /** - * Sets a double array of samples for the specified rectangular area - * of pixels in this WritableRaster. + * Sets a double array of samples for the specified rectangular area of + * pixels in this WritableRaster. * - * @param x the X coordinate of rectangular area. - * @param y the Y coordinate of rectangular area. - * @param w the width of rectangular area. - * @param h the height of rectangular area. - * @param dArray the double array of samples. + * @param x + * the X coordinate of rectangular area. + * @param y + * the Y coordinate of rectangular area. + * @param w + * the width of rectangular area. + * @param h + * the height of rectangular area. + * @param dArray + * the double array of samples. */ public void setPixels(int x, int y, int w, int h, double dArray[]) { - sampleModel.setPixels(x - sampleModelTranslateX, - y - sampleModelTranslateY, w, h, dArray, dataBuffer); + sampleModel.setPixels(x - sampleModelTranslateX, y - sampleModelTranslateY, w, h, dArray, + dataBuffer); } /** - * Sets the samples for the specified band and the specified - * rectangular area of pixels with an int array of samples. + * Sets the samples for the specified band and the specified rectangular + * area of pixels with an integer array of samples. * - * @param x the X coordinate of the area of pixels. - * @param y the Y coordinate of the area of pixels. - * @param w the width of the area of pixels. - * @param h the height of the area of pixels. - * @param b the specified band. - * @param iArray the int array of samples. - + * @param x + * the X coordinate of the area of pixels. + * @param y + * the Y coordinate of the area of pixels. + * @param w + * the width of the area of pixels. + * @param h + * the height of the area of pixels. + * @param b + * the specified band. + * @param iArray + * the integer array of samples. */ public void setSamples(int x, int y, int w, int h, int b, int iArray[]) { - sampleModel.setSamples(x - sampleModelTranslateX, - y - sampleModelTranslateY, w, h, b, iArray, dataBuffer); + sampleModel.setSamples(x - sampleModelTranslateX, y - sampleModelTranslateY, w, h, b, + iArray, dataBuffer); } /** - * Sets the samples for the specified band and the specified - * rectangular area of pixels with a float array of samples. + * Sets the samples for the specified band and the specified rectangular + * area of pixels with a float array of samples. * - * @param x the X coordinate of the area of pixels. - * @param y the Y coordinate of the area of pixels. - * @param w the width of the area of pixels. - * @param h the height of the area of pixels. - * @param b the specified band. - * @param fArray the float array of samples. + * @param x + * the X coordinate of the area of pixels. + * @param y + * the Y coordinate of the area of pixels. + * @param w + * the width of the area of pixels. + * @param h + * the height of the area of pixels. + * @param b + * the specified band. + * @param fArray + * the float array of samples. */ public void setSamples(int x, int y, int w, int h, int b, float fArray[]) { - sampleModel.setSamples(x - sampleModelTranslateX, - y - sampleModelTranslateY, w, h, b, fArray, dataBuffer); + sampleModel.setSamples(x - sampleModelTranslateX, y - sampleModelTranslateY, w, h, b, + fArray, dataBuffer); } /** - * Sets the samples for the specified band and the specified - * rectangular area of pixels with a double array of samples. + * Sets the samples for the specified band and the specified rectangular + * area of pixels with a double array of samples. * - * @param x the X coordinate of the area of pixels. - * @param y the Y coordinate of the area of pixels. - * @param w the width of the area of pixels. - * @param h the height of the area of pixels. - * @param b the specified band. - * @param dArray the double array of samples. + * @param x + * the X coordinate of the area of pixels. + * @param y + * the Y coordinate of the area of pixels. + * @param w + * the width of the area of pixels. + * @param h + * the height of the area of pixels. + * @param b + * the specified band. + * @param dArray + * the double array of samples. */ public void setSamples(int x, int y, int w, int h, int b, double dArray[]) { - sampleModel.setSamples(x - sampleModelTranslateX, - y - sampleModelTranslateY, w, h, b, dArray, dataBuffer); + sampleModel.setSamples(x - sampleModelTranslateX, y - sampleModelTranslateY, w, h, b, + dArray, dataBuffer); } /** - * Sets the sample for the specified band and the specified - * pixel with an int sample. + * Sets the sample for the specified band and the specified pixel with an + * integer sample. * - * @param x the X coordinate of the pixel. - * @param y the Y coordinate of the pixel. - * @param b the specified band. - * @param s the sample to be set. + * @param x + * the X coordinate of the pixel. + * @param y + * the Y coordinate of the pixel. + * @param b + * the specified band. + * @param s + * the sample to be set. */ public void setSample(int x, int y, int b, int s) { - sampleModel.setSample(x - sampleModelTranslateX, - y - sampleModelTranslateY, b, s, dataBuffer); + sampleModel.setSample(x - sampleModelTranslateX, y - sampleModelTranslateY, b, s, + dataBuffer); } /** - * Sets the sample for the specified band and the specified - * pixel with a float sample. + * Sets the sample for the specified band and the specified pixel with a + * float sample. * - * @param x the X coordinate of the pixel. - * @param y the Y coordinate of the pixel. - * @param b the specified band. - * @param s the sample to be set. + * @param x + * the X coordinate of the pixel. + * @param y + * the Y coordinate of the pixel. + * @param b + * the specified band. + * @param s + * the sample to be set. */ public void setSample(int x, int y, int b, float s) { - sampleModel.setSample(x - sampleModelTranslateX, - y - sampleModelTranslateY, b, s, dataBuffer); + sampleModel.setSample(x - sampleModelTranslateX, y - sampleModelTranslateY, b, s, + dataBuffer); } /** - * Sets the sample for the specified band and the specified - * pixel with a int sample. + * Sets the sample for the specified band and the specified pixel with an + * integer sample. * - * @param x the X coordinate of the pixel. - * @param y the Y coordinate of the pixel. - * @param b the specified band. - * @param s the sample to be set. + * @param x + * the X coordinate of the pixel. + * @param y + * the Y coordinate of the pixel. + * @param b + * the specified band. + * @param s + * the sample to be set. */ public void setSample(int x, int y, int b, double s) { - sampleModel.setSample(x - sampleModelTranslateX, - y - sampleModelTranslateY, b, s, dataBuffer); + sampleModel.setSample(x - sampleModelTranslateX, y - sampleModelTranslateY, b, s, + dataBuffer); } } - diff --git a/awt/java/awt/image/WritableRenderedImage.java b/awt/java/awt/image/WritableRenderedImage.java index ee1cb9e25a1ee..052353b60ff3b 100644 --- a/awt/java/awt/image/WritableRenderedImage.java +++ b/awt/java/awt/image/WritableRenderedImage.java @@ -18,23 +18,27 @@ * @author Igor V. Stolyarov * @version $Revision$ */ + package java.awt.image; import java.awt.Point; /** - * The WriteableRenderedImage interface is interface for objects which - * contains Raster data of one or several tiles. This interface provides - * notification mehanism for obtaining tile's writing status. + * The WriteableRenderedImage interface is interface for objects which contains + * Raster data of one or several tiles. This interface provides notification + * mechanism for obtaining tile's writing status. + * + * @since Android 1.0 */ public interface WritableRenderedImage extends RenderedImage { /** - * Gets and checks out the writable tile for writing. - * - * @param tileX the X index of the tile. - * @param tileY the Y index of the tile. + * Gets and checks out the writable tile for writing. * + * @param tileX + * the X index of the tile. + * @param tileY + * the Y index of the tile. * @return the WritableRaster. */ public WritableRaster getWritableTile(int tileX, int tileY); @@ -42,60 +46,64 @@ public interface WritableRenderedImage extends RenderedImage { /** * Removes the registered TileObserver. * - * @param to the TileObserver which is registered for this - * WritableRenderedImage. + * @param to + * the TileObserver which is registered for this + * WritableRenderedImage. */ public void removeTileObserver(TileObserver to); /** * Adds the specified TileObserver to this WritableRenderedImage. * - * @param to the TileObserver object to be added. + * @param to + * the TileObserver object to be added. */ public void addTileObserver(TileObserver to); /** - * Sets this image to the contents of the specified Raster. + * Sets this image to the contents of the specified Raster. * - * @param r the specified Raster. + * @param r + * the specified Raster. */ public void setData(Raster r); /** - * Gets the array of points wich represent indices of tiles which - * are check out for writing. + * Gets the array of points which represent indices of tiles which are check + * out for writing. * - * @return the array of Points. + * @return the array of points. */ public Point[] getWritableTileIndices(); /** * Checks if the specified tile is writable or not. * - * @param tileX the X index of tile. - * @param tileY the Y index of tile. - * - * @return true, if the specified tile is writable, - * false otherwise. + * @param tileX + * the X index of tile. + * @param tileY + * the Y index of tile. + * @return true, if the specified tile is writable, false otherwise. */ public boolean isTileWritable(int tileX, int tileY); /** - * Release the specified writable tile. This method removes the writer - * from the tile. + * Release the specified writable tile. This method removes the writer from + * the tile. * - * @param tileX the X index of the tile. - * @param tileY the Y index of the tile. + * @param tileX + * the X index of the tile. + * @param tileY + * the Y index of the tile. */ public void releaseWritableTile(int tileX, int tileY); /** * Checks if there is a tile which is checked out for writing. * - * @return true, if any tile is checked out for writing, false if there - * is no such tile. + * @return true, if any tile is checked out for writing, false if there is + * no such tile. */ public boolean hasTileWriters(); } - diff --git a/awt/java/awt/image/package.html b/awt/java/awt/image/package.html new file mode 100644 index 0000000000000..b4d6ef0a8d087 --- /dev/null +++ b/awt/java/awt/image/package.html @@ -0,0 +1,8 @@ + + +

    + This package contains classes and interfaces that allow to modify existing images or to create a new image rather than loading it from a file. +

    + @since Android 1.0 + + diff --git a/awt/java/awt/image/renderable/ContextualRenderedImageFactory.java b/awt/java/awt/image/renderable/ContextualRenderedImageFactory.java index 3e966379e2ca1..1881a0c276f58 100644 --- a/awt/java/awt/image/renderable/ContextualRenderedImageFactory.java +++ b/awt/java/awt/image/renderable/ContextualRenderedImageFactory.java @@ -18,72 +18,80 @@ * @author Igor V. Stolyarov * @version $Revision$ */ + package java.awt.image.renderable; import java.awt.geom.Rectangle2D; import java.awt.image.RenderedImage; /** - * A factory for creating ContextualRenderedImage objects with utilities - * for manipulating the properties in the parameter block. + * A factory for creating ContextualRenderedImage objects with utilities for + * manipulating the properties in the parameter block. + * + * @since Android 1.0 */ public interface ContextualRenderedImageFactory extends RenderedImageFactory { /** * Maps a render context to a parameter block and a renderable image. * - * @param a0 the index - * @param a1 the RenderContext - * @param a2 the ParameterBlock - * @param a3 the RenderableImage - * - * @return the render context + * @param a0 + * the index. + * @param a1 + * the RenderContext. + * @param a2 + * the ParameterBlock. + * @param a3 + * the RenderableImage. + * @return the render context. */ - public RenderContext mapRenderContext(int a0, RenderContext a1, ParameterBlock a2, RenderableImage a3); + public RenderContext mapRenderContext(int a0, RenderContext a1, ParameterBlock a2, + RenderableImage a3); /** * Gets the value of the property from the parameter block. * - * @param a0 the parameter block to examine to find the property - * @param a1 the name of the property - * - * @return the value of the property + * @param a0 + * the parameter block to examine to find the property. + * @param a1 + * the name of the property. + * @return the value of the property. */ public Object getProperty(ParameterBlock a0, String a1); /** - * Creates the rendered image determined by the render context and - * parameter block. + * Creates the rendered image determined by the render context and parameter + * block. * - * @param a0 the RenderContext - * @param a1 the ParameterBlock - * - * @return the rendered image + * @param a0 + * the RenderContext. + * @param a1 + * the ParameterBlock. + * @return the rendered image. */ public RenderedImage create(RenderContext a0, ParameterBlock a1); /** * Gets the bounding rectangle from the parameter block. * - * @param a0 the parameter block to read the bounds from - * - * @return the bounding rectangle + * @param a0 + * the parameter block to read the bounds from. + * @return the bounding rectangle. */ public Rectangle2D getBounds2D(ParameterBlock a0); /** * Gets the names of all of the supported properties. * - * @return the property names + * @return the property names. */ public String[] getPropertyNames(); /** * Checks if this image factory is dynamic. * - * @return true, if this image factory is dynamic + * @return true, if this image factory is dynamic. */ public boolean isDynamic(); } - diff --git a/awt/java/awt/image/renderable/ParameterBlock.java b/awt/java/awt/image/renderable/ParameterBlock.java index 1555f45b7831a..7dde73a945b68 100644 --- a/awt/java/awt/image/renderable/ParameterBlock.java +++ b/awt/java/awt/image/renderable/ParameterBlock.java @@ -18,6 +18,7 @@ * @author Igor V. Stolyarov * @version $Revision$ */ + package java.awt.image.renderable; import java.awt.image.RenderedImage; @@ -25,28 +26,36 @@ import java.io.Serializable; import java.util.Vector; /** - * The Class ParameterBlock groups an indexed set of parameter data - * with a set of renderable (source) images. The mapping between - * the indexed parameters and their property names is provided - * by a {@link ContextualRenderedImageFactory} + * The class ParameterBlock groups an indexed set of parameter data with a set + * of renderable (source) images. The mapping between the indexed parameters and + * their property names is provided by a {@link ContextualRenderedImageFactory}. + * + * @since Android 1.0 */ public class ParameterBlock implements Cloneable, Serializable { - - /** The Constant serialVersionUID. */ + /** + * The Constant serialVersionUID. + */ private static final long serialVersionUID = -7577115551785240750L; - /** The sources (renderable images). */ + /** + * The sources (renderable images). + */ protected Vector sources = new Vector(); - /** The parameters. */ + /** + * The parameters. + */ protected Vector parameters = new Vector(); /** * Instantiates a new parameter block. * - * @param sources the vector of source images - * @param parameters the vector of parameters + * @param sources + * the vector of source images. + * @param parameters + * the vector of parameters. */ public ParameterBlock(Vector sources, Vector parameters) { setSources(sources); @@ -56,7 +65,8 @@ public class ParameterBlock implements Cloneable, Serializable { /** * Instantiates a new parameter block with no parameters. * - * @param sources the vector of source images + * @param sources + * the vector of source images. */ public ParameterBlock(Vector sources) { setSources(sources); @@ -65,18 +75,20 @@ public class ParameterBlock implements Cloneable, Serializable { /** * Instantiates a new parameter block with no image or parameter vectors. */ - public ParameterBlock() {} + public ParameterBlock() { + } /** * Sets the source image at the specified index. * - * @param source the source image - * @param index the index where the source will be placed - * - * @return this parameter block + * @param source + * the source image. + * @param index + * the index where the source will be placed. + * @return this parameter block. */ public ParameterBlock setSource(Object source, int index) { - if(sources.size() < index + 1){ + if (sources.size() < index + 1) { sources.setSize(index + 1); } sources.setElementAt(source, index); @@ -86,14 +98,15 @@ public class ParameterBlock implements Cloneable, Serializable { /** * Sets the parameter value object at the specified index. * - * @param obj the parameter value to place at the desired index - * @param index the index where the object is to be placed in the - * vector of parameters - * - * @return this parameter block + * @param obj + * the parameter value to place at the desired index. + * @param index + * the index where the object is to be placed in the vector of + * parameters. + * @return this parameter block. */ public ParameterBlock set(Object obj, int index) { - if(parameters.size() < index + 1){ + if (parameters.size() < index + 1) { parameters.setSize(index + 1); } parameters.setElementAt(obj, index); @@ -103,9 +116,9 @@ public class ParameterBlock implements Cloneable, Serializable { /** * Adds a source to the vector of sources. * - * @param source the source to add - * - * @return this parameter block + * @param source + * the source to add. + * @return this parameter block. */ public ParameterBlock addSource(Object source) { sources.addElement(source); @@ -115,9 +128,9 @@ public class ParameterBlock implements Cloneable, Serializable { /** * Adds the object to the vector of parameter values * - * @param obj the obj to add - * - * @return this parameter block + * @param obj + * the obj to add. + * @return this parameter block. */ public ParameterBlock add(Object obj) { parameters.addElement(obj); @@ -125,20 +138,22 @@ public class ParameterBlock implements Cloneable, Serializable { } /** - * Sets the vector of sources, replacing the existing - * vector of sources, if any. + * Sets the vector of sources, replacing the existing vector of sources, if + * any. * - * @param sources the new sources + * @param sources + * the new sources. */ public void setSources(Vector sources) { this.sources = sources; } /** - * Sets the vector of parameters, replacing the existing - * vector of parameters, if any. + * Sets the vector of parameters, replacing the existing vector of + * parameters, if any. * - * @param parameters the new parameters + * @param parameters + * the new parameters. */ public void setParameters(Vector parameters) { this.parameters = parameters; @@ -147,7 +162,7 @@ public class ParameterBlock implements Cloneable, Serializable { /** * Gets the vector of sources. * - * @return the sources + * @return the sources. */ public Vector getSources() { return sources; @@ -156,7 +171,7 @@ public class ParameterBlock implements Cloneable, Serializable { /** * Gets the vector of parameters. * - * @return the parameters + * @return the parameters. */ public Vector getParameters() { return parameters; @@ -165,9 +180,9 @@ public class ParameterBlock implements Cloneable, Serializable { /** * Gets the source at the specified index. * - * @param index the index - * - * @return the source object found at the specified index + * @param index + * the index. + * @return the source object found at the specified index. */ public Object getSource(int index) { return sources.elementAt(index); @@ -176,9 +191,9 @@ public class ParameterBlock implements Cloneable, Serializable { /** * Gets the object parameter found at the specified index. * - * @param index the index - * - * @return the parameter object found at the specified index + * @param index + * the index. + * @return the parameter object found at the specified index. */ public Object getObjectParameter(int index) { return parameters.elementAt(index); @@ -187,328 +202,333 @@ public class ParameterBlock implements Cloneable, Serializable { /** * Shallow clone (clones using the superclass clone method). * - * @return the clone of this object + * @return the clone of this object. */ public Object shallowClone() { - try{ + try { return super.clone(); - }catch(Exception e){ + } catch (Exception e) { return null; } } + /** + * Returns a copy of this ParameterBlock instance. + * + * @return the identical copy of this instance. + */ @SuppressWarnings("unchecked") @Override public Object clone() { ParameterBlock replica; - try{ + try { replica = (ParameterBlock)super.clone(); - }catch(Exception e){ + } catch (Exception e) { return null; } - if(sources != null){ + if (sources != null) { replica.setSources((Vector)(sources.clone())); } - if(parameters != null){ + if (parameters != null) { replica.setParameters((Vector)(parameters.clone())); } return replica; } /** - * Gets an array of classes corresponding to all of the parameter - * values found in the array of parameters, in order. + * Gets an array of classes corresponding to all of the parameter values + * found in the array of parameters, in order. * - * @return the parameter classes + * @return the parameter classes. */ public Class[] getParamClasses() { int count = parameters.size(); Class paramClasses[] = new Class[count]; - for(int i = 0; i < count; i++){ + for (int i = 0; i < count; i++) { paramClasses[i] = parameters.elementAt(i).getClass(); } return paramClasses; } /** - * Gets the renderable source image found at the specified index - * in the source array. - * - * @param index the index + * Gets the renderable source image found at the specified index in the + * source array. * - * @return the renderable source image + * @param index + * the index. + * @return the renderable source image. */ public RenderableImage getRenderableSource(int index) { return (RenderableImage)sources.elementAt(index); } /** - * Wraps the short value in a Short and places it in the - * parameter block at the specified index. + * Wraps the short value in a Short and places it in the parameter block at + * the specified index. * - * @param s the short value of the parameter - * @param index the index - * - * @return this parameter block + * @param s + * the short value of the parameter. + * @param index + * the index. + * @return this parameter block. */ public ParameterBlock set(short s, int index) { return set(new Short(s), index); } /** - * Wraps the short value in a Short and adds it to the - * parameter block. - * - * @param s the short value of the parameter + * Wraps the short value in a Short and adds it to the parameter block. * - * @return this parameter block + * @param s + * the short value of the parameter. + * @return this parameter block. */ public ParameterBlock add(short s) { return add(new Short(s)); } /** - * Wraps the long value in a Long and places it in the - * parameter block at the specified index. + * Wraps the long value in a Long and places it in the parameter block at + * the specified index. * - * @param l the long value of the parameter - * @param index the index - * - * @return this parameter block + * @param l + * the long value of the parameter. + * @param index + * the index. + * @return this parameter block. */ public ParameterBlock set(long l, int index) { return set(new Long(l), index); } /** - * Wraps the long value in a Long and adds it to the - * parameter block. - * - * @param l the long value of the parameter + * Wraps the long value in a Long and adds it to the parameter block. * - * @return this parameter block + * @param l + * the long value of the parameter. + * @return this parameter block. */ public ParameterBlock add(long l) { return add(new Long(l)); } /** - * Wraps the int value in an Integer and places it in the - * parameter block at the specified index. - * - * @param i the int value of the parameter - * @param index the index + * Wraps the integer value in an Integer and places it in the parameter + * block at the specified index. * - * @return this parameter block + * @param i + * the integer value of the parameter. + * @param index + * the index. + * @return this parameter block. */ public ParameterBlock set(int i, int index) { return set(new Integer(i), index); } /** - * Wraps the int value in an Integer and adds it to the - * parameter block. + * Wraps the integer value in an Integer and adds it to the parameter block. * - * @param i the int value of the parameter - * - * @return this parameter block + * @param i + * the integer value of the parameter. + * @return this parameter block. */ public ParameterBlock add(int i) { return add(new Integer(i)); } /** - * Wraps the float value in a Float and places it in the - * parameter block at the specified index. - * - * @param f the float value of the parameter - * @param index the index + * Wraps the float value in a Float and places it in the parameter block at + * the specified index. * - * @return this parameter block + * @param f + * the float value of the parameter. + * @param index + * the index. + * @return this parameter block. */ public ParameterBlock set(float f, int index) { return set(new Float(f), index); } /** - * Wraps the float value in a Float and adds it to the - * parameter block. + * Wraps the float value in a Float and adds it to the parameter block. * - * @param f the float value of the parameter - * - * @return this parameter block + * @param f + * the float value of the parameter. + * @return this parameter block. */ public ParameterBlock add(float f) { return add(new Float(f)); } /** - * Wraps the double value in a Double and places it in the - * parameter block at the specified index. - * - * @param d the double value of the parameter - * @param index the index + * Wraps the double value in a Double and places it in the parameter block + * at the specified index. * - * @return this parameter block + * @param d + * the double value of the parameter. + * @param index + * the index. + * @return this parameter block. */ public ParameterBlock set(double d, int index) { return set(new Double(d), index); } /** - * Wraps the double value in a Double and adds it to the - * parameter block. - * - * @param d the double value of the parameter + * Wraps the double value in a Double and adds it to the parameter block. * - * @return this parameter block + * @param d + * the double value of the parameter. + * @return this parameter block. */ public ParameterBlock add(double d) { return add(new Double(d)); } /** - * Wraps the char value in a Character and places it in the - * parameter block at the specified index. + * Wraps the char value in a Character and places it in the parameter block + * at the specified index. * - * @param c the char value of the parameter - * @param index the index - * - * @return this parameter block + * @param c + * the char value of the parameter. + * @param index + * the index. + * @return this parameter block. */ public ParameterBlock set(char c, int index) { return set(new Character(c), index); } /** - * Wraps the char value in a Character and adds it to the - * parameter block. - * - * @param c the char value of the parameter + * Wraps the char value in a Character and adds it to the parameter block. * - * @return this parameter block + * @param c + * the char value of the parameter. + * @return this parameter block. */ public ParameterBlock add(char c) { return add(new Character(c)); } /** - * Wraps the byte value in a Byte and places it in the - * parameter block at the specified index. + * Wraps the byte value in a Byte and places it in the parameter block at + * the specified index. * - * @param b the byte value of the parameter - * @param index the index - * - * @return this parameter block + * @param b + * the byte value of the parameter. + * @param index + * the index. + * @return this parameter block. */ public ParameterBlock set(byte b, int index) { return set(new Byte(b), index); } /** - * Wraps the byte value in a Byte and adds it to the - * parameter block. - * - * @param b the byte value of the parameter + * Wraps the byte value in a Byte and adds it to the parameter block. * - * @return the parameter block + * @param b + * the byte value of the parameter. + * @return the parameter block. */ public ParameterBlock add(byte b) { return add(new Byte(b)); } /** - * Gets the RenderedImage at the specified index from the - * vector of source images. - * - * @param index the index + * Gets the RenderedImage at the specified index from the vector of source + * images. * - * @return the rendered image + * @param index + * the index. + * @return the rendered image. */ public RenderedImage getRenderedSource(int index) { return (RenderedImage)sources.elementAt(index); } /** - * Gets the short-valued parameter found at the desired index - * in the vector of parameter values. + * Gets the short-valued parameter found at the desired index in the vector + * of parameter values. * - * @param index the index - * - * @return the short parameter + * @param index + * the index. + * @return the short parameter. */ public short getShortParameter(int index) { return ((Short)parameters.elementAt(index)).shortValue(); } /** - * Gets the long-valued parameter found at the desired index - * in the vector of parameter values. - * - * @param index the index + * Gets the long-valued parameter found at the desired index in the vector + * of parameter values. * - * @return the long parameter + * @param index + * the index. + * @return the long parameter. */ public long getLongParameter(int index) { return ((Long)parameters.elementAt(index)).longValue(); } /** - * Gets the int-valued parameter found at the desired index - * in the vector of parameter values. + * Gets the integer-valued parameter found at the desired index in the + * vector of parameter values. * - * @param index the index - * - * @return the int parameter + * @param index + * the index. + * @return the integer parameter. */ public int getIntParameter(int index) { return ((Integer)parameters.elementAt(index)).intValue(); } /** - * Gets the float-valued parameter found at the desired index - * in the vector of parameter values. - * - * @param index the index + * Gets the float-valued parameter found at the desired index in the vector + * of parameter values. * - * @return the float parameter + * @param index + * the index. + * @return the float parameter. */ public float getFloatParameter(int index) { return ((Float)parameters.elementAt(index)).floatValue(); } /** - * Gets the double-valued parameter found at the desired index - * in the vector of parameter values. - * - * @param index the index + * Gets the double-valued parameter found at the desired index in the vector + * of parameter values. * - * @return the double parameter + * @param index + * the index. + * @return the double parameter. */ public double getDoubleParameter(int index) { return ((Double)parameters.elementAt(index)).doubleValue(); } /** - * Gets the char-valued parameter found at the desired index - * in the vector of parameter values. + * Gets the char-valued parameter found at the desired index in the vector + * of parameter values. * - * @param index the index - * - * @return the char parameter + * @param index + * the index. + * @return the char parameter. */ public char getCharParameter(int index) { return ((Character)parameters.elementAt(index)).charValue(); } /** - * Gets the byte-valued parameter found at the desired index - * in the vector of parameter values. - * - * @param index the index + * Gets the byte-valued parameter found at the desired index in the vector + * of parameter values. * - * @return the byte parameter + * @param index + * the index. + * @return the byte parameter. */ public byte getByteParameter(int index) { return ((Byte)parameters.elementAt(index)).byteValue(); @@ -531,7 +551,7 @@ public class ParameterBlock implements Cloneable, Serializable { /** * Gets the number of elements in the vector of sources. * - * @return the number of elements in the vector of sources + * @return the number of elements in the vector of sources. */ public int getNumSources() { return sources.size(); @@ -540,7 +560,7 @@ public class ParameterBlock implements Cloneable, Serializable { /** * Gets the number of elements in the vector of parameters. * - * @return the number of elements in the vector of parameters + * @return the number of elements in the vector of parameters. */ public int getNumParameters() { return parameters.size(); diff --git a/awt/java/awt/image/renderable/RenderContext.java b/awt/java/awt/image/renderable/RenderContext.java index 3a3b93c7af936..0db512faf19ff 100644 --- a/awt/java/awt/image/renderable/RenderContext.java +++ b/awt/java/awt/image/renderable/RenderContext.java @@ -18,6 +18,7 @@ * @author Igor V. Stolyarov * @version $Revision$ */ + package java.awt.image.renderable; import java.awt.RenderingHints; @@ -25,27 +26,37 @@ import java.awt.Shape; import java.awt.geom.AffineTransform; /** - * The Class RenderContext stores data on how an image is to be - * rendered: the affine transform, the area of interest, and - * the rendering hints. + * The Class RenderContext stores data on how an image is to be rendered: the + * affine transform, the area of interest, and the rendering hints. + * + * @since Android 1.0 */ public class RenderContext implements Cloneable { - /** The affine transform. */ + /** + * The affine transform. + */ AffineTransform transform; - - /** The area of interest. */ + + /** + * The area of interest. + */ Shape aoi; - - /** The rendering hints. */ + + /** + * The rendering hints. + */ RenderingHints hints; /** * Instantiates a new render context. * - * @param usr2dev the affine transform - * @param aoi the area of interest - * @param hints the rendering hints + * @param usr2dev + * the affine transform. + * @param aoi + * the area of interest. + * @param hints + * the rendering hints. */ public RenderContext(AffineTransform usr2dev, Shape aoi, RenderingHints hints) { this.transform = (AffineTransform)usr2dev.clone(); @@ -56,8 +67,10 @@ public class RenderContext implements Cloneable { /** * Instantiates a new render context with no specified hints. * - * @param usr2dev the affine transform - * @param aoi the area of interest + * @param usr2dev + * the affine transform. + * @param aoi + * the area of interest. */ public RenderContext(AffineTransform usr2dev, Shape aoi) { this(usr2dev, aoi, null); @@ -66,18 +79,21 @@ public class RenderContext implements Cloneable { /** * Instantiates a new render context with no specified area of interest. * - * @param usr2dev the affine transform - * @param hints the rendering hints + * @param usr2dev + * the affine transform. + * @param hints + * the rendering hints. */ public RenderContext(AffineTransform usr2dev, RenderingHints hints) { this(usr2dev, null, hints); } /** - * Instantiates a new render context with no rendering hints or - * area of interest. + * Instantiates a new render context with no rendering hints or area of + * interest. * - * @param usr2dev the affine transform + * @param usr2dev + * the affine transform. */ public RenderContext(AffineTransform usr2dev) { this(usr2dev, null, null); @@ -91,36 +107,36 @@ public class RenderContext implements Cloneable { /** * Sets the affine transform for this render context. * - * @param newTransform the new affine transform + * @param newTransform + * the new affine transform. */ public void setTransform(AffineTransform newTransform) { transform = (AffineTransform)newTransform.clone(); } /** - * Concatenates the current transform with the specified transform - * (so they are applied with the specified transform acting first) - * and sets the resulting transform as the affine transform of - * this rendering context. - * - * @param modTransform the new transform which modifies the - * current transform - * - * @deprecated use {@link RenderContext#preConcatenateTransform(AffineTransform)} + * Concatenates the current transform with the specified transform (so they + * are applied with the specified transform acting first) and sets the + * resulting transform as the affine transform of this rendering context. + * + * @param modTransform + * the new transform which modifies the current transform. + * @deprecated use + * {@link RenderContext#preConcatenateTransform(AffineTransform)} + * . */ - @Deprecated + @Deprecated public void preConcetenateTransform(AffineTransform modTransform) { preConcatenateTransform(modTransform); } /** - * Concatenates the current transform with the specified transform - * (so they are applied with the specified transform acting first) - * and sets the resulting transform as the affine transform of - * this rendering context. + * Concatenates the current transform with the specified transform (so they + * are applied with the specified transform acting first) and sets the + * resulting transform as the affine transform of this rendering context. * - * @param modTransform the new transform which modifies the - * current transform + * @param modTransform + * the new transform which modifies the current transform. */ public void preConcatenateTransform(AffineTransform modTransform) { transform.preConcatenate(modTransform); @@ -129,10 +145,10 @@ public class RenderContext implements Cloneable { /** * Concatenate the specified transform with the current transform. * - * @param modTransform the new transform which modifies the - * current transform - * - * @deprecated use {@link RenderContext#concatenateTransform(AffineTransform)} + * @param modTransform + * the new transform which modifies the current transform. + * @deprecated use + * {@link RenderContext#concatenateTransform(AffineTransform)}. */ @Deprecated public void concetenateTransform(AffineTransform modTransform) { @@ -142,8 +158,8 @@ public class RenderContext implements Cloneable { /** * Concatenate the specified transform with the current transform. * - * @param modTransform the new transform which modifies the - * current transform + * @param modTransform + * the new transform which modifies the current transform. */ public void concatenateTransform(AffineTransform modTransform) { transform.concatenate(modTransform); @@ -152,7 +168,7 @@ public class RenderContext implements Cloneable { /** * Gets the transform. * - * @return the transform + * @return the transform. */ public AffineTransform getTransform() { return (AffineTransform)transform.clone(); @@ -161,7 +177,8 @@ public class RenderContext implements Cloneable { /** * Sets the area of interest. * - * @param newAoi the new area of interest + * @param newAoi + * the new area of interest. */ public void setAreaOfInterest(Shape newAoi) { aoi = newAoi; @@ -170,7 +187,7 @@ public class RenderContext implements Cloneable { /** * Gets the area of interest. * - * @return the area of interest + * @return the area of interest. */ public Shape getAreaOfInterest() { return aoi; @@ -179,7 +196,8 @@ public class RenderContext implements Cloneable { /** * Sets the rendering hints. * - * @param hints the new rendering hints + * @param hints + * the new rendering hints. */ public void setRenderingHints(RenderingHints hints) { this.hints = hints; @@ -188,7 +206,7 @@ public class RenderContext implements Cloneable { /** * Gets the rendering hints. * - * @return the rendering hints + * @return the rendering hints. */ public RenderingHints getRenderingHints() { return hints; diff --git a/awt/java/awt/image/renderable/RenderableImage.java b/awt/java/awt/image/renderable/RenderableImage.java index 885dc0609ff9c..21332f7d155fc 100644 --- a/awt/java/awt/image/renderable/RenderableImage.java +++ b/awt/java/awt/image/renderable/RenderableImage.java @@ -18,6 +18,7 @@ * @author Igor V. Stolyarov * @version $Revision$ */ + package java.awt.image.renderable; import java.awt.RenderingHints; @@ -25,108 +26,113 @@ import java.awt.image.RenderedImage; import java.util.Vector; /** - * The Interface RenderableImage is implemented by an object that - * collects all of the image-specific data that defines a single image - * that could be rendered to different rendering targets. + * The Interface RenderableImage is implemented by an object that collects all + * of the image-specific data that defines a single image that could be rendered + * to different rendering targets. + * + * @since Android 1.0 */ public interface RenderableImage { - /** The Constant HINTS_OBSERVED indicates that the rendering - * hints are applied rather than ignored. */ + /** + * The Constant HINTS_OBSERVED indicates that the rendering hints are + * applied rather than ignored. + */ public static final String HINTS_OBSERVED = "HINTS_OBSERVED"; //$NON-NLS-1$ /** * Gets the property from the RenderableImage's parameter block. * - * @param name the name of the property to get. - * - * @return the value of the property + * @param name + * the name of the property to get. + * @return the value of the property. */ public Object getProperty(String name); /** - * Creates the rendered image based on the information contained - * in the parameters and the render context. + * Creates the rendered image based on the information contained in the + * parameters and the render context. * - * @param renderContext the render context giving rendering specifications - * such as transformations - * - * @return the rendered image + * @param renderContext + * the render context giving rendering specifications such as + * transformations. + * @return the rendered image. */ public RenderedImage createRendering(RenderContext renderContext); /** - * Creates the scaled rendered image based on the information contained - * in the parameters and the render context. - * - * @param w the desired width after scaling or zero if the scaling - * should be proportional, based on the height - * @param h the desired height after scaling or zero if the scaling - * should be proportional, based on the width - * @param hints the rendering hints to use + * Creates the scaled rendered image based on the information contained in + * the parameters and the render context. * - * @return the rendered image - * - * @throws IllegalArgumentException if both the height and width are zero + * @param w + * the desired width after scaling or zero if the scaling should + * be proportional, based on the height. + * @param h + * the desired height after scaling or zero if the scaling should + * be proportional, based on the width. + * @param hints + * the rendering hints to use. + * @return the rendered image. + * @throws IllegalArgumentException + * if both the height and width are zero. */ public RenderedImage createScaledRendering(int w, int h, RenderingHints hints); /** * Gets the vector of sources from the parameter block. * - * @return the sources + * @return the sources. */ public Vector getSources(); /** * Gets the names of all of the supported properties in the current context. * - * @return the property names + * @return the property names. */ public String[] getPropertyNames(); /** - * Creates the default rendering (using the identity transform - * and default render context). + * Creates the default rendering (using the identity transform and default + * render context). * - * @return the rendered image + * @return the rendered image. */ public RenderedImage createDefaultRendering(); /** * Checks if this context supports dynamic rendering. * - * @return true, if this context supports dynamic rendering + * @return true, if this context supports dynamic rendering. */ public boolean isDynamic(); /** * Gets the width of the image. * - * @return the width of the image + * @return the width of the image. */ public float getWidth(); /** * Gets the y coordinate of the upper left corner. * - * @return the y coordinate of the upper left corner + * @return the y coordinate of the upper left corner. */ public float getMinY(); /** * Gets the x coordinate of the upper left corner. * - * @return the x coordinate of the upper left corner + * @return the x coordinate of the upper left corner. */ public float getMinX(); /** * Gets the height of the image. * - * @return the height of the image + * @return the height of the image. */ public float getHeight(); } - diff --git a/awt/java/awt/image/renderable/RenderableImageOp.java b/awt/java/awt/image/renderable/RenderableImageOp.java index 993ba5fdc3ea4..dc453727bb40c 100644 --- a/awt/java/awt/image/renderable/RenderableImageOp.java +++ b/awt/java/awt/image/renderable/RenderableImageOp.java @@ -18,6 +18,7 @@ * @author Igor V. Stolyarov * @version $Revision$ */ + package java.awt.image.renderable; import java.awt.RenderingHints; @@ -29,35 +30,44 @@ import java.util.Vector; import org.apache.harmony.awt.internal.nls.Messages; /** - * The Class RenderableImageOp is a basic implementation of RenderableImage, - * with methods to access the parameter data and perform rendering - * operations. + * The Class RenderableImageOp is a basic implementation of RenderableImage, + * with methods to access the parameter data and perform rendering operations. + * + * @since Android 1.0 */ public class RenderableImageOp implements RenderableImage { - /** The CRIF. */ + /** + * The CRIF. + */ ContextualRenderedImageFactory CRIF; - - /** The param block. */ + + /** + * The param block. + */ ParameterBlock paramBlock; - - /** The height. */ + + /** + * The height. + */ float minX, minY, width, height; /** * Instantiates a new renderable image op. * - * @param CRIF the cRIF - * @param paramBlock the param block + * @param CRIF + * the cRIF. + * @param paramBlock + * the param block. */ public RenderableImageOp(ContextualRenderedImageFactory CRIF, ParameterBlock paramBlock) { this.CRIF = CRIF; - this.paramBlock = (ParameterBlock) paramBlock.clone(); + this.paramBlock = (ParameterBlock)paramBlock.clone(); Rectangle2D r = CRIF.getBounds2D(paramBlock); - minX = (float) r.getMinX(); - minY = (float) r.getMinY(); - width = (float) r.getWidth(); - height = (float) r.getHeight(); + minX = (float)r.getMinX(); + minY = (float)r.getMinY(); + width = (float)r.getWidth(); + height = (float)r.getHeight(); } public Object getProperty(String name) { @@ -67,27 +77,27 @@ public class RenderableImageOp implements RenderableImage { /** * Sets the parameter block. * - * @param paramBlock the param block - * - * @return the parameter block + * @param paramBlock + * the param block. + * @return the parameter block. */ public ParameterBlock setParameterBlock(ParameterBlock paramBlock) { ParameterBlock oldParam = this.paramBlock; - this.paramBlock = (ParameterBlock) paramBlock.clone(); + this.paramBlock = (ParameterBlock)paramBlock.clone(); return oldParam; } public RenderedImage createRendering(RenderContext renderContext) { Vector sources = getSources(); - ParameterBlock rdParam = (ParameterBlock) paramBlock.clone(); + ParameterBlock rdParam = (ParameterBlock)paramBlock.clone(); if (sources != null) { Vector rdSources = new Vector(); int i = 0; while (i < sources.size()) { - RenderContext newContext = CRIF.mapRenderContext(i, renderContext, paramBlock, - this); + RenderContext newContext = CRIF + .mapRenderContext(i, renderContext, paramBlock, this); RenderedImage rdim = sources.elementAt(i).createRendering(newContext); if (rdim != null) { @@ -103,20 +113,20 @@ public class RenderableImageOp implements RenderableImage { } public RenderedImage createScaledRendering(int w, int h, RenderingHints hints) { - if(w == 0 && h == 0) { + if (w == 0 && h == 0) { // awt.60=Width and Height mustn't be equal zero both throw new IllegalArgumentException(Messages.getString("awt.60")); //$NON-NLS-1$ } - if(w == 0){ - w = Math.round(h*(getWidth()/getHeight())); + if (w == 0) { + w = Math.round(h * (getWidth() / getHeight())); } - if(h == 0){ - h = Math.round(w*(getHeight()/getWidth())); + if (h == 0) { + h = Math.round(w * (getHeight() / getWidth())); } - double sx = (double)w/getWidth(); - double sy = (double)h/getHeight(); + double sx = (double)w / getWidth(); + double sy = (double)h / getHeight(); AffineTransform at = AffineTransform.getScaleInstance(sx, sy); RenderContext context = new RenderContext(at, hints); @@ -124,15 +134,15 @@ public class RenderableImageOp implements RenderableImage { } public Vector getSources() { - if(paramBlock.getNumSources() == 0) { + if (paramBlock.getNumSources() == 0) { return null; } Vector v = new Vector(); - int i = 0; - while(i < paramBlock.getNumSources()){ + int i = 0; + while (i < paramBlock.getNumSources()) { Object o = paramBlock.getSource(i); - if(o instanceof RenderableImage){ - v.addElement((RenderableImage) o); + if (o instanceof RenderableImage) { + v.addElement((RenderableImage)o); } i++; } @@ -179,4 +189,3 @@ public class RenderableImageOp implements RenderableImage { } } - diff --git a/awt/java/awt/image/renderable/RenderableImageProducer.java b/awt/java/awt/image/renderable/RenderableImageProducer.java index 7fda98cb56e5f..e83ebc76be846 100644 --- a/awt/java/awt/image/renderable/RenderableImageProducer.java +++ b/awt/java/awt/image/renderable/RenderableImageProducer.java @@ -18,6 +18,7 @@ * @author Igor V. Stolyarov * @version $Revision$ */ + package java.awt.image.renderable; import java.awt.image.ColorModel; @@ -28,25 +29,35 @@ import java.awt.image.RenderedImage; import java.util.Vector; /** - * The Class RenderableImageProducer provides the implementation for - * the image rendering. + * The Class RenderableImageProducer provides the implementation for the image + * rendering. + * + * @since Android 1.0 */ public class RenderableImageProducer implements ImageProducer, Runnable { - /** The rbl. */ + /** + * The rbl. + */ RenderableImage rbl; - - /** The rc. */ + + /** + * The rc. + */ RenderContext rc; - - /** The consumers. */ + + /** + * The consumers. + */ Vector consumers = new Vector(); /** * Instantiates a new renderable image producer. * - * @param rdblImage the rdbl image - * @param rc the rc + * @param rdblImage + * the rdbl image. + * @param rc + * the rc. */ public RenderableImageProducer(RenderableImage rdblImage, RenderContext rc) { this.rbl = rdblImage; @@ -56,7 +67,8 @@ public class RenderableImageProducer implements ImageProducer, Runnable { /** * Sets the render context. * - * @param rc the new render context + * @param rc + * the new render context. */ public synchronized void setRenderContext(RenderContext rc) { this.rc = rc; @@ -72,16 +84,17 @@ public class RenderableImageProducer implements ImageProducer, Runnable { t.start(); } - public void requestTopDownLeftRightResend(ImageConsumer ic) {} + public void requestTopDownLeftRightResend(ImageConsumer ic) { + } public synchronized void removeConsumer(ImageConsumer ic) { - if(ic != null) { + if (ic != null) { consumers.removeElement(ic); } } public synchronized void addConsumer(ImageConsumer ic) { - if(ic != null && !consumers.contains(ic)){ + if (ic != null && !consumers.contains(ic)) { consumers.addElement(ic); } } @@ -90,19 +103,19 @@ public class RenderableImageProducer implements ImageProducer, Runnable { * Creates the rendered image in a new thread. */ public void run() { - if(rbl == null) { + if (rbl == null) { return; } RenderedImage rd; - if(rc != null) { + if (rc != null) { rd = rbl.createRendering(rc); } else { rd = rbl.createDefaultRendering(); } ColorModel cm = rd.getColorModel(); - if(cm == null) { + if (cm == null) { cm = ColorModel.getRGBdefault(); } @@ -112,17 +125,15 @@ public class RenderableImageProducer implements ImageProducer, Runnable { for (ImageConsumer c : consumers) { c.setDimensions(w, h); - c.setHints(ImageConsumer.TOPDOWNLEFTRIGHT | - ImageConsumer.COMPLETESCANLINES | - ImageConsumer.SINGLEFRAME | - ImageConsumer.SINGLEPASS); + c.setHints(ImageConsumer.TOPDOWNLEFTRIGHT | ImageConsumer.COMPLETESCANLINES + | ImageConsumer.SINGLEFRAME | ImageConsumer.SINGLEPASS); } int scanLine[] = new int[w]; int pixel[] = null; - for(int y = 0; y < h; y++){ - for(int x = 0; x < w; x++){ + for (int y = 0; y < h; y++) { + for (int x = 0; x < w; x++) { pixel = r.getPixel(x, y, pixel); scanLine[x] = cm.getDataElement(pixel, 0); } @@ -138,4 +149,3 @@ public class RenderableImageProducer implements ImageProducer, Runnable { } } - diff --git a/awt/java/awt/image/renderable/RenderedImageFactory.java b/awt/java/awt/image/renderable/RenderedImageFactory.java index 345d82c61a629..881a40ab79397 100644 --- a/awt/java/awt/image/renderable/RenderedImageFactory.java +++ b/awt/java/awt/image/renderable/RenderedImageFactory.java @@ -18,26 +18,29 @@ * @author Igor V. Stolyarov * @version $Revision$ */ + package java.awt.image.renderable; import java.awt.RenderingHints; import java.awt.image.RenderedImage; /** - * A factory for creating RenderedImage objects based on parameters - * and rendering hints. + * A factory for creating RenderedImage objects based on parameters and + * rendering hints. + * + * @since Android 1.0 */ public interface RenderedImageFactory { /** * Creates the rendered image. * - * @param a0 the ParameterBlock - * @param a1 the RenderingHints - * - * @return the rendered image + * @param a0 + * the ParameterBlock. + * @param a1 + * the RenderingHints. + * @return the rendered image. */ public RenderedImage create(ParameterBlock a0, RenderingHints a1); } - diff --git a/awt/java/awt/image/renderable/package.html b/awt/java/awt/image/renderable/package.html new file mode 100644 index 0000000000000..43aaabc836870 --- /dev/null +++ b/awt/java/awt/image/renderable/package.html @@ -0,0 +1,8 @@ + + +

    + This package contains classes to create images which are rendering-independent. +

    + @since Android 1.0 + + diff --git a/awt/java/awt/package.html b/awt/java/awt/package.html new file mode 100644 index 0000000000000..5a6f9f011fc7d --- /dev/null +++ b/awt/java/awt/package.html @@ -0,0 +1,8 @@ + + +

    + This package contains classes and interfaces for creating (graphical) user interfaces (GUI), painting 2D graphics and creating, manipulating and drawing images. +

    + @since Android 1.0 + + diff --git a/awt/java/beans/IndexedPropertyChangeEvent.java b/awt/java/beans/IndexedPropertyChangeEvent.java deleted file mode 100644 index c9084c6c54c7f..0000000000000 --- a/awt/java/beans/IndexedPropertyChangeEvent.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ - -package java.beans; - -/** - * A type of {@link PropertyChangeEvent} that indicates that an indexed property - * has changed. - * - * @since 1.5 - */ -public class IndexedPropertyChangeEvent extends PropertyChangeEvent { - - private static final long serialVersionUID = -320227448495806870L; - - private final int index; - - /** - * Creates a new property changed event with an indication of the property - * index. - * - * @param source - * the changed bean. - * @param propertyName - * the changed property, or null to indicate an - * unspecified set of the properties have changed. - * @param oldValue - * the previous value of the property, or null if - * the propertyName is null or the - * previous value is unknown. - * @param newValue - * the new value of the property, or null if the - * propertyName is null or the new - * value is unknown.. - * @param index - * the index of the property. - */ - public IndexedPropertyChangeEvent(Object source, String propertyName, - Object oldValue, Object newValue, int index) { - super(source, propertyName, oldValue, newValue); - this.index = index; - } - - /** - * Answer the index of the property that was changed in this event. - * - * @return The property element index. - */ - public int getIndex() { - return index; - } -} diff --git a/awt/java/beans/PropertyChangeEvent.java b/awt/java/beans/PropertyChangeEvent.java deleted file mode 100644 index 97c703af5d372..0000000000000 --- a/awt/java/beans/PropertyChangeEvent.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package java.beans; - -import java.util.EventObject; - -public class PropertyChangeEvent extends EventObject { - - private static final long serialVersionUID = 7042693688939648123L; - - String propertyName; - - Object oldValue; - - Object newValue; - - Object propagationId; - - public PropertyChangeEvent(Object source, String propertyName, - Object oldValue, Object newValue) { - super(source); - - this.propertyName = propertyName; - this.oldValue = oldValue; - this.newValue = newValue; - } - - public String getPropertyName() { - return propertyName; - } - - public void setPropagationId(Object propagationId) { - this.propagationId = propagationId; - } - - public Object getPropagationId() { - return propagationId; - } - - public Object getOldValue() { - return oldValue; - } - - public Object getNewValue() { - return newValue; - } -} diff --git a/awt/java/beans/PropertyChangeListener.java b/awt/java/beans/PropertyChangeListener.java deleted file mode 100644 index 94422c0b6f239..0000000000000 --- a/awt/java/beans/PropertyChangeListener.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package java.beans; - -import java.util.EventListener; - -public interface PropertyChangeListener extends EventListener { - - public void propertyChange(PropertyChangeEvent event); -} diff --git a/awt/java/beans/PropertyChangeListenerProxy.java b/awt/java/beans/PropertyChangeListenerProxy.java deleted file mode 100644 index f4f3aec06e880..0000000000000 --- a/awt/java/beans/PropertyChangeListenerProxy.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package java.beans; - -import java.util.EventListenerProxy; - -public class PropertyChangeListenerProxy extends EventListenerProxy implements - PropertyChangeListener { - - String propertyName; - - public PropertyChangeListenerProxy(String propertyName, - PropertyChangeListener listener) { - super(listener); - this.propertyName = propertyName; - } - - public String getPropertyName() { - return propertyName; - } - - public void propertyChange(PropertyChangeEvent event) { - PropertyChangeListener listener = (PropertyChangeListener) getListener(); - listener.propertyChange(event); - } -} diff --git a/awt/java/beans/PropertyChangeSupport.java b/awt/java/beans/PropertyChangeSupport.java deleted file mode 100644 index d56e63a784bd5..0000000000000 --- a/awt/java/beans/PropertyChangeSupport.java +++ /dev/null @@ -1,351 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package java.beans; - -import java.io.IOException; -import java.io.ObjectInputStream; -import java.io.ObjectOutputStream; -import java.io.Serializable; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Hashtable; -import java.util.Iterator; -import java.util.List; -import java.util.Map; - -public class PropertyChangeSupport implements Serializable { - - private static final long serialVersionUID = 6401253773779951803l; - - private transient Object sourceBean; - - private transient List allPropertiesChangeListeners = - new ArrayList(); - - private transient Map> - selectedPropertiesChangeListeners = - new HashMap>(); - - // fields for serialization compatibility - private Hashtable> children; - - private Object source; - - private int propertyChangeSupportSerializedDataVersion = 1; - - public PropertyChangeSupport(Object sourceBean) { - if (sourceBean == null) { - throw new NullPointerException(); - } - this.sourceBean = sourceBean; - } - - public void firePropertyChange(String propertyName, Object oldValue, - Object newValue) { - PropertyChangeEvent event = createPropertyChangeEvent(propertyName, - oldValue, newValue); - doFirePropertyChange(event); - } - - public void fireIndexedPropertyChange(String propertyName, int index, - Object oldValue, Object newValue) { - - // nulls and equals check done in doFire... - doFirePropertyChange(new IndexedPropertyChangeEvent(sourceBean, - propertyName, oldValue, newValue, index)); - } - - public synchronized void removePropertyChangeListener(String propertyName, - PropertyChangeListener listener) { - if ((propertyName != null) && (listener != null)) { - List listeners = - selectedPropertiesChangeListeners.get(propertyName); - - if (listeners != null) { - listeners.remove(listener); - } - } - } - - public synchronized void addPropertyChangeListener(String propertyName, - PropertyChangeListener listener) { - if ((listener != null) && (propertyName != null)) { - List listeners = - selectedPropertiesChangeListeners.get(propertyName); - - if (listeners == null) { - listeners = new ArrayList(); - selectedPropertiesChangeListeners.put(propertyName, listeners); - } - - // RI compatibility - if (listener instanceof PropertyChangeListenerProxy) { - PropertyChangeListenerProxy proxy = - (PropertyChangeListenerProxy) listener; - - listeners.add(new PropertyChangeListenerProxy( - proxy.getPropertyName(), - (PropertyChangeListener) proxy.getListener())); - } else { - listeners.add(listener); - } - } - } - - public synchronized PropertyChangeListener[] getPropertyChangeListeners( - String propertyName) { - List listeners = null; - - if (propertyName != null) { - listeners = selectedPropertiesChangeListeners.get(propertyName); - } - - return (listeners == null) ? new PropertyChangeListener[] {} - : listeners.toArray( - new PropertyChangeListener[listeners.size()]); - } - - public void firePropertyChange(String propertyName, boolean oldValue, - boolean newValue) { - PropertyChangeEvent event = createPropertyChangeEvent(propertyName, - oldValue, newValue); - doFirePropertyChange(event); - } - - public void fireIndexedPropertyChange(String propertyName, int index, - boolean oldValue, boolean newValue) { - - if (oldValue != newValue) { - fireIndexedPropertyChange(propertyName, index, Boolean - .valueOf(oldValue), Boolean.valueOf(newValue)); - } - } - - public void firePropertyChange(String propertyName, int oldValue, - int newValue) { - PropertyChangeEvent event = createPropertyChangeEvent(propertyName, - oldValue, newValue); - doFirePropertyChange(event); - } - - public void fireIndexedPropertyChange(String propertyName, int index, - int oldValue, int newValue) { - - if (oldValue != newValue) { - fireIndexedPropertyChange(propertyName, index, - new Integer(oldValue), new Integer(newValue)); - } - } - - public synchronized boolean hasListeners(String propertyName) { - boolean result = allPropertiesChangeListeners.size() > 0; - if (!result && (propertyName != null)) { - List listeners = - selectedPropertiesChangeListeners.get(propertyName); - if (listeners != null) { - result = listeners.size() > 0; - } - } - return result; - } - - public synchronized void removePropertyChangeListener( - PropertyChangeListener listener) { - if (listener != null) { - if (listener instanceof PropertyChangeListenerProxy) { - String name = ((PropertyChangeListenerProxy) listener) - .getPropertyName(); - PropertyChangeListener lst = (PropertyChangeListener) - ((PropertyChangeListenerProxy) listener).getListener(); - - removePropertyChangeListener(name, lst); - } else { - allPropertiesChangeListeners.remove(listener); - } - } - } - - public synchronized void addPropertyChangeListener( - PropertyChangeListener listener) { - if (listener != null) { - if (listener instanceof PropertyChangeListenerProxy) { - String name = ((PropertyChangeListenerProxy) listener) - .getPropertyName(); - PropertyChangeListener lst = (PropertyChangeListener) - ((PropertyChangeListenerProxy) listener).getListener(); - addPropertyChangeListener(name, lst); - } else { - allPropertiesChangeListeners.add(listener); - } - } - } - - public synchronized PropertyChangeListener[] getPropertyChangeListeners() { - ArrayList result = - new ArrayList( - allPropertiesChangeListeners); - - for (String propertyName : selectedPropertiesChangeListeners.keySet()) { - List selectedListeners = - selectedPropertiesChangeListeners.get(propertyName); - - if (selectedListeners != null) { - - for (PropertyChangeListener listener : selectedListeners) { - result.add(new PropertyChangeListenerProxy(propertyName, - listener)); - } - } - } - - return result.toArray(new PropertyChangeListener[result.size()]); - } - - private void writeObject(ObjectOutputStream oos) throws IOException { - List allSerializedPropertiesChangeListeners = - new ArrayList(); - - for (PropertyChangeListener pcl : allPropertiesChangeListeners) { - if (pcl instanceof Serializable) { - allSerializedPropertiesChangeListeners.add(pcl); - } - } - - Map> - selectedSerializedPropertiesChangeListeners = - new HashMap>(); - - for (String propertyName : selectedPropertiesChangeListeners.keySet()) { - List keyValues = - selectedPropertiesChangeListeners.get(propertyName); - - if (keyValues != null) { - List serializedPropertiesChangeListeners - = new ArrayList(); - - for (PropertyChangeListener pcl : keyValues) { - if (pcl instanceof Serializable) { - serializedPropertiesChangeListeners.add(pcl); - } - } - - if (!serializedPropertiesChangeListeners.isEmpty()) { - selectedSerializedPropertiesChangeListeners.put( - propertyName, serializedPropertiesChangeListeners); - } - } - } - - children = new Hashtable>( - selectedSerializedPropertiesChangeListeners); - children.put("", allSerializedPropertiesChangeListeners); //$NON-NLS-1$ - oos.writeObject(children); - - Object source = null; - if (sourceBean instanceof Serializable) { - source = sourceBean; - } - oos.writeObject(source); - - oos.writeInt(propertyChangeSupportSerializedDataVersion); - } - - @SuppressWarnings("unchecked") - private void readObject(ObjectInputStream ois) throws IOException, - ClassNotFoundException { - children = (Hashtable>) ois - .readObject(); - - selectedPropertiesChangeListeners = new HashMap>( - children); - allPropertiesChangeListeners = selectedPropertiesChangeListeners - .remove(""); //$NON-NLS-1$ - if (allPropertiesChangeListeners == null) { - allPropertiesChangeListeners = new ArrayList(); - } - - sourceBean = ois.readObject(); - propertyChangeSupportSerializedDataVersion = ois.readInt(); - } - - public void firePropertyChange(PropertyChangeEvent event) { - doFirePropertyChange(event); - } - - private PropertyChangeEvent createPropertyChangeEvent(String propertyName, - Object oldValue, Object newValue) { - return new PropertyChangeEvent(sourceBean, propertyName, oldValue, - newValue); - } - - private PropertyChangeEvent createPropertyChangeEvent(String propertyName, - boolean oldValue, boolean newValue) { - return new PropertyChangeEvent(sourceBean, propertyName, oldValue, - newValue); - } - - private PropertyChangeEvent createPropertyChangeEvent(String propertyName, - int oldValue, int newValue) { - return new PropertyChangeEvent(sourceBean, propertyName, oldValue, - newValue); - } - - private void doFirePropertyChange(PropertyChangeEvent event) { - String propertyName = event.getPropertyName(); - Object oldValue = event.getOldValue(); - Object newValue = event.getNewValue(); - - if ((newValue != null) && (oldValue != null) - && newValue.equals(oldValue)) { - return; - } - - /* - * Copy the listeners collections so they can be modified while we fire - * events. - */ - - // Listeners to all property change events - PropertyChangeListener[] listensToAll; - // Listens to a given property change - PropertyChangeListener[] listensToOne = null; - synchronized (this) { - listensToAll = allPropertiesChangeListeners - .toArray(new PropertyChangeListener[allPropertiesChangeListeners - .size()]); - - List listeners = selectedPropertiesChangeListeners - .get(propertyName); - if (listeners != null) { - listensToOne = listeners - .toArray(new PropertyChangeListener[listeners.size()]); - } - } - - // Fire the listeners - for (PropertyChangeListener listener : listensToAll) { - listener.propertyChange(event); - } - if (listensToOne != null) { - for (PropertyChangeListener listener : listensToOne) { - listener.propertyChange(event); - } - } - } - -} diff --git a/awt/javax/imageio/IIOException.java b/awt/javax/imageio/IIOException.java index fbfeb42fd062f..c77716c439af9 100644 --- a/awt/javax/imageio/IIOException.java +++ b/awt/javax/imageio/IIOException.java @@ -18,22 +18,28 @@ * @author Rustem V. Rafikov * @version $Revision: 1.3 $ */ + package javax.imageio; import java.io.IOException; /** * The IIOException class indicates errors in reading/writing operations. + * + * @since Android 1.0 */ public class IIOException extends IOException { - /** The Constant serialVersionUID. */ + /** + * The Constant serialVersionUID. + */ private static final long serialVersionUID = -3216210718638985251L; /** * Instantiates a new IIOException. * - * @param message the detailed message. + * @param message + * the detailed message. */ public IIOException(String message) { super(message); @@ -42,8 +48,10 @@ public class IIOException extends IOException { /** * Instantiates a new IIOException. * - * @param message the detailed message. - * @param cause the cause of this exception. + * @param message + * the detailed message. + * @param cause + * the cause of this exception. */ public IIOException(String message, Throwable cause) { super(message); diff --git a/awt/javax/imageio/IIOImage.java b/awt/javax/imageio/IIOImage.java index e17a9fc07cfc4..e9e5130cfabe7 100644 --- a/awt/javax/imageio/IIOImage.java +++ b/awt/javax/imageio/IIOImage.java @@ -18,6 +18,7 @@ * @author Rustem V. Rafikov * @version $Revision: 1.3 $ */ + package javax.imageio; import javax.imageio.metadata.IIOMetadata; @@ -27,33 +28,47 @@ import java.awt.image.BufferedImage; import java.util.List; /** - * The IIOImage class combines the image, image's thumbnail and image's metadata. - * The image can be presented as RenderedImage or Raster object. + * The IIOImage class combines the image, image's thumbnail and image's + * metadata. The image can be presented as RenderedImage or Raster object. + * + * @since Android 1.0 */ public class IIOImage { - /** The image of this IIOImage. */ + /** + * The image of this IIOImage. + */ protected RenderedImage image; - - /** The raster of this IIOImage. */ + + /** + * The raster of this IIOImage. + */ protected Raster raster; - - /** The list with thumbnails associated with the image. */ + + /** + * The list with thumbnails associated with the image. + */ protected List thumbnails; - - /** The metadata associated with the image. */ + + /** + * The metadata associated with the image. + */ protected IIOMetadata metadata; /** - * Instantiates a new IIOImage with the specified RenderedImage, - * list of thumbnails and metadata. + * Instantiates a new IIOImage with the specified RenderedImage, list of + * thumbnails and metadata. * - * @param image the image specified by RenderedImage. - * @param thumbnails the list of BufferedImage objects which - * represent the thumbnails of the image. - * @param metadata the metadata of the image. + * @param image + * the image specified by RenderedImage. + * @param thumbnails + * the list of BufferedImage objects which represent the + * thumbnails of the image. + * @param metadata + * the metadata of the image. */ - public IIOImage(RenderedImage image, List thumbnails, IIOMetadata metadata) { + public IIOImage(RenderedImage image, List thumbnails, + IIOMetadata metadata) { if (image == null) { throw new IllegalArgumentException("image should not be NULL"); } @@ -64,13 +79,16 @@ public class IIOImage { } /** - * Instantiates a new IIOImage with the specified Raster, list of - * thumbnails and metadata. + * Instantiates a new IIOImage with the specified Raster, list of thumbnails + * and metadata. * - * @param raster the Raster. - * @param thumbnails the list of BufferedImage objects which - * represent the thumbnails of Raster data. - * @param metadata the metadata. + * @param raster + * the Raster. + * @param thumbnails + * the list of BufferedImage objects which represent the + * thumbnails of Raster data. + * @param metadata + * the metadata. */ public IIOImage(Raster raster, List thumbnails, IIOMetadata metadata) { if (raster == null) { @@ -83,11 +101,11 @@ public class IIOImage { } /** - * Gets the RenderedImage object or returns null if this IIOImage - * object is associated with a Raster. + * Gets the RenderedImage object or returns null if this IIOImage object is + * associated with a Raster. * - * @return the RenderedImage object or null if this IIOImage - * object is associated with a Raster. + * @return the RenderedImage object or null if this IIOImage object is + * associated with a Raster. */ public RenderedImage getRenderedImage() { return image; @@ -96,7 +114,8 @@ public class IIOImage { /** * Sets the RenderedImage to this IIOImage object. * - * @param image the RenderedImage to be set to this IIOImage. + * @param image + * the RenderedImage to be set to this IIOImage. */ public void setRenderedImage(RenderedImage image) { if (image == null) { @@ -107,11 +126,11 @@ public class IIOImage { } /** - * Returns true if the IIOImage object associated with a Raster, or - * false if it's associated with a RenderedImage. + * Returns true if the IIOImage object associated with a Raster, or false if + * it's associated with a RenderedImage. * - * @return true if the IIOImage object associated with a Raster, or - * false if it's associated with a RenderedImage. + * @return true, if the IIOImage object associated with a Raster, or false + * if it's associated with a RenderedImage. */ public boolean hasRaster() { return raster != null; @@ -121,8 +140,8 @@ public class IIOImage { * Gets the Raster object or returns null if this IIOImage object is * associated with a RenderedImage. * - * @return the Raster or null if this IIOImage object - * is associated with a RenderedImage. + * @return the Raster or null if this IIOImage object is associated with a + * RenderedImage. */ public Raster getRaster() { return raster; @@ -131,7 +150,8 @@ public class IIOImage { /** * Sets the Raster to the IIOImage. * - * @param raster the new Raster to the IIOImage. + * @param raster + * the new Raster to the IIOImage. */ public void setRaster(Raster raster) { if (raster == null) { @@ -153,8 +173,8 @@ public class IIOImage { /** * Gets the thumbnail with the specified index in the list. * - * @param index the index of the thumbnail in the list. - * + * @param index + * the index of the thumbnail in the list. * @return the thumbnail with the specified index in the list. */ public BufferedImage getThumbnail(int index) { @@ -176,8 +196,8 @@ public class IIOImage { /** * Sets the list of thumbnails images to this IIOImage object. * - * @param thumbnails the list of BufferedImage which represent - * thumbnails. + * @param thumbnails + * the list of BufferedImage which represent thumbnails. */ public void setThumbnails(List thumbnails) { this.thumbnails = thumbnails; @@ -195,7 +215,8 @@ public class IIOImage { /** * Sets the metadata to this IIOImage object. * - * @param metadata the IIOMetadata, or null. + * @param metadata + * the IIOMetadata, or null. */ public void setMetadata(IIOMetadata metadata) { this.metadata = metadata; diff --git a/awt/javax/imageio/IIOParam.java b/awt/javax/imageio/IIOParam.java index d998b6e513720..2ccc9450f5b4a 100644 --- a/awt/javax/imageio/IIOParam.java +++ b/awt/javax/imageio/IIOParam.java @@ -18,56 +18,80 @@ * @author Rustem V. Rafikov * @version $Revision: 1.3 $ */ + package javax.imageio; import java.awt.*; /** - * The IIOParam abstract class is superclass for - * ImageReadParam and ImageWriteParam classes and provides - * methods and variables which they share. + * The IIOParam abstract class is superclass for ImageReadParam and + * ImageWriteParam classes and provides methods and variables which they share. + * + * @since Android 1.0 */ public abstract class IIOParam { - - /** The source region. */ + + /** + * The source region. + */ protected Rectangle sourceRegion; - - /** The source x subsampling. */ + + /** + * The source x subsampling. + */ protected int sourceXSubsampling = 1; - - /** The source y subsampling. */ + + /** + * The source y subsampling. + */ protected int sourceYSubsampling = 1; - - /** The subsampling x offset. */ + + /** + * The subsampling x offset. + */ protected int subsamplingXOffset; - - /** The subsampling y offset. */ + + /** + * The subsampling y offset. + */ protected int subsamplingYOffset; - - /** The source bands. */ + + /** + * The source bands. + */ protected int[] sourceBands; - - /** The destination type. */ + + /** + * The destination type. + */ protected ImageTypeSpecifier destinationType; - - /** The destination offset. */ + + /** + * The destination offset. + */ protected Point destinationOffset = new Point(0, 0); - - /** The default controller. */ + + /** + * The default controller. + */ protected IIOParamController defaultController; - - /** The controller. */ + + /** + * The controller. + */ protected IIOParamController controller; /** * Instantiates a new IIOParam. */ - protected IIOParam() {} + protected IIOParam() { + } /** * Sets the source region as a Rectangle object. * - * @param sourceRegion the Rectangle which specifies the source region. + * @param sourceRegion + * the Rectangle which specifies the source region. */ public void setSourceRegion(Rectangle sourceRegion) { if (sourceRegion != null) { @@ -91,8 +115,8 @@ public abstract class IIOParam { if (sourceRegion.height <= subsamplingYOffset) { throw new IllegalArgumentException("height <= subsamplingXOffset"); } - //-- clone it to avoid unexpected modifications - this.sourceRegion = (Rectangle) sourceRegion.clone(); + // -- clone it to avoid unexpected modifications + this.sourceRegion = (Rectangle)sourceRegion.clone(); } else { this.sourceRegion = null; } @@ -107,24 +131,26 @@ public abstract class IIOParam { if (sourceRegion == null) { return null; } - //-- clone it to avoid unexpected modifications - return (Rectangle) sourceRegion.clone(); + // -- clone it to avoid unexpected modifications + return (Rectangle)sourceRegion.clone(); } /** - * Sets the source subsampling. The sourceXSubsampling and - * sourceYSubsampling parameters specify the number of rows - * and columns to advance after every source pixel. + * Sets the source subsampling. The sourceXSubsampling and + * sourceYSubsampling parameters specify the number of rows and columns to + * advance after every source pixel. * - * @param sourceXSubsampling the source X subsampling. - * @param sourceYSubsampling the source Y subsampling. - * @param subsamplingXOffset the subsampling X offset. - * @param subsamplingYOffset the subsampling Y offset. + * @param sourceXSubsampling + * the source X subsampling. + * @param sourceYSubsampling + * the source Y subsampling. + * @param subsamplingXOffset + * the subsampling X offset. + * @param subsamplingYOffset + * the subsampling Y offset. */ - public void setSourceSubsampling(int sourceXSubsampling, - int sourceYSubsampling, - int subsamplingXOffset, - int subsamplingYOffset) { + public void setSourceSubsampling(int sourceXSubsampling, int sourceYSubsampling, + int subsamplingXOffset, int subsamplingYOffset) { if (sourceXSubsampling <= 0) { throw new IllegalArgumentException("sourceXSubsampling <= 0"); @@ -141,10 +167,10 @@ public abstract class IIOParam { throw new IllegalArgumentException("subsamplingYOffset is wrong"); } - //-- does region contain pixels + // -- does region contain pixels if (sourceRegion != null) { - if (sourceRegion.width <= subsamplingXOffset || - sourceRegion.height <= subsamplingYOffset) { + if (sourceRegion.width <= subsamplingXOffset + || sourceRegion.height <= subsamplingYOffset) { throw new IllegalArgumentException("there are no pixels in region"); } } @@ -156,8 +182,8 @@ public abstract class IIOParam { } /** - * Gets the source X subsampling - the number of source - * columns to advance for each pixel. + * Gets the source X subsampling - the number of source columns to advance + * for each pixel. * * @return the source X subsampling. */ @@ -166,8 +192,8 @@ public abstract class IIOParam { } /** - * Gets the source Y subsampling - the number of source - * rows to advance for each pixel. + * Gets the source Y subsampling - the number of source rows to advance for + * each pixel. * * @return the source Y subsampling. */ @@ -196,7 +222,8 @@ public abstract class IIOParam { /** * Sets the indices of the source bands. * - * @param sourceBands the indices of the source bands. + * @param sourceBands + * the indices of the source bands. */ public void setSourceBands(int[] sourceBands) { // TODO implement @@ -216,7 +243,8 @@ public abstract class IIOParam { /** * Sets the specified ImageTypeSpecifier for the destination image. * - * @param destinationType the ImageTypeSpecifier. + * @param destinationType + * the ImageTypeSpecifier. */ public void setDestinationType(ImageTypeSpecifier destinationType) { // TODO implement @@ -225,7 +253,7 @@ public abstract class IIOParam { /** * Gets the type of the destination image as an ImageTypeSpecifier. . - * + * * @return the ImageTypeSpecifier. */ public ImageTypeSpecifier getDestinationType() { @@ -234,18 +262,19 @@ public abstract class IIOParam { } /** - * Sets the offset in the destination image where - * the decoded pixels are placed as a result of reading, - * or specified an area to be written while writing operation. + * Sets the offset in the destination image where the decoded pixels are + * placed as a result of reading, or specified an area to be written while + * writing operation. * - * @param destinationOffset the destination offset. + * @param destinationOffset + * the destination offset. */ public void setDestinationOffset(Point destinationOffset) { if (destinationOffset == null) { throw new IllegalArgumentException("destinationOffset == null!"); } - - this.destinationOffset = (Point) destinationOffset.clone(); + + this.destinationOffset = (Point)destinationOffset.clone(); } /** @@ -254,14 +283,15 @@ public abstract class IIOParam { * @return the offset in the destination image. */ public Point getDestinationOffset() { - return (Point) destinationOffset.clone(); + return (Point)destinationOffset.clone(); } /** - * Sets the IIOParamController to this IIOParam object for - * providing settings to this IIOParam. + * Sets the IIOParamController to this IIOParam object for providing + * settings to this IIOParam. * - * @param controller the new IIOParamController. + * @param controller + * the new IIOParamController. */ public void setController(IIOParamController controller) { // TODO implement @@ -269,11 +299,9 @@ public abstract class IIOParam { } /** - * Gets the current IIOParamController controller - * for this IIOParam. + * Gets the current IIOParamController controller for this IIOParam. * - * @return the current IIOParamController controller - * for this IIOParam. + * @return the current IIOParamController controller for this IIOParam. */ public IIOParamController getController() { // TODO implement @@ -281,11 +309,10 @@ public abstract class IIOParam { } /** - * Gets the default IIOParamController controller - * for this IIOParam. + * Gets the default IIOParamController controller for this IIOParam. * - * @return the default IIOParamController controller - * for this IIOParam, or null. + * @return the default IIOParamController controller for this IIOParam, or + * null. */ public IIOParamController getDefaultController() { // TODO implement @@ -293,11 +320,10 @@ public abstract class IIOParam { } /** - * Returns true if IIOParamController is installed for - * this IIOParam. + * Returns true if IIOParamController is installed for this IIOParam. * - * @return true if IIOParamController is installed for - * this IIOParam, false otherwise. + * @return true, if IIOParamController is installed for this IIOParam, false + * otherwise. */ public boolean hasController() { // TODO implement diff --git a/awt/javax/imageio/IIOParamController.java b/awt/javax/imageio/IIOParamController.java index 31522c19bad82..338cb25a7200e 100644 --- a/awt/javax/imageio/IIOParamController.java +++ b/awt/javax/imageio/IIOParamController.java @@ -18,6 +18,7 @@ * @author Sergey I. Salishev * @version $Revision: 1.2 $ */ + package javax.imageio; /* @@ -26,18 +27,19 @@ package javax.imageio; */ /** - * The IIOParamController specifies an activate method that invokes the + * The IIOParamController specifies an activate method that invokes the * controller. + * + * @since Android 1.0 */ public interface IIOParamController { /** - * Activates the controller. - * - * @param param the IIOParam. + * Activates the controller. * - * @return true if the IIOParam has been modified, false otherwise. + * @param param + * the IIOParam. + * @return true, if the IIOParam has been modified, false otherwise. */ boolean activate(IIOParam param); } - diff --git a/awt/javax/imageio/ImageIO.java b/awt/javax/imageio/ImageIO.java index d4cd1dda1ae1a..e0d7ec9904d78 100644 --- a/awt/javax/imageio/ImageIO.java +++ b/awt/javax/imageio/ImageIO.java @@ -18,6 +18,7 @@ * @author Rustem V. Rafikov * @version $Revision: 1.3 $ */ + package javax.imageio; import javax.imageio.stream.ImageInputStream; @@ -34,44 +35,47 @@ import java.awt.image.RenderedImage; import java.net.URL; /** - * The ImageIO class provides static methods to perfom - * reading and writing operations using registered - * ImageReader and ImageWriter objects. + * The ImageIO class provides static methods to perform reading and writing + * operations using registered ImageReader and ImageWriter objects. + * + * @since Android 1.0 */ public final class ImageIO { - /** The Constant registry. */ + /** + * The constant registry. + */ private static final IIORegistry registry = IIORegistry.getDefaultInstance(); /** - * Instantiates a new image io. + * Instantiates a new ImageIO. */ - private ImageIO() {} - + private ImageIO() { + } /** - * Scans for plug-ins in the class path, - * loads spi classes, and registers them with the IIORegistry. + * Scans for plug-ins in the class path, loads spi classes, and registers + * them with the IIORegistry. */ public static void scanForPlugins() { throw new UnsupportedOperationException("Not supported yet"); } /** - * Sets flag which indicates whether a cache file is used when - * creating ImageInputStreams and ImageOutputStreams or not. + * Sets flag which indicates whether a cache file is used when creating + * ImageInputStreams and ImageOutputStreams or not. * - * @param useCache the use cache flag. + * @param useCache + * the use cache flag. */ public static void setUseCache(boolean useCache) { throw new UnsupportedOperationException("Not supported yet"); } /** - * Gets the flag which indicates whether a cache file is used when - * creating ImageInputStreams and ImageOutputStreams or not. - * This method returns the current value which is set by setUseCache - * method. + * Gets the flag which indicates whether a cache file is used when creating + * ImageInputStreams and ImageOutputStreams or not. This method returns the + * current value which is set by setUseCache method. * * @return the use cache flag. */ @@ -83,44 +87,44 @@ public final class ImageIO { /** * Sets the cache directory. * - * @param cacheDirectory the File which specifies a cache directory. + * @param cacheDirectory + * the File which specifies a cache directory. */ public static void setCacheDirectory(File cacheDirectory) { throw new UnsupportedOperationException("Not supported yet"); } /** - * Gets the directory where cache files are created, returned - * the file which is set by setCacheDirectory method, or null. + * Gets the directory where cache files are created, returned the file which + * is set by setCacheDirectory method, or null. * - * @return the File object which is set by setCacheDirectory method, - * or null. + * @return the File object which is set by setCacheDirectory method, or + * null. */ public static File getCacheDirectory() { // TODO implement - //-- null indicates system-dep default temporary directory + // -- null indicates system-dep default temporary directory return null; } /** - * Creates an ImageInputStream from the specified Object. - * The specified Object should obtain the input source - * such as File, or InputStream. - * - * @param input the input Object such as File, or InputStream. + * Creates an ImageInputStream from the specified Object. The specified + * Object should obtain the input source such as File, or InputStream. * + * @param input + * the input Object such as File, or InputStream. * @return the ImageInputStream object, or null. - * - * @throws IOException signals that an I/O exception has occurred. + * @throws IOException + * if an I/O exception has occurred. */ - public static ImageInputStream createImageInputStream(Object input) - throws IOException { + public static ImageInputStream createImageInputStream(Object input) throws IOException { if (input == null) { throw new IllegalArgumentException("input source cannot be NULL"); } - Iterator it = registry.getServiceProviders(ImageInputStreamSpi.class, true); + Iterator it = registry.getServiceProviders(ImageInputStreamSpi.class, + true); while (it.hasNext()) { ImageInputStreamSpi spi = it.next(); @@ -132,23 +136,22 @@ public final class ImageIO { } /** - * Creates an ImageOutputStream using the specified Object. - * The specified Object should obtain the output source - * such as File, or OutputStream. - * - * @param output the output Object such as File, or OutputStream. + * Creates an ImageOutputStream using the specified Object. The specified + * Object should obtain the output source such as File, or OutputStream. * + * @param output + * the output Object such as File, or OutputStream. * @return the ImageOutputStream object, or null. - * - * @throws IOException signals that an I/O exception has occurred. + * @throws IOException + * if an I/O exception has occurred. */ - public static ImageOutputStream createImageOutputStream(Object output) - throws IOException { + public static ImageOutputStream createImageOutputStream(Object output) throws IOException { if (output == null) { throw new IllegalArgumentException("output destination cannot be NULL"); } - Iterator it = registry.getServiceProviders(ImageOutputStreamSpi.class, true); + Iterator it = registry.getServiceProviders( + ImageOutputStreamSpi.class, true); while (it.hasNext()) { ImageOutputStreamSpi spi = it.next(); @@ -161,8 +164,8 @@ public final class ImageIO { } /** - * Gets the array of format names as String which can be - * decoded by registered ImageReader objects. + * Gets the array of format names as String which can be decoded by + * registered ImageReader objects. * * @return the array of format names. */ @@ -171,8 +174,8 @@ public final class ImageIO { } /** - * Gets the array of MIME types as String which can be - * decoded by registered ImageReader objects. + * Gets the array of MIME types as String which can be decoded by registered + * ImageReader objects. * * @return the array of MIME types. */ @@ -181,13 +184,13 @@ public final class ImageIO { } /** - * Gets the Iterator of registered ImageReader which are able to - * decode an imput data specified by input Object. - * - * @param input the input Object with encoded data such as - * ImageInputStream object. + * Gets the Iterator of registered ImageReader which are able to decode an + * input data specified by input Object. * - * @return the Iterator of registered ImageReader. + * @param input + * the input Object with encoded data such as ImageInputStream + * object. + * @return the Iterator of registered ImageReader. */ public static Iterator getImageReaders(Object input) { if (input == null) { @@ -201,11 +204,11 @@ public final class ImageIO { } /** - * Gets the Iterator of registered ImageReader which are able to - * decode the specified format. - * - * @param formatName the format name such as "jpeg", or "gif". + * Gets the Iterator of registered ImageReader which are able to decode the + * specified format. * + * @param formatName + * the format name such as "jpeg", or "gif". * @return the Iterator of registered ImageReader. */ public static Iterator getImageReadersByFormatName(String formatName) { @@ -220,11 +223,11 @@ public final class ImageIO { } /** - * Gets the Iterator which lists the registered ImageReader objects that - * are able to decode files with the specified suffix. - * - * @param fileSuffix the file suffix such as "jpg". + * Gets the Iterator which lists the registered ImageReader objects that are + * able to decode files with the specified suffix. * + * @param fileSuffix + * the file suffix such as "jpg". * @return the Iterator of registered ImageReaders. */ public static Iterator getImageReadersBySuffix(String fileSuffix) { @@ -238,11 +241,11 @@ public final class ImageIO { } /** - * Gets the Iterator of registered ImageReader objects that - * are able to decode files with the specified MIME type. - * - * @param MIMEType the MIME type such as "image/jpeg". + * Gets the Iterator of registered ImageReader objects that are able to + * decode files with the specified MIME type. * + * @param MIMEType + * the MIME type such as "image/jpeg". * @return the Iterator of registered ImageReaders. */ public static Iterator getImageReadersByMIMEType(String MIMEType) { @@ -250,8 +253,8 @@ public final class ImageIO { } /** - * Gets an array of Strings giving the names of the formats supported - * by registered ImageWriter objects. + * Gets an array of Strings giving the names of the formats supported by + * registered ImageWriter objects. * * @return the array of format names. */ @@ -260,7 +263,7 @@ public final class ImageIO { } /** - * Gets an array of Strings giving the MIME types of the formats supported + * Gets an array of Strings giving the MIME types of the formats supported * by registered ImageWriter objects. * * @return the array of MIME types. @@ -270,11 +273,11 @@ public final class ImageIO { } /** - * Gets the Iterator which lists the registered ImageReader objects that - * are able to encode the specified image format. - * - * @param formatName the image format name such as "jpeg". + * Gets the Iterator which lists the registered ImageReader objects that are + * able to encode the specified image format. * + * @param formatName + * the image format name such as "jpeg". * @return the Iterator of registered ImageWriter. */ public static Iterator getImageWritersByFormatName(String formatName) { @@ -289,11 +292,11 @@ public final class ImageIO { } /** - * Gets the Iterator which lists the registered ImageReader objects that - * are able to encode the specified suffix. - * - * @param fileSuffix the file suffix such as "jpg". + * Gets the Iterator which lists the registered ImageReader objects that are + * able to encode the specified suffix. * + * @param fileSuffix + * the file suffix such as "jpg". * @return the Iterator of registered ImageWriter. */ public static Iterator getImageWritersBySuffix(String fileSuffix) { @@ -306,11 +309,11 @@ public final class ImageIO { } /** - * Gets the Iterator which lists the registered ImageReader objects that - * are able to encode the specified MIME type. - * - * @param MIMEType the MIME type such as "image/jpeg". + * Gets the Iterator which lists the registered ImageReader objects that are + * able to encode the specified MIME type. * + * @param MIMEType + * the MIME type such as "image/jpeg". * @return the Iterator of registered ImageWriter. */ public static Iterator getImageWritersByMIMEType(String MIMEType) { @@ -318,12 +321,12 @@ public final class ImageIO { } /** - * Gets an ImageWriter object which corresponds to the - * specified ImageReader, or returns null if the specified - * ImageReader is not registered. - * - * @param reader the specified ImageReader. + * Gets an ImageWriter object which corresponds to the specified + * ImageReader, or returns null if the specified ImageReader is not + * registered. * + * @param reader + * the specified ImageReader. * @return the ImageWriter, or null. */ public static ImageWriter getImageWriter(ImageReader reader) { @@ -331,12 +334,12 @@ public final class ImageIO { } /** - * Gets an ImageReader object which corresponds to the - * specified ImageWriter, or returns null if the specified - * ImageWriter is not registered. - * - * @param writer the registered ImageWriter object. + * Gets an ImageReader object which corresponds to the specified + * ImageWriter, or returns null if the specified ImageWriter is not + * registered. * + * @param writer + * the registered ImageWriter object. * @return the ImageReader. */ public static ImageReader getImageReader(ImageWriter writer) { @@ -344,17 +347,16 @@ public final class ImageIO { } /** - * Gets the Iterator of ImageWriter objects which are able to - * encode images with the specified ImageTypeSpecifier and - * format. - * - * @param type the ImageTypeSpecifier, which defines layout. - * @param formatName the format name. + * Gets the Iterator of ImageWriter objects which are able to encode images + * with the specified ImageTypeSpecifier and format. * + * @param type + * the ImageTypeSpecifier, which defines layout. + * @param formatName + * the format name. * @return the Iterator of ImageWriter objects. */ - public static Iterator getImageWriters(ImageTypeSpecifier type, - String formatName) { + public static Iterator getImageWriters(ImageTypeSpecifier type, String formatName) { if (type == null) { throw new NullPointerException("type cannot be NULL"); } @@ -370,31 +372,31 @@ public final class ImageIO { } /** - * Gets the Iterator of registered ImageTranscoders which - * are able to transcode the metadata of the specified - * ImageReader object to a suitable object for encoding - * by the specified ImageWriter. - * - * @param reader the specified ImageReader. - * @param writer the specified ImageWriter. + * Gets the Iterator of registered ImageTranscoders which are able to + * transcode the metadata of the specified ImageReader object to a suitable + * object for encoding by the specified ImageWriter. * + * @param reader + * the specified ImageReader. + * @param writer + * the specified ImageWriter. * @return the Iterator of registered ImageTranscoders. */ public static Iterator getImageTranscoders(ImageReader reader, - ImageWriter writer) { + ImageWriter writer) { throw new UnsupportedOperationException("Not supported yet"); } /** - * Reads image data from the specified File and decodes it using - * the appropriate registered ImageReader object. - * The File is wrapped in an ImageInputStream. - * - * @param input the File to be read. + * Reads image data from the specified File and decodes it using the + * appropriate registered ImageReader object. The File is wrapped in an + * ImageInputStream. * + * @param input + * the File to be read. * @return the BufferedImage decoded from the specified File, or null. - * - * @throws IOException Signals that an I/O exception has occurred. + * @throws IOException + * if an I/O exception has occurred. */ public static BufferedImage read(File input) throws IOException { if (input == null) { @@ -406,15 +408,15 @@ public final class ImageIO { } /** - * Reads image data from the specified InputStream and decodes it - * using an appropriate registered an ImageReader object. + * Reads image data from the specified InputStream and decodes it using an + * appropriate registered an ImageReader object. * - * @param input the InputStream. - * - * @return the BufferedImage decoded from the specified InputStream, - * or null. - * - * @throws IOException Signals that an I/O exception has occurred. + * @param input + * the InputStream. + * @return the BufferedImage decoded from the specified InputStream, or + * null. + * @throws IOException + * if an I/O exception has occurred. */ public static BufferedImage read(InputStream input) throws IOException { if (input == null) { @@ -426,14 +428,14 @@ public final class ImageIO { } /** - * Reads image data from the specified URL and decodes it using - * the appropriate registered ImageReader object. - * - * @param input the URL to be read. + * Reads image data from the specified URL and decodes it using the + * appropriate registered ImageReader object. * + * @param input + * the URL to be read. * @return the BufferedImage decoded from the specified URL, or null. - * - * @throws IOException Signals that an I/O exception has occurred. + * @throws IOException + * if an I/O exception has occurred. */ public static BufferedImage read(URL input) throws IOException { if (input == null) { @@ -443,20 +445,20 @@ public final class ImageIO { InputStream stream = input.openStream(); BufferedImage res = read(stream); stream.close(); - + return res; } /** - * Reads image data from the specified ImageInputStream and decodes it - * using appropriate registered an ImageReader object. - * - * @param stream the ImageInputStream. + * Reads image data from the specified ImageInputStream and decodes it using + * appropriate registered an ImageReader object. * - * @return the BufferedImage decoded from the specified ImageInputStream, - * or null. - * - * @throws IOException Signals that an I/O exception has occurred. + * @param stream + * the ImageInputStream. + * @return the BufferedImage decoded from the specified ImageInputStream, or + * null. + * @throws IOException + * if an I/O exception has occurred. */ public static BufferedImage read(ImageInputStream stream) throws IOException { if (stream == null) { @@ -478,25 +480,25 @@ public final class ImageIO { } catch (IOException e) { // Stream could be already closed, proceed silently in this case } - + return res; } /** - * Writes the specified image in the specified format (using an - * appropriate ImageWriter) to the specified ImageOutputStream. - * - * @param im the RenderedImage. - * @param formatName the format name. - * @param output the ImageOutputStream where Image to be written. + * Writes the specified image in the specified format (using an appropriate + * ImageWriter) to the specified ImageOutputStream. * + * @param im + * the RenderedImage. + * @param formatName + * the format name. + * @param output + * the ImageOutputStream where Image to be written. * @return true, if Image is written successfully, false otherwise. - * - * @throws IOException Signals that an I/O exception has occurred. + * @throws IOException + * if an I/O exception has occurred. */ - public static boolean write(RenderedImage im, - String formatName, - ImageOutputStream output) + public static boolean write(RenderedImage im, String formatName, ImageOutputStream output) throws IOException { if (im == null) { @@ -509,7 +511,8 @@ public final class ImageIO { throw new IllegalArgumentException("output cannot be NULL"); } - Iterator it = getImageWriters(ImageTypeSpecifier.createFromRenderedImage(im), formatName); + Iterator it = getImageWriters(ImageTypeSpecifier.createFromRenderedImage(im), + formatName); if (it.hasNext()) { ImageWriter writer = it.next(); writer.setOutput(output); @@ -522,20 +525,20 @@ public final class ImageIO { } /** - * Writes the specified image in the specified format (using an - * appropriate ImageWriter) to the specified File. - * - * @param im the RenderedImage. - * @param formatName the format name. - * @param output the output File where Image to be written. + * Writes the specified image in the specified format (using an appropriate + * ImageWriter) to the specified File. * + * @param im + * the RenderedImage. + * @param formatName + * the format name. + * @param output + * the output File where Image to be written. * @return true, if Image is written successfully, false otherwise. - * - * @throws IOException Signals that an I/O exception has occurred. + * @throws IOException + * if an I/O exception has occurred. */ - public static boolean write(RenderedImage im, - String formatName, - File output) + public static boolean write(RenderedImage im, String formatName, File output) throws IOException { if (output == null) { @@ -553,20 +556,20 @@ public final class ImageIO { } /** - * Writes the specified image in the specified format (using an - * appropriate ImageWriter) to the specified OutputStream. - * - * @param im the RenderedImage. - * @param formatName the format name. - * @param output the OutputStream where Image is to be written. + * Writes the specified image in the specified format (using an appropriate + * ImageWriter) to the specified OutputStream. * + * @param im + * the RenderedImage. + * @param formatName + * the format name. + * @param output + * the OutputStream where Image is to be written. * @return true, if Image is written successfully, false otherwise. - * - * @throws IOException Signals that an I/O exception has occurred. + * @throws IOException + * if an I/O exception has occurred. */ - public static boolean write(RenderedImage im, - String formatName, - OutputStream output) + public static boolean write(RenderedImage im, String formatName, OutputStream output) throws IOException { if (output == null) { @@ -579,26 +582,28 @@ public final class ImageIO { return rt; } - /** * Filter to match spi by format name. */ static class FormatFilter implements ServiceRegistry.Filter { - - /** The name. */ + + /** + * The name. + */ private String name; /** * Instantiates a new format filter. * - * @param name the name + * @param name + * the name. */ public FormatFilter(String name) { this.name = name; } public boolean filter(Object provider) { - ImageReaderWriterSpi spi = (ImageReaderWriterSpi) provider; + ImageReaderWriterSpi spi = (ImageReaderWriterSpi)provider; return Arrays.asList(spi.getFormatNames()).contains(name); } } @@ -608,14 +613,18 @@ public final class ImageIO { */ static class FormatAndEncodeFilter extends FormatFilter { - /** The type. */ + /** + * The type. + */ private ImageTypeSpecifier type; /** * Instantiates a new format and encode filter. * - * @param type the type - * @param name the name + * @param type + * the type. + * @param name + * the name. */ public FormatAndEncodeFilter(ImageTypeSpecifier type, String name) { super(name); @@ -624,7 +633,7 @@ public final class ImageIO { @Override public boolean filter(Object provider) { - ImageWriterSpi spi = (ImageWriterSpi) provider; + ImageWriterSpi spi = (ImageWriterSpi)provider; return super.filter(provider) && spi.canEncodeImage(type); } } @@ -633,21 +642,24 @@ public final class ImageIO { * Filter to match spi by suffix. */ static class SuffixFilter implements ServiceRegistry.Filter { - - /** The suf. */ + + /** + * The suf. + */ private String suf; /** * Instantiates a new suffix filter. * - * @param suf the suf + * @param suf + * the suf. */ public SuffixFilter(String suf) { this.suf = suf; } public boolean filter(Object provider) { - ImageReaderWriterSpi spi = (ImageReaderWriterSpi) provider; + ImageReaderWriterSpi spi = (ImageReaderWriterSpi)provider; return Arrays.asList(spi.getFileSuffixes()).contains(suf); } } @@ -656,21 +668,24 @@ public final class ImageIO { * Filter to match spi by decoding possibility. */ static class CanReadFilter implements ServiceRegistry.Filter { - - /** The input. */ + + /** + * The input. + */ private Object input; /** * Instantiates a new can read filter. * - * @param input the input + * @param input + * the input. */ public CanReadFilter(Object input) { this.input = input; } public boolean filter(Object provider) { - ImageReaderSpi spi = (ImageReaderSpi) provider; + ImageReaderSpi spi = (ImageReaderSpi)provider; try { return spi.canDecodeInput(input); } catch (IOException e) { @@ -684,13 +699,16 @@ public final class ImageIO { */ static class SpiIteratorToWritersIteratorWrapper implements Iterator { - /** The backend. */ + /** + * The backend. + */ private Iterator backend; /** * Instantiates a new spi iterator to writers iterator wrapper. * - * @param backend the backend + * @param backend + * the backend. */ public SpiIteratorToWritersIteratorWrapper(Iterator backend) { this.backend = backend; @@ -699,7 +717,7 @@ public final class ImageIO { /** * Next. * - * @return the image writer + * @return the image writer. */ public ImageWriter next() { try { @@ -713,7 +731,7 @@ public final class ImageIO { /** * Checks for next. * - * @return true, if successful + * @return true, if successful. */ public boolean hasNext() { return backend.hasNext(); @@ -723,7 +741,8 @@ public final class ImageIO { * Removes the. */ public void remove() { - throw new UnsupportedOperationException("Use deregisterServiceprovider instead of Iterator.remove()"); + throw new UnsupportedOperationException( + "Use deregisterServiceprovider instead of Iterator.remove()"); } } @@ -731,14 +750,17 @@ public final class ImageIO { * Wraps spi's iterator to ImageReader iterator. */ static class SpiIteratorToReadersIteratorWrapper implements Iterator { - - /** The backend. */ + + /** + * The backend. + */ private Iterator backend; /** * Instantiates a new spi iterator to readers iterator wrapper. * - * @param backend the backend + * @param backend + * the backend. */ public SpiIteratorToReadersIteratorWrapper(Iterator backend) { this.backend = backend; @@ -747,7 +769,7 @@ public final class ImageIO { /** * Next. * - * @return the image reader + * @return the image reader. */ public ImageReader next() { try { @@ -761,7 +783,7 @@ public final class ImageIO { /** * Checks for next. * - * @return true, if successful + * @return true, if successful. */ public boolean hasNext() { return backend.hasNext(); @@ -771,7 +793,8 @@ public final class ImageIO { * Removes the. */ public void remove() { - throw new UnsupportedOperationException("Use deregisterServiceprovider instead of Iterator.remove()"); + throw new UnsupportedOperationException( + "Use deregisterServiceprovider instead of Iterator.remove()"); } } } diff --git a/awt/javax/imageio/ImageReadParam.java b/awt/javax/imageio/ImageReadParam.java index e67ed7d91edde..9cc5c5f1b11dd 100644 --- a/awt/javax/imageio/ImageReadParam.java +++ b/awt/javax/imageio/ImageReadParam.java @@ -18,6 +18,7 @@ * @author Sergey I. Salishev * @version $Revision: 1.2 $ */ + package javax.imageio; import java.awt.Dimension; @@ -29,45 +30,50 @@ import java.awt.image.BufferedImage; */ /** - * The ImageReadParam class provides information to the ImageReader about - * how an image is to be decoded. + * The ImageReadParam class provides information to the ImageReader about how an + * image is to be decoded. + * + * @since Android 1.0 */ - public class ImageReadParam extends IIOParam { - /** - * This flag indicates if this ImageReadParam supports setting the source - * rendering size. + /** + * This flag indicates if this ImageReadParam supports setting the source + * rendering size. */ protected boolean canSetSourceRenderSize; - - /** - * The destination BufferedImage. + + /** + * The destination BufferedImage. */ protected BufferedImage destination; - - /** The destination bands. */ + + /** + * The destination bands. + */ protected int[] destinationBands; - - /** - * The minimum progressive pass. + + /** + * The minimum progressive pass. */ protected int minProgressivePass; - - /** - * The number of progressive passes. + + /** + * The number of progressive passes. */ protected int numProgressivePasses; - - /** The source render size. */ + + /** + * The source render size. + */ protected Dimension sourceRenderSize; /** - * Returns true if this ImageReaderParam supports rendering a - * source image at an arbitrary size. + * Returns true if this ImageReaderParam supports rendering a source image + * at an arbitrary size. * - * @return true if this ImageReaderParam supports rendering a - * source image at an arbitrary size, false otherwise. + * @return true, if this ImageReaderParam supports rendering a source image + * at an arbitrary size, false otherwise. */ public boolean canSetSourceRenderSize() { return canSetSourceRenderSize; @@ -92,11 +98,9 @@ public class ImageReadParam extends IIOParam { } /** - * Gets the index of the maximum pass to be decoded. - * This method returns Integer.MAX_VALUE, if - * getSourceNumProgressivePasses() method returns value - * that is equal to Integer.MAX_VALUE. Otherwise - * this method returns + * Gets the index of the maximum pass to be decoded. This method returns + * Integer.MAX_VALUE, if getSourceNumProgressivePasses() method returns + * value that is equal to Integer.MAX_VALUE. Otherwise this method returns * getSourceMinProgressivePass() + getSourceNumProgressivePasses() - 1. * * @return the index of the maximum pass to be decoded. @@ -109,19 +113,19 @@ public class ImageReadParam extends IIOParam { } /** - * Gets the index of the minimum progressive pass that is decoded, - * default is 0. + * Gets the index of the minimum progressive pass that is decoded, default + * is 0. * * @return the index of the minimum progressive pass that is decoded, - * default is 0. + * default is 0. */ public int getSourceMinProgressivePass() { return minProgressivePass; } /** - * Gets the number of progressive passes. - * The default value is Integer.MAX_VALUE. + * Gets the number of progressive passes. The default value is + * Integer.MAX_VALUE. * * @return the number of progressive passes. */ @@ -130,8 +134,8 @@ public class ImageReadParam extends IIOParam { } /** - * Gets the dimension of source image which will be rendered - * during decoding process. + * Gets the dimension of source image which will be rendered during decoding + * process. * * @return the source render size. */ @@ -140,11 +144,12 @@ public class ImageReadParam extends IIOParam { } /** - * Sets the specified destination image. - * This image will be used by read, readAll, and readRaster methods, - * and a reference to it will be returned by those methods. + * Sets the specified destination image. This image will be used by read, + * readAll, and readRaster methods, and a reference to it will be returned + * by those methods. * - * @param destination the destination image. + * @param destination + * the destination image. */ public void setDestination(BufferedImage destination) { this.destination = destination; @@ -153,7 +158,8 @@ public class ImageReadParam extends IIOParam { /** * Sets the indices of the destination bands. * - * @param destinationBands the indices of the destination bands. + * @param destinationBands + * the indices of the destination bands. */ public void setDestinationBands(int[] destinationBands) { this.destinationBands = destinationBands; @@ -167,8 +173,10 @@ public class ImageReadParam extends IIOParam { /** * Sets the source progressive passes. * - * @param minPass the index of the minimum pass to be decoded. - * @param numPasses the number of passes to be decoded. + * @param minPass + * the index of the minimum pass to be decoded. + * @param numPasses + * the number of passes to be decoded. */ public void setSourceProgressivePasses(int minPass, int numPasses) { minProgressivePass = minPass; @@ -176,18 +184,18 @@ public class ImageReadParam extends IIOParam { } /** - * Sets the dimension size of source image if an - * image can be rendered at an arbitrary size. + * Sets the dimension size of source image if an image can be rendered at an + * arbitrary size. * - * @param size the size of rendered image. - * - * @throws UnsupportedOperationException the unsupported operation exception + * @param size + * the size of rendered image. + * @throws UnsupportedOperationException + * the unsupported operation exception. */ public void setSourceRenderSize(Dimension size) throws UnsupportedOperationException { if (!canSetSourceRenderSize) { throw new UnsupportedOperationException("can't set source renderer size"); } - sourceRenderSize = size; + sourceRenderSize = size; } } - diff --git a/awt/javax/imageio/ImageReader.java b/awt/javax/imageio/ImageReader.java index 780de266a3718..cf282ed2a82af 100644 --- a/awt/javax/imageio/ImageReader.java +++ b/awt/javax/imageio/ImageReader.java @@ -18,6 +18,7 @@ * @author Rustem V. Rafikov * @version $Revision: 1.3 $ */ + package javax.imageio; import javax.imageio.spi.ImageReaderSpi; @@ -37,56 +38,77 @@ import java.awt.image.RenderedImage; import java.awt.*; /** - * The ImageReader class is an abstract class for decoding images. - * ImageReader objects are instantiated by the service provider - * interface, ImageReaderSpi class, for the specific format. - * ImageReaderSpi class should be registered with the IIORegistry, - * which uses them for format recognition and presentation of available - * format readers and writers. + * The ImageReader class is an abstract class for decoding images. ImageReader + * objects are instantiated by the service provider interface, ImageReaderSpi + * class, for the specific format. ImageReaderSpi class should be registered + * with the IIORegistry, which uses them for format recognition and presentation + * of available format readers and writers. + * + * @since Android 1.0 */ public abstract class ImageReader { - /** The originating provider. */ + /** + * The originating provider. + */ protected ImageReaderSpi originatingProvider; - /** The input object such as ImageInputStream. */ + /** + * The input object such as ImageInputStream. + */ protected Object input; - /** The seek forward only. */ + /** + * The seek forward only. + */ protected boolean seekForwardOnly; - /** - * The ignore metadata flag indicates whether current input source - * has been marked as metadata is allowed to be ignored by setInput. + /** + * The ignore metadata flag indicates whether current input source has been + * marked as metadata is allowed to be ignored by setInput. */ protected boolean ignoreMetadata; - /** The minimum index. */ + /** + * The minimum index. + */ protected int minIndex; - /** The available locales. */ + /** + * The available locales. + */ protected Locale[] availableLocales; - /** The locale. */ + /** + * The locale. + */ protected Locale locale; - /** The list of warning listeners. */ + /** + * The list of warning listeners. + */ protected List warningListeners; - /** The list of warning locales. */ + /** + * The list of warning locales. + */ protected List warningLocales; - /** The list of progress listeners. */ + /** + * The list of progress listeners. + */ protected List progressListeners; - /** The list of update listeners. */ + /** + * The list of update listeners. + */ protected List updateListeners; /** * Instantiates a new ImageReader. * - * @param originatingProvider the ImageReaderSpi which - * instanties this ImageReader. + * @param originatingProvider + * the ImageReaderSpi which instantiates this ImageReader. */ protected ImageReader(ImageReaderSpi originatingProvider) { this.originatingProvider = originatingProvider; @@ -96,15 +118,15 @@ public abstract class ImageReader { * Gets the format name of this input source. * * @return the format name of this input source. - * - * @throws IOException Signals that an I/O exception has occurred. + * @throws IOException + * if an I/O exception has occurred. */ public String getFormatName() throws IOException { return originatingProvider.getFormatNames()[0]; } /** - * Gets the ImageReaderSpi which instantiated this ImageReader. + * Gets the ImageReaderSpi which instantiated this ImageReader. * * @return the ImageReaderSpi. */ @@ -113,14 +135,17 @@ public abstract class ImageReader { } /** - * Sets the specified Object as the input source of this ImageReader. + * Sets the specified Object as the input source of this ImageReader. * - * @param input the input source, it can - * be an ImageInputStream or other supported objects. - * @param seekForwardOnly indicates whether the stream must - * be read sequentially from its current starting point. - * @param ignoreMetadata parameter which indicates - * if metadata may be ignored during reads or not. + * @param input + * the input source, it can be an ImageInputStream or other + * supported objects. + * @param seekForwardOnly + * indicates whether the stream must be read sequentially from + * its current starting point. + * @param ignoreMetadata + * parameter which indicates if metadata may be ignored during + * reads or not. */ public void setInput(Object input, boolean seekForwardOnly, boolean ignoreMetadata) { if (input != null) { @@ -137,9 +162,9 @@ public abstract class ImageReader { /** * Checks if is supported. * - * @param input the input - * - * @return true, if is supported + * @param input + * the input. + * @return true, if is supported. */ private boolean isSupported(Object input) { ImageReaderSpi spi = getOriginatingProvider(); @@ -158,10 +183,12 @@ public abstract class ImageReader { * Sets the specified Object as the input source of this ImageReader. * Metadata is not ignored. * - * @param input the input source, it can - * be an ImageInputStream or other supported objects. - * @param seekForwardOnly indicates whether the stream must - * be read sequentially from its current starting point. + * @param input + * the input source, it can be an ImageInputStream or other + * supported objects. + * @param seekForwardOnly + * indicates whether the stream must be read sequentially from + * its current starting point. */ public void setInput(Object input, boolean seekForwardOnly) { setInput(input, seekForwardOnly, false); @@ -171,8 +198,8 @@ public abstract class ImageReader { * Sets the specified Object as the input source of this ImageReader. * Metadata is not ignored and forward seeking is not required. * - * @param input the input source, it can - * be ImageInputStream or other objects. + * @param input + * the input source, it can be ImageInputStream or other objects. */ public void setInput(Object input) { setInput(input, false, false); @@ -181,8 +208,7 @@ public abstract class ImageReader { /** * Gets the input source object of this ImageReader, or returns null. * - * @return the the input source object such as ImageInputStream, - * or null. + * @return the input source object such as ImageInputStream, or null. */ public Object getInput() { return input; @@ -191,32 +217,31 @@ public abstract class ImageReader { /** * Checks if the input source supports only forward reading, or not. * - * @return true, if the input source supports only forward reading, - * false otherwise. + * @return true, if the input source supports only forward reading, false + * otherwise. */ public boolean isSeekForwardOnly() { return seekForwardOnly; } /** - * Returns true if the current input source allows - * to metadata to be ignored by passing true as - * the ignoreMetadata argument to the setInput method. + * Returns true if the current input source allows to metadata to be ignored + * by passing true as the ignoreMetadata argument to the setInput method. * - * @return true, if true if the current input source allows - * to metadata to be ignored by passing true as - * the ignoreMetadata argument to the setInput method. + * @return true, if the current input source allows to metadata to be + * ignored by passing true as the ignoreMetadata argument to the + * setInput method. */ public boolean isIgnoringMetadata() { return ignoreMetadata; } /** - * Gets the minimum valid index for reading an image, thumbnail, - * or image metadata. + * Gets the minimum valid index for reading an image, thumbnail, or image + * metadata. * - * @return the minimum valid index for reading an image, thumbnail, - * or image metadata. + * @return the minimum valid index for reading an image, thumbnail, or image + * metadata. */ public int getMinIndex() { return minIndex; @@ -234,7 +259,8 @@ public abstract class ImageReader { /** * Sets the locale to this ImageReader. * - * @param locale the Locale. + * @param locale + * the Locale. */ public void setLocale(Locale locale) { throw new UnsupportedOperationException("Not implemented yet"); @@ -252,89 +278,88 @@ public abstract class ImageReader { /** * Gets the number of images available in the current input source. * - * @param allowSearch the parameter which indicates what - * a search is required; if false, the reader may return -1 - * without searching. - * + * @param allowSearch + * the parameter which indicates what a search is required; if + * false, the reader may return -1 without searching. * @return the number of images. - * - * @throws IOException Signals that an I/O exception has occurred. + * @throws IOException + * if an I/O exception has occurred. */ public abstract int getNumImages(boolean allowSearch) throws IOException; /** * Gets the width of the specified image in input source. * - * @param imageIndex the image index. - * + * @param imageIndex + * the image index. * @return the width in pixels. - * - * @throws IOException Signals that an I/O exception has occurred. + * @throws IOException + * if an I/O exception has occurred. */ public abstract int getWidth(int imageIndex) throws IOException; /** * Gets the height of the specified image in input source. * - * @param imageIndex the image index. - * + * @param imageIndex + * the image index. * @return the height in pixels. - * - * @throws IOException Signals that an I/O exception has occurred. + * @throws IOException + * if an I/O exception has occurred. */ public abstract int getHeight(int imageIndex) throws IOException; /** - * Checks if the storage format of the specified image places - * an impediment on random pixels access or not. - * - * @param imageIndex the image's index. - * - * @return true, if the storage format of the specified image places - * an impediment on random pixels access, false otherwise. + * Checks if the storage format of the specified image places an impediment + * on random pixels access or not. * - * @throws IOException Signals that an I/O exception has occurred. + * @param imageIndex + * the image's index. + * @return true, if the storage format of the specified image places an + * impediment on random pixels access, false otherwise. + * @throws IOException + * if an I/O exception has occurred. */ public boolean isRandomAccessEasy(int imageIndex) throws IOException { - return false; //def + return false; // def } /** * Gets the aspect ratio (width devided by height) of the image. * - * @param imageIndex the image index. - * + * @param imageIndex + * the image index. * @return the aspect ratio of the image. - * - * @throws IOException Signals that an I/O exception has occurred. + * @throws IOException + * if an I/O exception has occurred. */ public float getAspectRatio(int imageIndex) throws IOException { - return (float) getWidth(imageIndex) / getHeight(imageIndex); + return (float)getWidth(imageIndex) / getHeight(imageIndex); } /** - * Gets an ImageTypeSpecifier which indicates the type of the - * specified image. - * - * @param imageIndex the image's index. + * Gets an ImageTypeSpecifier which indicates the type of the specified + * image. * + * @param imageIndex + * the image's index. * @return the ImageTypeSpecifier. - * - * @throws IOException Signals that an I/O exception has occurred. + * @throws IOException + * if an I/O exception has occurred. */ public ImageTypeSpecifier getRawImageType(int imageIndex) throws IOException { throw new UnsupportedOperationException("Not implemented yet"); } /** - * Gets an Iterator of ImageTypeSpecifier objects which are associated - * with image types that may be used when decoding specified image. - * - * @param imageIndex the image index. + * Gets an Iterator of ImageTypeSpecifier objects which are associated with + * image types that may be used when decoding specified image. * + * @param imageIndex + * the image index. * @return an Iterator of ImageTypeSpecifier objects. - * - * @throws IOException Signals that an I/O exception has occurred. + * @throws IOException + * if an I/O exception has occurred. */ public abstract Iterator getImageTypes(int imageIndex) throws IOException; @@ -351,21 +376,22 @@ public abstract class ImageReader { * Gets an IIOMetadata object for this input source. * * @return the IIOMetadata. - * - * @throws IOException Signals that an I/O exception has occurred. + * @throws IOException + * if an I/O exception has occurred. */ public abstract IIOMetadata getStreamMetadata() throws IOException; /** * Gets an IIOMetadata object for this input source. * - * @param formatName the desired metadata format to be used in the - * returned IIOMetadata object. - * @param nodeNames the node names of the document. - * + * @param formatName + * the desired metadata format to be used in the returned + * IIOMetadata object. + * @param nodeNames + * the node names of the document. * @return the IIOMetadata. - * - * @throws IOException Signals that an I/O exception has occurred. + * @throws IOException + * if an I/O exception has occurred. */ public IIOMetadata getStreamMetadata(String formatName, Set nodeNames) throws IOException { @@ -375,83 +401,86 @@ public abstract class ImageReader { /** * Gets the image metadata of the specified image in input source. * - * @param imageIndex the image index. - * + * @param imageIndex + * the image index. * @return the IIOMetadata. - * - * @throws IOException Signals that an I/O exception has occurred. + * @throws IOException + * if an I/O exception has occurred. */ public abstract IIOMetadata getImageMetadata(int imageIndex) throws IOException; /** * Gets the image metadata of the specified image input source. * - * @param imageIndex the image index. - * @param formatName the desired metadata format to be used in the - * returned IIOMetadata object. - * @param nodeNames the node names which can be contained in - * the document. - * + * @param imageIndex + * the image index. + * @param formatName + * the desired metadata format to be used in the returned + * IIOMetadata object. + * @param nodeNames + * the node names which can be contained in the document. * @return the IIOMetadata. - * - * @throws IOException Signals that an I/O exception has occurred. + * @throws IOException + * if an I/O exception has occurred. */ - public IIOMetadata getImageMetadata(int imageIndex, String formatName, - Set nodeNames) throws IOException { + public IIOMetadata getImageMetadata(int imageIndex, String formatName, Set nodeNames) + throws IOException { throw new UnsupportedOperationException("Not implemented yet"); } /** - * Reads the specified image and returns it as a BufferedImage - * using the default ImageReadParam. - * - * @param imageIndex the image index. + * Reads the specified image and returns it as a BufferedImage using the + * default ImageReadParam. * + * @param imageIndex + * the image index. * @return the BufferedImage. - * - * @throws IOException Signals that an I/O exception has occurred. + * @throws IOException + * if an I/O exception has occurred. */ public BufferedImage read(int imageIndex) throws IOException { return read(imageIndex, null); } /** - * Reads the specified image and returns it as a BufferedImage - * using the specified ImageReadParam. - * - * @param imageIndex the image index. - * @param param the ImageReadParam. + * Reads the specified image and returns it as a BufferedImage using the + * specified ImageReadParam. * + * @param imageIndex + * the image index. + * @param param + * the ImageReadParam. * @return the BufferedImage. - * - * @throws IOException Signals that an I/O exception has occurred. + * @throws IOException + * if an I/O exception has occurred. */ public abstract BufferedImage read(int imageIndex, ImageReadParam param) throws IOException; /** * Reads the specified image and returns an IIOImage with this image, - * thumbnails, and metadata for this image, using - * the specified ImageReadParam. - * - * @param imageIndex the image index. - * @param param the ImageReadParam. + * thumbnails, and metadata for this image, using the specified + * ImageReadParam. * + * @param imageIndex + * the image index. + * @param param + * the ImageReadParam. * @return the IIOImage. - * - * @throws IOException Signals that an I/O exception has occurred. + * @throws IOException + * if an I/O exception has occurred. */ public IIOImage readAll(int imageIndex, ImageReadParam param) throws IOException { throw new UnsupportedOperationException("Not implemented yet"); } /** - * Returns an Iterator of IIOImages from the input source. - * - * @param params the Iterator of ImageReadParam objects. + * Returns an Iterator of IIOImages from the input source. * + * @param params + * the Iterator of ImageReadParam objects. * @return the iterator of IIOImages. - * - * @throws IOException Signals that an I/O exception has occurred. + * @throws IOException + * if an I/O exception has occurred. */ public Iterator readAll(Iterator params) throws IOException { throw new UnsupportedOperationException("Not implemented yet"); @@ -460,23 +489,23 @@ public abstract class ImageReader { /** * Checks whether or not this plug-in supports reading a Raster. * - * @return true, if this plug-in supports reading a Raster, - * false otherwise. + * @return true, if this plug-in supports reading a Raster, false otherwise. */ public boolean canReadRaster() { - return false; //def + return false; // def } /** - * Reads a new Raster object which contains the raw pixel data from - * the image. - * - * @param imageIndex the image index. - * @param param the ImageReadParam. + * Reads a new Raster object which contains the raw pixel data from the + * image. * + * @param imageIndex + * the image index. + * @param param + * the ImageReadParam. * @return the Raster. - * - * @throws IOException Signals that an I/O exception has occurred. + * @throws IOException + * if an I/O exception has occurred. */ public Raster readRaster(int imageIndex, ImageReadParam param) throws IOException { throw new UnsupportedOperationException("Unsupported"); @@ -485,220 +514,226 @@ public abstract class ImageReader { /** * Checks if the specified image has tiles or not. * - * @param imageIndex the image's index. - * - * @return true, if the specified image has tiles, - * false otherwise. - * - * @throws IOException Signals that an I/O exception has occurred. + * @param imageIndex + * the image's index. + * @return true, if the specified image has tiles, false otherwise. + * @throws IOException + * if an I/O exception has occurred. */ public boolean isImageTiled(int imageIndex) throws IOException { - return false; //def + return false; // def } /** * Gets the tile width in the specified image. * - * @param imageIndex the image's index. - * + * @param imageIndex + * the image's index. * @return the tile width. - * - * @throws IOException Signals that an I/O exception has occurred. + * @throws IOException + * if an I/O exception has occurred. */ public int getTileWidth(int imageIndex) throws IOException { - return getWidth(imageIndex); //def + return getWidth(imageIndex); // def } /** * Gets the tile height in the specified image. * - * @param imageIndex the image's index. - * + * @param imageIndex + * the image's index. * @return the tile height. - * - * @throws IOException Signals that an I/O exception has occurred. + * @throws IOException + * if an I/O exception has occurred. */ public int getTileHeight(int imageIndex) throws IOException { - return getHeight(imageIndex); //def + return getHeight(imageIndex); // def } /** - * Gets the X coordinate of the upper left corner of the tile grid in the + * Gets the X coordinate of the upper left corner of the tile grid in the * specified image. * - * @param imageIndex the image's index. - * + * @param imageIndex + * the image's index. * @return the X coordinate of the upper left corner of the tile grid. - * - * @throws IOException Signals that an I/O exception has occurred. + * @throws IOException + * if an I/O exception has occurred. */ public int getTileGridXOffset(int imageIndex) throws IOException { - return 0; //def + return 0; // def } /** - * Gets the Y coordinate of the upper left corner of the tile grid in the + * Gets the Y coordinate of the upper left corner of the tile grid in the * specified image. * - * @param imageIndex the image's index. - * + * @param imageIndex + * the image's index. * @return the Y coordinate of the upper left corner of the tile grid. - * - * @throws IOException Signals that an I/O exception has occurred. + * @throws IOException + * if an I/O exception has occurred. */ public int getTileGridYOffset(int imageIndex) throws IOException { - return 0; //def + return 0; // def } /** - * Reads the tile specified by the tileX and tileY parameters - * of the specified image and returns it as a BufferedImage. - * - * @param imageIndex the image index. - * @param tileX the X index of tile. - * @param tileY the Y index of tile. + * Reads the tile specified by the tileX and tileY parameters of the + * specified image and returns it as a BufferedImage. * + * @param imageIndex + * the image index. + * @param tileX + * the X index of tile. + * @param tileY + * the Y index of tile. * @return the BufferedImage. - * - * @throws IOException Signals that an I/O exception has occurred. + * @throws IOException + * if an I/O exception has occurred. */ public BufferedImage readTile(int imageIndex, int tileX, int tileY) throws IOException { throw new UnsupportedOperationException("Not implemented yet"); } /** - * Reads the tile specified by the tileX and tileY parameters - * of the specified image and returns it as a Raster. - * - * @param imageIndex the image index. - * @param tileX the X index of tile. - * @param tileY the Y index of tile. + * Reads the tile specified by the tileX and tileY parameters of the + * specified image and returns it as a Raster. * + * @param imageIndex + * the image index. + * @param tileX + * the X index of tile. + * @param tileY + * the Y index of tile. * @return the Raster. - * - * @throws IOException Signals that an I/O exception has occurred. + * @throws IOException + * if an I/O exception has occurred. */ public Raster readTileRaster(int imageIndex, int tileX, int tileY) throws IOException { throw new UnsupportedOperationException("Not implemented yet"); } /** - * Reads the specified image using the specified - * ImageReadParam and returns it as a RenderedImage. - * - * @param imageIndex the image index. - * @param param the ImageReadParam. + * Reads the specified image using the specified ImageReadParam and returns + * it as a RenderedImage. * + * @param imageIndex + * the image index. + * @param param + * the ImageReadParam. * @return the RenderedImage. - * - * @throws IOException Signals that an I/O exception has occurred. + * @throws IOException + * if an I/O exception has occurred. */ - public RenderedImage readAsRenderedImage(int imageIndex, ImageReadParam param) throws IOException { + public RenderedImage readAsRenderedImage(int imageIndex, ImageReadParam param) + throws IOException { return read(imageIndex, param); } /** - * Returns true if the image format supported by this reader - * supports thumbnail preview images. + * Returns true if the image format supported by this reader supports + * thumbnail preview images. * - * @return true if the image format supported by this reader - * supports thumbnail preview images, false otherwise. + * @return true, if the image format supported by this reader supports + * thumbnail preview images, false otherwise. */ public boolean readerSupportsThumbnails() { - return false; //def + return false; // def } /** * Checks if the specified image has thumbnails or not. * - * @param imageIndex the image's index. - * - * @return true, if the specified image has thumbnails, - * false otherwise. - * - * @throws IOException Signals that an I/O exception has occurred. + * @param imageIndex + * the image's index. + * @return true, if the specified image has thumbnails, false otherwise. + * @throws IOException + * if an I/O exception has occurred. */ public boolean hasThumbnails(int imageIndex) throws IOException { - return getNumThumbnails(imageIndex) > 0; //def + return getNumThumbnails(imageIndex) > 0; // def } /** * Gets the number of thumbnails for the specified image. * - * @param imageIndex the image's index. - * + * @param imageIndex + * the image's index. * @return the number of thumbnails. - * - * @throws IOException Signals that an I/O exception has occurred. + * @throws IOException + * if an I/O exception has occurred. */ public int getNumThumbnails(int imageIndex) throws IOException { - return 0; //def + return 0; // def } /** * Gets the width of the specified thumbnail for the specified image. * - * @param imageIndex the image's index. - * @param thumbnailIndex the thumbnail's index. - * + * @param imageIndex + * the image's index. + * @param thumbnailIndex + * the thumbnail's index. * @return the thumbnail width. - * - * @throws IOException Signals that an I/O exception has occurred. + * @throws IOException + * if an I/O exception has occurred. */ public int getThumbnailWidth(int imageIndex, int thumbnailIndex) throws IOException { - return readThumbnail(imageIndex, thumbnailIndex).getWidth(); //def + return readThumbnail(imageIndex, thumbnailIndex).getWidth(); // def } /** * Gets the height of the specified thumbnail for the specified image. * - * @param imageIndex the image's index. - * @param thumbnailIndex the thumbnail's index. - * + * @param imageIndex + * the image's index. + * @param thumbnailIndex + * the thumbnail's index. * @return the thumbnail height. - * - * @throws IOException Signals that an I/O exception has occurred. + * @throws IOException + * if an I/O exception has occurred. */ public int getThumbnailHeight(int imageIndex, int thumbnailIndex) throws IOException { - return readThumbnail(imageIndex, thumbnailIndex).getHeight(); //def + return readThumbnail(imageIndex, thumbnailIndex).getHeight(); // def } /** - * Reads the thumbnail image for the specified image - * as a BufferedImage. - * - * @param imageIndex the image index. - * @param thumbnailIndex the thumbnail index. + * Reads the thumbnail image for the specified image as a BufferedImage. * + * @param imageIndex + * the image index. + * @param thumbnailIndex + * the thumbnail index. * @return the BufferedImage. - * - * @throws IOException Signals that an I/O exception has occurred. + * @throws IOException + * if an I/O exception has occurred. */ public BufferedImage readThumbnail(int imageIndex, int thumbnailIndex) throws IOException { - throw new UnsupportedOperationException("Unsupported"); //def + throw new UnsupportedOperationException("Unsupported"); // def } /** - * Requests an abort operation for current reading operation. + * Requests an abort operation for current reading operation. */ public void abort() { throw new UnsupportedOperationException("Not implemented yet"); } /** - * Checks whether or not a request to abort the current read operation - * has been made successfully. + * Checks whether or not a request to abort the current read operation has + * been made successfully. * - * @return true, if the request to abort the current read operation - * has been made successfully, false otherwise. + * @return true, if the request to abort the current read operation has been + * made successfully, false otherwise. */ protected boolean abortRequested() { throw new UnsupportedOperationException("Not implemented yet"); } /** - * Clears all previous abort request, and abortRequested returns false - * after calling this method. + * Clears all previous abort request, and abortRequested returns false after + * calling this method. */ protected void clearAbortRequest() { throw new UnsupportedOperationException("Not implemented yet"); @@ -707,7 +742,8 @@ public abstract class ImageReader { /** * Adds the IIOReadWarningListener. * - * @param listener the IIOReadWarningListener. + * @param listener + * the IIOReadWarningListener. */ public void addIIOReadWarningListener(IIOReadWarningListener listener) { throw new UnsupportedOperationException("Not implemented yet"); @@ -716,7 +752,8 @@ public abstract class ImageReader { /** * Removes the specified IIOReadWarningListener. * - * @param listener the IIOReadWarningListener to be removed. + * @param listener + * the IIOReadWarningListener to be removed. */ public void removeIIOReadWarningListener(IIOReadWarningListener listener) { throw new UnsupportedOperationException("Not implemented yet"); @@ -732,7 +769,8 @@ public abstract class ImageReader { /** * Adds the IIOReadProgressListener. * - * @param listener the IIOReadProgressListener. + * @param listener + * the IIOReadProgressListener. */ public void addIIOReadProgressListener(IIOReadProgressListener listener) { throw new UnsupportedOperationException("Not implemented yet"); @@ -741,7 +779,8 @@ public abstract class ImageReader { /** * Removes the specified IIOReadProgressListener. * - * @param listener the IIOReadProgressListener to be removed. + * @param listener + * the IIOReadProgressListener to be removed. */ public void removeIIOReadProgressListener(IIOReadProgressListener listener) { throw new UnsupportedOperationException("Not implemented yet"); @@ -757,7 +796,8 @@ public abstract class ImageReader { /** * Adds the IIOReadUpdateListener. * - * @param listener the IIOReadUpdateListener. + * @param listener + * the IIOReadUpdateListener. */ public void addIIOReadUpdateListener(IIOReadUpdateListener listener) { throw new UnsupportedOperationException("Not implemented yet"); @@ -766,7 +806,8 @@ public abstract class ImageReader { /** * Removes the specified IIOReadUpdateListener. * - * @param listener the IIOReadUpdateListener to be removed. + * @param listener + * the IIOReadUpdateListener to be removed. */ public void removeIIOReadUpdateListener(IIOReadUpdateListener listener) { throw new UnsupportedOperationException("Not implemented yet"); @@ -780,229 +821,243 @@ public abstract class ImageReader { } /** - * Processes the start of an sequence of image reads - * by calling the sequenceStarted method on all registered - * IIOReadProgressListeners. + * Processes the start of an sequence of image reads by calling the + * sequenceStarted method on all registered IIOReadProgressListeners. * - * @param minIndex the minimum index. + * @param minIndex + * the minimum index. */ protected void processSequenceStarted(int minIndex) { throw new UnsupportedOperationException("Not implemented yet"); } /** - * Processes the completion of an sequence of image reads - * by calling sequenceComplete method on all registered - * IIOReadProgressListeners. + * Processes the completion of an sequence of image reads by calling + * sequenceComplete method on all registered IIOReadProgressListeners. */ protected void processSequenceComplete() { throw new UnsupportedOperationException("Not implemented yet"); } /** - * Processes the start of an image read by calling the imageStarted - * method on all registered IIOReadProgressListeners. + * Processes the start of an image read by calling the imageStarted method + * on all registered IIOReadProgressListeners. * - * @param imageIndex the image index. + * @param imageIndex + * the image index. */ protected void processImageStarted(int imageIndex) { throw new UnsupportedOperationException("Not implemented yet"); } /** - * Processes the current percentage of image completion by calling - * the imageProgress method on all registered IIOReadProgressListeners. + * Processes the current percentage of image completion by calling the + * imageProgress method on all registered IIOReadProgressListeners. * - * @param percentageDone the percentage done. + * @param percentageDone + * the percentage done. */ protected void processImageProgress(float percentageDone) { throw new UnsupportedOperationException("Not implemented yet"); } /** - * Processes image completion by calling the imageComplete method - * on all registered IIOReadProgressListeners. + * Processes image completion by calling the imageComplete method on all + * registered IIOReadProgressListeners. */ protected void processImageComplete() { throw new UnsupportedOperationException("Not implemented yet"); } /** - * Processes the start of a thumbnail read by calling the - * thumbnailStarted method on all registered IIOReadProgressListeners. + * Processes the start of a thumbnail read by calling the thumbnailStarted + * method on all registered IIOReadProgressListeners. * - * @param imageIndex the image index. - * @param thumbnailIndex the thumbnail index. + * @param imageIndex + * the image index. + * @param thumbnailIndex + * the thumbnail index. */ protected void processThumbnailStarted(int imageIndex, int thumbnailIndex) { throw new UnsupportedOperationException("Not implemented yet"); } /** - * Processes the current percentage of thumbnail completion - * by calling the thumbnailProgress method on all registered - * IIOReadProgressListeners. + * Processes the current percentage of thumbnail completion by calling the + * thumbnailProgress method on all registered IIOReadProgressListeners. * - * @param percentageDone the percentage done. + * @param percentageDone + * the percentage done. */ protected void processThumbnailProgress(float percentageDone) { throw new UnsupportedOperationException("Not implemented yet"); } /** - * Processes the completion of a thumbnail read - * by calling the thumbnailComplete method - * on all registered IIOReadProgressListeners. + * Processes the completion of a thumbnail read by calling the + * thumbnailComplete method on all registered IIOReadProgressListeners. */ protected void processThumbnailComplete() { throw new UnsupportedOperationException("Not implemented yet"); } /** - * Processes a read aborted event by calling the readAborted - * method on all registered IIOReadProgressListeners. + * Processes a read aborted event by calling the readAborted method on all + * registered IIOReadProgressListeners. */ protected void processReadAborted() { throw new UnsupportedOperationException("Not implemented yet"); } /** - * Processes the beginning of a progressive pass by calling - * the passStarted method on all registered IIOReadUpdateListeners. - * - * @param theImage the image to be updated. - * @param pass the current pass index. - * @param minPass the minimum pass index. - * @param maxPass the maximum pass index. - * @param minX the X coordinate of of the upper left pixel. - * @param minY the Y coordinate of of the upper left pixel. - * @param periodX the horizontal separation between pixels. - * @param periodY the vertical separation between pixels. - * @param bands the number of affected bands. - */ - protected void processPassStarted(BufferedImage theImage, - int pass, - int minPass, - int maxPass, - int minX, - int minY, - int periodX, - int periodY, - int[] bands) { + * Processes the beginning of a progressive pass by calling the passStarted + * method on all registered IIOReadUpdateListeners. + * + * @param theImage + * the image to be updated. + * @param pass + * the current pass index. + * @param minPass + * the minimum pass index. + * @param maxPass + * the maximum pass index. + * @param minX + * the X coordinate of of the upper left pixel. + * @param minY + * the Y coordinate of of the upper left pixel. + * @param periodX + * the horizontal separation between pixels. + * @param periodY + * the vertical separation between pixels. + * @param bands + * the number of affected bands. + */ + protected void processPassStarted(BufferedImage theImage, int pass, int minPass, int maxPass, + int minX, int minY, int periodX, int periodY, int[] bands) { throw new UnsupportedOperationException("Not implemented yet"); } /** - * Processes the update of a set of samples by calling - * the imageUpdate method on all registered IIOReadUpdateListeners. - * - * @param theImage the image to be updated. - * @param minX the X coordinate of the upper left pixel. - * @param minY the Y coordinate of the upper left pixel. - * @param width the width of updated area. - * @param height the height of updated area. - * @param periodX the horizontal separation between pixels. - * @param periodY the vertical separation between pixels. - * @param bands the number of affected bands. - */ - protected void processImageUpdate(BufferedImage theImage, - int minX, - int minY, - int width, - int height, - int periodX, - int periodY, - int[] bands) { + * Processes the update of a set of samples by calling the imageUpdate + * method on all registered IIOReadUpdateListeners. + * + * @param theImage + * the image to be updated. + * @param minX + * the X coordinate of the upper left pixel. + * @param minY + * the Y coordinate of the upper left pixel. + * @param width + * the width of updated area. + * @param height + * the height of updated area. + * @param periodX + * the horizontal separation between pixels. + * @param periodY + * the vertical separation between pixels. + * @param bands + * the number of affected bands. + */ + protected void processImageUpdate(BufferedImage theImage, int minX, int minY, int width, + int height, int periodX, int periodY, int[] bands) { throw new UnsupportedOperationException("Not implemented yet"); } /** - * Processes the end of a progressive pass by calling passComplete - * method of registered IIOReadUpdateListeners. + * Processes the end of a progressive pass by calling passComplete method of + * registered IIOReadUpdateListeners. * - * @param theImage the image to be updated. + * @param theImage + * the image to be updated. */ protected void processPassComplete(BufferedImage theImage) { throw new UnsupportedOperationException("Not implemented yet"); } /** - * Processes the beginning of a thumbnail progressive pass - * by calling the thumbnailPassStarted method on all - * registered IIOReadUpdateListeners. - * - * @param theThumbnail the the thumbnail to be updated. - * @param pass the current pass index. - * @param minPass the minimum pass index. - * @param maxPass the maximum pass index. - * @param minX the X coordinate of the upper left pixel. - * @param minY the Y coordinate of the upper left pixel. - * @param periodX the horizontal separation between pixels. - * @param periodY the vertical separation between pixels. - * @param bands the number of affected bands. - */ - protected void processThumbnailPassStarted(BufferedImage theThumbnail, - int pass, - int minPass, - int maxPass, - int minX, - int minY, - int periodX, - int periodY, - int[] bands) { + * Processes the beginning of a thumbnail progressive pass by calling the + * thumbnailPassStarted method on all registered IIOReadUpdateListeners. + * + * @param theThumbnail + * the thumbnail to be updated. + * @param pass + * the current pass index. + * @param minPass + * the minimum pass index. + * @param maxPass + * the maximum pass index. + * @param minX + * the X coordinate of the upper left pixel. + * @param minY + * the Y coordinate of the upper left pixel. + * @param periodX + * the horizontal separation between pixels. + * @param periodY + * the vertical separation between pixels. + * @param bands + * the number of affected bands. + */ + protected void processThumbnailPassStarted(BufferedImage theThumbnail, int pass, int minPass, + int maxPass, int minX, int minY, int periodX, int periodY, int[] bands) { throw new UnsupportedOperationException("Not implemented yet"); } /** - * Processes the update of a set of samples in a thumbnail - * image by calling the thumbnailUpdate method on all - * registered IIOReadUpdateListeners. - * - * @param theThumbnail the the thumbnail to be updated. - * @param minX the X coordinate of the upper left pixel. - * @param minY the Y coordinate of the upper left pixel. - * @param periodX the horizontal separation between pixels. - * @param periodY the vertical separation between pixels. - * @param bands the number of affected bands. - */ - protected void processThumbnailUpdate(BufferedImage theThumbnail, - int minX, - int minY, - int width, - int height, - int periodX, - int periodY, - int[] bands) { + * Processes the update of a set of samples in a thumbnail image by calling + * the thumbnailUpdate method on all registered IIOReadUpdateListeners. + * + * @param theThumbnail + * the thumbnail to be updated. + * @param minX + * the X coordinate of the upper left pixel. + * @param minY + * the Y coordinate of the upper left pixel. + * @param width + * the total width of the updated area. + * @param height + * the total height of the updated area. + * @param periodX + * the horizontal separation between pixels. + * @param periodY + * the vertical separation between pixels. + * @param bands + * the number of affected bands. + */ + protected void processThumbnailUpdate(BufferedImage theThumbnail, int minX, int minY, + int width, int height, int periodX, int periodY, int[] bands) { throw new UnsupportedOperationException("Not implemented yet"); } /** - * Processes the end of a thumbnail progressive pass - * by calling the thumbnailPassComplete method - * on all registered IIOReadUpdateListeners. + * Processes the end of a thumbnail progressive pass by calling the + * thumbnailPassComplete method on all registered IIOReadUpdateListeners. * - * @param theThumbnail the thumbnail to be updated. + * @param theThumbnail + * the thumbnail to be updated. */ protected void processThumbnailPassComplete(BufferedImage theThumbnail) { throw new UnsupportedOperationException("Not implemented yet"); } /** - * Processes a warning message by calling warningOccurred method - * of registered IIOReadWarningListeners. + * Processes a warning message by calling warningOccurred method of + * registered IIOReadWarningListeners. * - * @param warning the warning. + * @param warning + * the warning. */ protected void processWarningOccurred(String warning) { throw new UnsupportedOperationException("Not implemented yet"); } /** - * Processes a warning by calling the warningOccurred method - * of on all registered IIOReadWarningListeners. + * Processes a warning by calling the warningOccurred method of on all + * registered IIOReadWarningListeners. * - * @param baseName the base name of ResourceBundles. - * @param keyword the keyword to index the warning among ResourceBundles. + * @param baseName + * the base name of ResourceBundles. + * @param keyword + * the keyword to index the warning among ResourceBundles. */ protected void processWarningOccurred(String baseName, String keyword) { throw new UnsupportedOperationException("Not implemented yet"); @@ -1029,13 +1084,15 @@ public abstract class ImageReader { } /** - * Gets the region of source image that should be read with the - * specified width, height and ImageReadParam. - * - * @param param the ImageReadParam object, or null. - * @param srcWidth the source image's width. - * @param srcHeight the source image's height. + * Gets the region of source image that should be read with the specified + * width, height and ImageReadParam. * + * @param param + * the ImageReadParam object, or null. + * @param srcWidth + * the source image's width. + * @param srcHeight + * the source image's height. * @return the Rectangle of source region. */ protected static Rectangle getSourceRegion(ImageReadParam param, int srcWidth, int srcHeight) { @@ -1043,58 +1100,63 @@ public abstract class ImageReader { } /** - * Computes the specified source region and the specified destination - * region with the specified the width and height of the source image, - * an optional destination image, and an ImageReadParam. + * Computes the specified source region and the specified destination region + * with the specified the width and height of the source image, an optional + * destination image, and an ImageReadParam. * - * @param param the an ImageReadParam object, or null. - * @param srcWidth the source image's width. - * @param srcHeight the source image's height. - * @param image the destination image. - * @param srcRegion the source region. - * @param destRegion the destination region. + * @param param + * the an ImageReadParam object, or null. + * @param srcWidth + * the source image's width. + * @param srcHeight + * the source image's height. + * @param image + * the destination image. + * @param srcRegion + * the source region. + * @param destRegion + * the destination region. */ - protected static void computeRegions(ImageReadParam param, - int srcWidth, - int srcHeight, - BufferedImage image, - Rectangle srcRegion, - Rectangle destRegion) { + protected static void computeRegions(ImageReadParam param, int srcWidth, int srcHeight, + BufferedImage image, Rectangle srcRegion, Rectangle destRegion) { throw new UnsupportedOperationException("Not implemented yet"); } /** - * Checks the validity of the source and destination band and is called - * when the reader knows the number of bands of the source image and - * the number of bands of the destination image. + * Checks the validity of the source and destination band and is called when + * the reader knows the number of bands of the source image and the number + * of bands of the destination image. * - * @param param the ImageReadParam for reading the Image. - * @param numSrcBands the number of bands in the source. - * @param numDstBands the number of bands in the destination. + * @param param + * the ImageReadParam for reading the Image. + * @param numSrcBands + * the number of bands in the source. + * @param numDstBands + * the number of bands in the destination. */ - protected static void checkReadParamBandSettings(ImageReadParam param, - int numSrcBands, - int numDstBands) { + protected static void checkReadParamBandSettings(ImageReadParam param, int numSrcBands, + int numDstBands) { throw new UnsupportedOperationException("Not implemented yet"); } /** - * Gets the destination image where the decoded data is written. - * - * @param param the ImageReadParam. - * @param imageTypes the iterator of ImageTypeSpecifier objects. - * @param width the width of the image being decoded. - * @param height the height of the image being decoded. + * Gets the destination image where the decoded data is written. * + * @param param + * the ImageReadParam. + * @param imageTypes + * the iterator of ImageTypeSpecifier objects. + * @param width + * the width of the image being decoded. + * @param height + * the height of the image being decoded. * @return the BufferedImage where decoded pixels should be written. - * - * @throws IIOException the IIOException is thrown if - * there is no suitable ImageTypeSpecifier. + * @throws IIOException + * the IIOException is thrown if there is no suitable + * ImageTypeSpecifier. */ - protected static BufferedImage getDestination(ImageReadParam param, Iterator imageTypes, - int width, - int height) - throws IIOException { + protected static BufferedImage getDestination(ImageReadParam param, + Iterator imageTypes, int width, int height) throws IIOException { throw new UnsupportedOperationException("Not implemented yet"); } } diff --git a/awt/javax/imageio/ImageTranscoder.java b/awt/javax/imageio/ImageTranscoder.java index 1a0de764a5c53..632d890f87fdc 100644 --- a/awt/javax/imageio/ImageTranscoder.java +++ b/awt/javax/imageio/ImageTranscoder.java @@ -18,43 +18,50 @@ * @author Rustem V. Rafikov * @version $Revision: 1.3 $ */ + package javax.imageio; import javax.imageio.metadata.IIOMetadata; import javax.imageio.ImageTypeSpecifier; /** - * The ImageTranscoder interface is to be implemented by classes that - * perform image transcoding operations, that is, take images written - * in one format and write them in another format using - * read/write operations. Some image data can be lost in such processes. - * The ImageTranscoder interface converts metadata objects (IIOMetadata) - * of ImageReader to apropriate metadata object for ImageWriter. + * The ImageTranscoder interface is to be implemented by classes that perform + * image transcoding operations, that is, take images written in one format and + * write them in another format using read/write operations. Some image data can + * be lost in such processes. The ImageTranscoder interface converts metadata + * objects (IIOMetadata) of ImageReader to appropriate metadata object for + * ImageWriter. + * + * @since Android 1.0 */ public interface ImageTranscoder { - + /** * Converts the specified IIOMetadata object using the specified * ImageWriteParam for obtaining writer's metadata structure. * - * @param inData the IIOMetadata. - * @param param the ImageWriteParam. - * + * @param inData + * the IIOMetadata. + * @param param + * the ImageWriteParam. * @return the IIOMetadata, or null. */ IIOMetadata convertStreamMetadata(IIOMetadata inData, ImageWriteParam param); /** * Converts the specified IIOMetadata object using the specified - * ImageWriteParam for obtaining writer's metadata structure - * and ImageTypeSpecifier object for obtaining the layout and - * color information of the image for this metadata. - * - * @param inData the IIOMetadata. - * @param imageType the ImageTypeSpecifier. - * @param param the ImageWriteParam. + * ImageWriteParam for obtaining writer's metadata structure and + * ImageTypeSpecifier object for obtaining the layout and color information + * of the image for this metadata. * + * @param inData + * the IIOMetadata. + * @param imageType + * the ImageTypeSpecifier. + * @param param + * the ImageWriteParam. * @return the IIOMetadata, or null. */ - IIOMetadata convertImageMetadata(IIOMetadata inData, ImageTypeSpecifier imageType, ImageWriteParam param); + IIOMetadata convertImageMetadata(IIOMetadata inData, ImageTypeSpecifier imageType, + ImageWriteParam param); } diff --git a/awt/javax/imageio/ImageTypeSpecifier.java b/awt/javax/imageio/ImageTypeSpecifier.java index c93f269baafa7..505b1c484d5f9 100644 --- a/awt/javax/imageio/ImageTypeSpecifier.java +++ b/awt/javax/imageio/ImageTypeSpecifier.java @@ -18,6 +18,7 @@ * @author Rustem V. Rafikov * @version $Revision: 1.3 $ */ + package javax.imageio; import java.awt.image.ColorModel; @@ -27,27 +28,31 @@ import java.awt.image.RenderedImage; import java.awt.color.ColorSpace; /** - * The ImageTypeSpecifier class performs conversion operations - * on the SampleModel and the ColorModel of an image. + * The ImageTypeSpecifier class performs conversion operations on the + * SampleModel and the ColorModel of an image. + * + * @since Android 1.0 */ public class ImageTypeSpecifier { - - /** + + /** * The ColorModel of this ImageTypeSpecifier. */ protected ColorModel colorModel; - - /** - * The SampleModel of this ImageTypeSpecifier. + + /** + * The SampleModel of this ImageTypeSpecifier. */ protected SampleModel sampleModel; /** - * Instantiates a new ImageTypeSpecifier with the specified - * ColorModel and SampleModel objects. + * Instantiates a new ImageTypeSpecifier with the specified ColorModel and + * SampleModel objects. * - * @param colorModel the ColorModel. - * @param sampleModel the SampleModel. + * @param colorModel + * the ColorModel. + * @param sampleModel + * the SampleModel. */ public ImageTypeSpecifier(ColorModel colorModel, SampleModel sampleModel) { if (colorModel == null) { @@ -65,10 +70,10 @@ public class ImageTypeSpecifier { } /** - * Instantiates a new ImageTypeSpecifier using the specified - * RenderedImage. + * Instantiates a new ImageTypeSpecifier using the specified RenderedImage. * - * @param renderedImage the RenderedImage. + * @param renderedImage + * the RenderedImage. */ public ImageTypeSpecifier(RenderedImage renderedImage) { if (renderedImage == null) { @@ -79,136 +84,139 @@ public class ImageTypeSpecifier { } /** - * Creates an ImageTypeSpecifier with the specified - * DirectColorModel and a packed SampleModel. - * - * @param colorSpace the ColorSpace. - * @param redMask the red mask. - * @param greenMask the green mask. - * @param blueMask the blue mask. - * @param alphaMask the alpha mask. - * @param transferType the transfer type. - * @param isAlphaPremultiplied the parameter indicates - * if the color channel is premultiplied by alpha. + * Creates an ImageTypeSpecifier with the specified DirectColorModel and a + * packed SampleModel. * + * @param colorSpace + * the ColorSpace. + * @param redMask + * the red mask. + * @param greenMask + * the green mask. + * @param blueMask + * the blue mask. + * @param alphaMask + * the alpha mask. + * @param transferType + * the transfer type. + * @param isAlphaPremultiplied + * the parameter indicates if the color channel is pre-multiplied + * by alpha. * @return the ImageTypeSpecifier. */ - public static ImageTypeSpecifier createPacked(ColorSpace colorSpace, - int redMask, - int greenMask, - int blueMask, - int alphaMask, - int transferType, - boolean isAlphaPremultiplied) { + public static ImageTypeSpecifier createPacked(ColorSpace colorSpace, int redMask, + int greenMask, int blueMask, int alphaMask, int transferType, + boolean isAlphaPremultiplied) { throw new UnsupportedOperationException("Not supported yet"); } /** - * Creates an ImageTypeSpecifier with specified - * ComponentColorModel and a PixelInterleavedSampleModel. - * - * @param colorSpace the ColorSpace. - * @param bandOffsets the band offsets. - * @param dataType the data type. - * @param hasAlpha the parameter indicates if alpha channel - * is needed. - * @param isAlphaPremultiplied the parameter indicates - * if the color channel is premultiplied by alpha. + * Creates an ImageTypeSpecifier with specified ComponentColorModel and a + * PixelInterleavedSampleModel. * + * @param colorSpace + * the ColorSpace. + * @param bandOffsets + * the band offsets. + * @param dataType + * the data type. + * @param hasAlpha + * the parameter indicates if alpha channel is needed. + * @param isAlphaPremultiplied + * the parameter indicates if the color channel is pre-multiplied + * by alpha. * @return the ImageTypeSpecifier. */ - public static ImageTypeSpecifier createInterleaved(ColorSpace colorSpace, - int[] bandOffsets, - int dataType, - boolean hasAlpha, - boolean isAlphaPremultiplied) { + public static ImageTypeSpecifier createInterleaved(ColorSpace colorSpace, int[] bandOffsets, + int dataType, boolean hasAlpha, boolean isAlphaPremultiplied) { throw new UnsupportedOperationException("Not supported yet"); } - /** - * Creates a ImageTypeSpecifier for a image with a - * BandedSampleModel and a ComponentColorModel. - * - * @param colorSpace the ColorSpace. - * @param bankIndices the bank indices. - * @param bandOffsets the band offsets. - * @param dataType the data type. - * @param hasAlpha the parameter indicates a presence of alpha channel. - * @param isAlphaPremultiplied the parameter indicates whether - * or not color channel is alpha premultiplied. + * Creates a ImageTypeSpecifier for a image with a BandedSampleModel and a + * ComponentColorModel. * + * @param colorSpace + * the ColorSpace. + * @param bankIndices + * the bank indices. + * @param bandOffsets + * the band offsets. + * @param dataType + * the data type. + * @param hasAlpha + * the parameter indicates a presence of alpha channel. + * @param isAlphaPremultiplied + * the parameter indicates whether or not color channel is alpha + * pre-multiplied. * @return the image type specifier */ - public static ImageTypeSpecifier createBanded(ColorSpace colorSpace, - int[] bankIndices, - int[] bandOffsets, - int dataType, - boolean hasAlpha, - boolean isAlphaPremultiplied) { + public static ImageTypeSpecifier createBanded(ColorSpace colorSpace, int[] bankIndices, + int[] bandOffsets, int dataType, boolean hasAlpha, boolean isAlphaPremultiplied) { throw new UnsupportedOperationException("Not supported yet"); } /** * Creates a ImageTypeSpecifier for a grayscale image. * - * @param bits the number of bits per gray value. - * @param dataType the data type. - * @param isSigned a signed flag. - * + * @param bits + * the number of bits per gray value. + * @param dataType + * the data type. + * @param isSigned + * a signed flag. * @return the ImageTypeSpecifier. */ - public static ImageTypeSpecifier createGrayscale(int bits, - int dataType, - boolean isSigned) { + public static ImageTypeSpecifier createGrayscale(int bits, int dataType, boolean isSigned) { throw new UnsupportedOperationException("Not supported yet"); } /** * Creates a ImageTypeSpecifier for a grayscale image. * - * @param bits the number of bits per gray value. - * @param dataType the data type. - * @param isSigned a signed flag. - * @param isAlphaPremultiplied the parameter indicates - * if color channel is premultiplied by alpha, or not. - * + * @param bits + * the number of bits per gray value. + * @param dataType + * the data type. + * @param isSigned + * a signed flag. + * @param isAlphaPremultiplied + * the parameter indicates if color channel is pre-multiplied by + * alpha, or not. * @return the ImageTypeSpecifier. */ - public static ImageTypeSpecifier createGrayscale(int bits, - int dataType, - boolean isSigned, - boolean isAlphaPremultiplied) { + public static ImageTypeSpecifier createGrayscale(int bits, int dataType, boolean isSigned, + boolean isAlphaPremultiplied) { throw new UnsupportedOperationException("Not supported yet"); } /** * Creates a ImageTypeSpecifier with the indexed image format. * - * @param redLUT the red values of indecies. - * @param greenLUT the green values of indecies. - * @param blueLUT the blue values of indecies. - * @param alphaLUT the alpha values of indecies. - * @param bits the bits number for each index. - * @param dataType the data type. - * + * @param redLUT + * the red values of indices. + * @param greenLUT + * the green values of indices. + * @param blueLUT + * the blue values of indices. + * @param alphaLUT + * the alpha values of indices. + * @param bits + * the bits number for each index. + * @param dataType + * the data type. * @return the ImageTypeSpecifier. */ - public static ImageTypeSpecifier createIndexed(byte[] redLUT, - byte[] greenLUT, - byte[] blueLUT, - byte[] alphaLUT, - int bits, - int dataType) { + public static ImageTypeSpecifier createIndexed(byte[] redLUT, byte[] greenLUT, byte[] blueLUT, + byte[] alphaLUT, int bits, int dataType) { throw new UnsupportedOperationException("Not supported yet"); } /** - * Creates the ImageTypeSpecifier from - * the specified buffered image type. - * - * @param bufferedImageType the buffered image type. + * Creates the ImageTypeSpecifier from the specified buffered image type. * + * @param bufferedImageType + * the buffered image type. * @return the ImageTypeSpecifier. */ public static ImageTypeSpecifier createFromBufferedImageType(int bufferedImageType) { @@ -216,11 +224,10 @@ public class ImageTypeSpecifier { } /** - * Creates the ImageTypeSpecifier from - * the specified RenderedImage. - * - * @param image the RenderedImage. + * Creates the ImageTypeSpecifier from the specified RenderedImage. * + * @param image + * the RenderedImage. * @return the ImageTypeSpecifier. */ public static ImageTypeSpecifier createFromRenderedImage(RenderedImage image) { @@ -242,7 +249,7 @@ public class ImageTypeSpecifier { /** * Gets the number of components. * - * @return the number of components + * @return the number of components. */ public int getNumComponents() { return colorModel.getNumComponents(); @@ -251,7 +258,7 @@ public class ImageTypeSpecifier { /** * Gets the number of bands. * - * @return the number of bands + * @return the number of bands. */ public int getNumBands() { return sampleModel.getNumBands(); @@ -260,8 +267,8 @@ public class ImageTypeSpecifier { /** * Gets the number of bits per the specified band. * - * @param band the index of band. - * + * @param band + * the index of band. * @return the number of bits per the specified band. */ public int getBitsPerBand(int band) { @@ -283,13 +290,14 @@ public class ImageTypeSpecifier { /** * Gets a compatible SampleModel with the specified width and height. * - * @param width the width. - * @param height the height. - * + * @param width + * the width. + * @param height + * the height. * @return the SampleModel. */ public SampleModel getSampleModel(int width, int height) { - if ((long)width*height > Integer.MAX_VALUE) { + if ((long)width * height > Integer.MAX_VALUE) { throw new IllegalArgumentException("width * height > Integer.MAX_VALUE"); } return sampleModel.createCompatibleSampleModel(width, height); @@ -298,20 +306,21 @@ public class ImageTypeSpecifier { /** * Gets the ColorModel associated with this ImageTypeSpecifier. * - * @return the ColorModel associated with this ImageTypeSpecifier. + * @return the ColorModel associated with this ImageTypeSpecifier. */ public ColorModel getColorModel() { return colorModel; } /** - * Creates the BufferedImage with the specified width and height - * and the ColorMadel and SampleModel which are specified by this + * Creates the BufferedImage with the specified width and height and the + * ColorMadel and SampleModel which are specified by this * ImageTypeSpecifier. * - * @param width the width of the BufferedImage. - * @param height the height of the BufferedImage. - * + * @param width + * the width of the BufferedImage. + * @param height + * the height of the BufferedImage. * @return the BufferedImage. */ public BufferedImage createBufferedImage(int width, int height) { @@ -319,19 +328,18 @@ public class ImageTypeSpecifier { } /** - * Compares this ImageTypeSpecifier object with the specified - * object. - * - * @param o the Object to be compared. + * Compares this ImageTypeSpecifier object with the specified object. * - * @return true, if the object is an ImageTypeSpecifier with the same - * data as this ImageTypeSpecifier, false otherwise. + * @param o + * the Object to be compared. + * @return true, if the object is an ImageTypeSpecifier with the same data + * as this ImageTypeSpecifier, false otherwise. */ @Override public boolean equals(Object o) { boolean rt = false; if (o instanceof ImageTypeSpecifier) { - ImageTypeSpecifier ts = (ImageTypeSpecifier) o; + ImageTypeSpecifier ts = (ImageTypeSpecifier)o; rt = colorModel.equals(ts.colorModel) && sampleModel.equals(ts.sampleModel); } return rt; diff --git a/awt/javax/imageio/ImageWriteParam.java b/awt/javax/imageio/ImageWriteParam.java index d32fa591d411a..d661889b2fcfa 100644 --- a/awt/javax/imageio/ImageWriteParam.java +++ b/awt/javax/imageio/ImageWriteParam.java @@ -18,103 +18,141 @@ * @author Rustem V. Rafikov * @version $Revision: 1.3 $ */ + package javax.imageio; import java.util.Locale; import java.awt.*; /** - * The ImageWriteParam class provides information to an ImageWriter - * about how an image is to be encoded. + * The ImageWriteParam class provides information to an ImageWriter about how an + * image is to be encoded. + * + * @since Android 1.0 */ public class ImageWriteParam extends IIOParam { - /** - * The Constant MODE_DISABLED indicates that - * stream is not tiled, progressive, or compressed. + /** + * The Constant MODE_DISABLED indicates that stream is not tiled, + * progressive, or compressed. */ public static final int MODE_DISABLED = 0; - - /** - * The Constant MODE_DEFAULT indicates that the stream will be tiled, - * progressive, or compressed according to the plug-in's default. + + /** + * The Constant MODE_DEFAULT indicates that the stream will be tiled, + * progressive, or compressed according to the plug-in's default. */ public static final int MODE_DEFAULT = 1; - - /** + + /** * The Constant MODE_EXPLICIT indicates that the stream will be tiled, - * progressive, or compressed according to current settings - * which are defined by set methods. + * progressive, or compressed according to current settings which are + * defined by set methods. */ public static final int MODE_EXPLICIT = 2; - - /** - * The Constant MODE_COPY_FROM_METADATA indicates that the stream - * will be tiled, progressive, or compressed according to - * stream or image metadata. + + /** + * The Constant MODE_COPY_FROM_METADATA indicates that the stream will be + * tiled, progressive, or compressed according to stream or image metadata. */ public static final int MODE_COPY_FROM_METADATA = 3; - - /** Whether the ImageWriter can write tiles. */ + + /** + * Whether the ImageWriter can write tiles. + */ protected boolean canWriteTiles = false; - - /** The tiling mode. */ + + /** + * The tiling mode. + */ protected int tilingMode = MODE_COPY_FROM_METADATA; - - /** The preferred tile sizes. */ + + /** + * The preferred tile sizes. + */ protected Dimension[] preferredTileSizes = null; - - /** The tiling set. */ + + /** + * The tiling set. + */ protected boolean tilingSet = false; - - /** The tile width. */ + + /** + * The tile width. + */ protected int tileWidth = 0; - - /** The tile height. */ + + /** + * The tile height. + */ protected int tileHeight = 0; - - /** Whether the ImageWriter can offset tiles. */ + + /** + * Whether the ImageWriter can offset tiles. + */ protected boolean canOffsetTiles = false; - - /** The tile grid x offset. */ + + /** + * The tile grid x offset. + */ protected int tileGridXOffset = 0; - - /** The tile grid y offset. */ + + /** + * The tile grid y offset. + */ protected int tileGridYOffset = 0; - - /** Whether the ImageWriter can write in progressive mode. */ + + /** + * Whether the ImageWriter can write in progressive mode. + */ protected boolean canWriteProgressive = false; - - /** The progressive mode. */ + + /** + * The progressive mode. + */ protected int progressiveMode = MODE_COPY_FROM_METADATA; - - /** Whether the ImageWriter can write in compressed mode. */ + + /** + * Whether the ImageWriter can write in compressed mode. + */ protected boolean canWriteCompressed = false; - - /** The compression mode. */ + + /** + * The compression mode. + */ protected int compressionMode = MODE_COPY_FROM_METADATA; - - /** The compression types. */ + + /** + * The compression types. + */ protected String[] compressionTypes = null; - - /** The compression type. */ + + /** + * The compression type. + */ protected String compressionType = null; - - /** The compression quality. */ + + /** + * The compression quality. + */ protected float compressionQuality = 1.0f; - - /** The locale. */ + + /** + * The locale. + */ protected Locale locale = null; /** * Instantiates a new ImageWriteParam. */ - protected ImageWriteParam() {} + protected ImageWriteParam() { + } /** * Instantiates a new ImageWriteParam with the specified Locale. * - * @param locale the Locale. + * @param locale + * the Locale. */ public ImageWriteParam(Locale locale) { this.locale = locale; @@ -122,7 +160,7 @@ public class ImageWriteParam extends IIOParam { } /** - * Gets the mode for writing the stream in a progressive sequence. + * Gets the mode for writing the stream in a progressive sequence. * * @return the current progressive mode. */ @@ -134,24 +172,24 @@ public class ImageWriteParam extends IIOParam { } /** - * Returns true if images can be written using - * increasing quality passes by progressive. + * Returns true if images can be written using increasing quality passes by + * progressive. * - * @return true if images can be written using - * increasing quality passes by progressive, false otherwise. + * @return true if images can be written using increasing quality passes by + * progressive, false otherwise. */ public boolean canWriteProgressive() { return canWriteProgressive; } /** - * Sets the progressive mode which defines whether the stream - * contains a progressive sequence of increasing quality - * during writing. The progressive mode should be one of - * the following values: MODE_DISABLED, MODE_DEFAULT, or - * MODE_COPY_FROM_METADATA. + * Sets the progressive mode which defines whether the stream contains a + * progressive sequence of increasing quality during writing. The + * progressive mode should be one of the following values: MODE_DISABLED, + * MODE_DEFAULT, or MODE_COPY_FROM_METADATA. * - * @param mode the new progressive mode. + * @param mode + * the new progressive mode. */ public void setProgressiveMode(int mode) { if (canWriteProgressive()) { @@ -164,22 +202,21 @@ public class ImageWriteParam extends IIOParam { } /** - * Returns true if the writer can use tiles with non zero - * grid offsets while writing. + * Returns true if the writer can use tiles with non zero grid offsets while + * writing. * - * @return true if the writer can use tiles with non zero - * grid offsets while writing, false otherwise. + * @return true, if the writer can use tiles with non zero grid offsets + * while writing, false otherwise. */ public boolean canOffsetTiles() { return canOffsetTiles; } /** - * Returns true if this writer can write images with - * compression. + * Returns true if this writer can write images with compression. * - * @return true, true if this writer can write images with - * compression, false otherwise. + * @return true, if this writer can write images with compression, false + * otherwise. */ public boolean canWriteCompressed() { return canWriteCompressed; @@ -188,7 +225,7 @@ public class ImageWriteParam extends IIOParam { /** * Returns true if the writer can write tiles. * - * @return true if the writer can write tiles, false otherwise. + * @return true, if the writer can write tiles, false otherwise. */ public boolean canWriteTiles() { return canWriteTiles; @@ -247,8 +284,7 @@ public class ImageWriteParam extends IIOParam { /** * Gets the current compression type, or returns null. * - * @return the current compression type, or returns null - * if it is not set. + * @return the current compression type, or returns null if it is not set. */ public String getCompressionType() { checkWriteCompressed(); @@ -257,14 +293,12 @@ public class ImageWriteParam extends IIOParam { } /** - * Gets a bit rate which represents an estimate of the number of bits - * of output data for each bit of input image data with the specified - * quality. + * Gets a bit rate which represents an estimate of the number of bits of + * output data for each bit of input image data with the specified quality. * - * @param quality the quality. - * - * @return an estimate of the bit rate, or -1.0F if there is no - * estimate. + * @param quality + * the quality. + * @return an estimate of the bit rate, or -1.0F if there is no estimate. */ public float getBitRate(float quality) { checkWriteCompressed(); @@ -301,8 +335,7 @@ public class ImageWriteParam extends IIOParam { } /** - * Gets an array of floats which decribe - * compression quality levels. + * Gets an array of floats which describes compression quality levels. * * @return the array of compression quality values. */ @@ -323,7 +356,7 @@ public class ImageWriteParam extends IIOParam { } /** - * Gets the current compression type using the current Locale. + * Gets the current compression type using the current Locale. * * @return the current compression type using the current Locale. */ @@ -377,8 +410,8 @@ public class ImageWriteParam extends IIOParam { } /** - * Gets an array of Dimensions giving the sizes of the tiles as - * they are encoded in the output file or stream. + * Gets an array of Dimensions giving the sizes of the tiles as they are + * encoded in the output file or stream. * * @return the preferred tile sizes. */ @@ -420,11 +453,10 @@ public class ImageWriteParam extends IIOParam { } /** - * Gets the tile height in an image as it is written to the - * output stream. + * Gets the tile height in an image as it is written to the output stream. * - * @return the tile height in an image as it is written to the - * output stream. + * @return the tile height in an image as it is written to the output + * stream. */ public int getTileHeight() { checkTiling(); @@ -434,11 +466,9 @@ public class ImageWriteParam extends IIOParam { } /** - * Gets the tile width in an image as it is written to the - * output stream. + * Gets the tile width in an image as it is written to the output stream. * - * @return the tile width in an image as it is written to the - * output stream. + * @return the tile width in an image as it is written to the output stream. */ public int getTileWidth() { checkTiling(); @@ -448,11 +478,10 @@ public class ImageWriteParam extends IIOParam { } /** - * Checks if the current compression type has lossless - * compression or not. + * Checks if the current compression type has lossless compression or not. * - * @return true, if the current compression type has lossless - * compression, false otherwise. + * @return true, if the current compression type has lossless compression, + * false otherwise. */ public boolean isCompressionLossless() { checkWriteCompressed(); @@ -472,12 +501,12 @@ public class ImageWriteParam extends IIOParam { } /** - * Sets the compression mode to the specified value. - * The specified mode can be one of the predefined - * constants: MODE_DEFAULT, MODE_DISABLED, MODE_EXPLICIT, - * or MODE_COPY_FROM_METADATA. - * - * @param mode the new compression mode to be set. + * Sets the compression mode to the specified value. The specified mode can + * be one of the predefined constants: MODE_DEFAULT, MODE_DISABLED, + * MODE_EXPLICIT, or MODE_COPY_FROM_METADATA. + * + * @param mode + * the new compression mode to be set. */ public void setCompressionMode(int mode) { checkWriteCompressed(); @@ -502,8 +531,8 @@ public class ImageWriteParam extends IIOParam { /** * Sets the compression quality. The value should be between 0 and 1. * - * @param quality the new compression quality, - * float value between 0 and 1. + * @param quality + * the new compression quality, float value between 0 and 1. */ public void setCompressionQuality(float quality) { checkWriteCompressed(); @@ -516,11 +545,11 @@ public class ImageWriteParam extends IIOParam { } /** - * Sets the compression type. The specified string - * should be one of the values returned - * by getCompressionTypes method. + * Sets the compression type. The specified string should be one of the + * values returned by getCompressionTypes method. * - * @param compressionType the new compression type. + * @param compressionType + * the new compression type. */ public void setCompressionType(String compressionType) { checkWriteCompressed(); @@ -547,13 +576,17 @@ public class ImageWriteParam extends IIOParam { } /** - * Sets the instruction that tiling should be performed for - * the image in the output stream with the specified parameters. + * Sets the instruction that tiling should be performed for the image in the + * output stream with the specified parameters. * - * @param tileWidth the tile's width. - * @param tileHeight the tile's height. - * @param tileGridXOffset the tile grid's x offset. - * @param tileGridYOffset the tile grid's y offset. + * @param tileWidth + * the tile's width. + * @param tileHeight + * the tile's height. + * @param tileGridXOffset + * the tile grid's x offset. + * @param tileGridYOffset + * the tile grid's y offset. */ public void setTiling(int tileWidth, int tileHeight, int tileGridXOffset, int tileGridYOffset) { checkTiling(); @@ -563,19 +596,17 @@ public class ImageWriteParam extends IIOParam { throw new UnsupportedOperationException("Can't offset tiles!"); } - if (tileWidth <=0 || tileHeight <= 0) { + if (tileWidth <= 0 || tileHeight <= 0) { throw new IllegalArgumentException("tile dimensions are non-positive!"); } Dimension preferredTileSizes[] = getPreferredTileSizes(); if (preferredTileSizes != null) { - for (int i = 0; i < preferredTileSizes.length; i+=2) { + for (int i = 0; i < preferredTileSizes.length; i += 2) { Dimension minSize = preferredTileSizes[i]; - Dimension maxSize = preferredTileSizes[i+1]; - if ( - tileWidth < minSize.width || tileWidth > maxSize.width || - tileHeight < minSize.height || tileHeight > maxSize.height - ) { + Dimension maxSize = preferredTileSizes[i + 1]; + if (tileWidth < minSize.width || tileWidth > maxSize.width + || tileHeight < minSize.height || tileHeight > maxSize.height) { throw new IllegalArgumentException("Illegal tile size!"); } } @@ -603,11 +634,12 @@ public class ImageWriteParam extends IIOParam { } /** - * Sets the tiling mode. The specified mode should be one of the - * following values: MODE_DISABLED, MODE_DEFAULT, MODE_EXPLICIT, - * or MODE_COPY_FROM_METADATA. + * Sets the tiling mode. The specified mode should be one of the following + * values: MODE_DISABLED, MODE_DEFAULT, MODE_EXPLICIT, or + * MODE_COPY_FROM_METADATA. * - * @param mode the new tiling mode. + * @param mode + * the new tiling mode. */ public void setTilingMode(int mode) { checkTiling(); @@ -630,4 +662,3 @@ public class ImageWriteParam extends IIOParam { } } } - diff --git a/awt/javax/imageio/ImageWriter.java b/awt/javax/imageio/ImageWriter.java index d6119b0789ab3..86879e0401007 100644 --- a/awt/javax/imageio/ImageWriter.java +++ b/awt/javax/imageio/ImageWriter.java @@ -18,6 +18,7 @@ * @author Rustem V. Rafikov * @version $Revision: 1.3 $ */ + package javax.imageio; import java.awt.Dimension; @@ -40,34 +41,49 @@ import javax.imageio.metadata.IIOMetadata; import javax.imageio.spi.ImageWriterSpi; /** - * The ImageWriter class is an abstract class for encoding images. - * ImageWriter objects are instantiated by the service provider - * interface, ImageWriterSpi class, for the specific format. - * ImageWriterSpi class should be registered with the IIORegistry, - * which uses them for format recognition and presentation of available - * format readers and writers. + * The ImageWriter class is an abstract class for encoding images. ImageWriter + * objects are instantiated by the service provider interface, ImageWriterSpi + * class, for the specific format. ImageWriterSpi class should be registered + * with the IIORegistry, which uses them for format recognition and presentation + * of available format readers and writers. + * + * @since Android 1.0 */ public abstract class ImageWriter implements ImageTranscoder { - /** The available locales. */ + /** + * The available locales. + */ protected Locale[] availableLocales; - - /** The locale. */ + + /** + * The locale. + */ protected Locale locale; - - /** The originating provider. */ + + /** + * The originating provider. + */ protected ImageWriterSpi originatingProvider; - - /** The output. */ + + /** + * The output. + */ protected Object output; - - /** The progress listeners. */ + + /** + * The progress listeners. + */ protected List progressListeners; - - /** The warning listeners. */ + + /** + * The warning listeners. + */ protected List warningListeners; - - /** The warning locales. */ + + /** + * The warning locales. + */ protected List warningLocales; // Indicates that abort operation is requested @@ -78,22 +94,21 @@ public abstract class ImageWriter implements ImageTranscoder { /** * Instantiates a new ImageWriter. * - * @param originatingProvider the ImageWriterSpi which - * instanties this ImageWriter. + * @param originatingProvider + * the ImageWriterSpi which instantiates this ImageWriter. */ protected ImageWriter(ImageWriterSpi originatingProvider) { this.originatingProvider = originatingProvider; } public abstract IIOMetadata convertStreamMetadata(IIOMetadata iioMetadata, - ImageWriteParam imageWriteParam); + ImageWriteParam imageWriteParam); public abstract IIOMetadata convertImageMetadata(IIOMetadata iioMetadata, - ImageTypeSpecifier imageTypeSpecifier, - ImageWriteParam imageWriteParam); + ImageTypeSpecifier imageTypeSpecifier, ImageWriteParam imageWriteParam); /** - * Gets the ImageWriterSpi which instantiated this ImageWriter. + * Gets the ImageWriterSpi which instantiated this ImageWriter. * * @return the ImageWriterSpi. */ @@ -102,10 +117,11 @@ public abstract class ImageWriter implements ImageTranscoder { } /** - * Processes the start of an image read by calling their imageStarted - * method of registered IIOWriteProgressListeners. + * Processes the start of an image read by calling their imageStarted method + * of registered IIOWriteProgressListeners. * - * @param imageIndex the image index. + * @param imageIndex + * the image index. */ protected void processImageStarted(int imageIndex) { if (null != progressListeners) { @@ -116,10 +132,11 @@ public abstract class ImageWriter implements ImageTranscoder { } /** - * Processes the current percentage of image completion by calling + * Processes the current percentage of image completion by calling * imageProgress method of registered IIOWriteProgressListener. * - * @param percentageDone the percentage done. + * @param percentageDone + * the percentage done. */ protected void processImageProgress(float percentageDone) { if (null != progressListeners) { @@ -130,8 +147,8 @@ public abstract class ImageWriter implements ImageTranscoder { } /** - * Processes image completion by calling imageComplete method - * of registered IIOWriteProgressListeners. + * Processes image completion by calling imageComplete method of registered + * IIOWriteProgressListeners. */ protected void processImageComplete() { if (null != progressListeners) { @@ -142,11 +159,13 @@ public abstract class ImageWriter implements ImageTranscoder { } /** - * Processes a warning message by calling warningOccurred method - * of registered IIOWriteWarningListeners. + * Processes a warning message by calling warningOccurred method of + * registered IIOWriteWarningListeners. * - * @param imageIndex the image index. - * @param warning the warning. + * @param imageIndex + * the image index. + * @param warning + * the warning. */ protected void processWarningOccurred(int imageIndex, String warning) { if (null == warning) { @@ -160,13 +179,15 @@ public abstract class ImageWriter implements ImageTranscoder { } /** - * Processes a warning message by calling warningOccurred method - * of registered IIOWriteWarningListeners with string from - * ResourceBundle. + * Processes a warning message by calling warningOccurred method of + * registered IIOWriteWarningListeners with string from ResourceBundle. * - * @param imageIndex the image index. - * @param bundle the name of ResourceBundle. - * @param key the keyword. + * @param imageIndex + * the image index. + * @param bundle + * the name of ResourceBundle. + * @param key + * the keyword. */ protected void processWarningOccurred(int imageIndex, String bundle, String key) { if (warningListeners != null) { // Don't check the parameters @@ -180,17 +201,18 @@ public abstract class ImageWriter implements ImageTranscoder { throw new IllegalArgumentException("keyword == null!"); } - // Get the context class loader and try to locate the bundle with it first - ClassLoader contextClassloader = AccessController.doPrivileged( - new PrivilegedAction() { + // Get the context class loader and try to locate the bundle with it + // first + ClassLoader contextClassloader = AccessController + .doPrivileged(new PrivilegedAction() { public ClassLoader run() { return Thread.currentThread().getContextClassLoader(); } - }); + }); // Iterate through both listeners and locales int n = warningListeners.size(); - for (int i=0; i < n; i++) { + for (int i = 0; i < n; i++) { IIOWriteWarningListener listener = warningListeners.get(i); Locale locale = warningLocales.get(i); @@ -218,10 +240,11 @@ public abstract class ImageWriter implements ImageTranscoder { } /** - * Sets the specified Object to the output of this ImageWriter. + * Sets the specified Object to the output of this ImageWriter. * - * @param output the Object which represents destination, it can - * be ImageOutputStream or other objects. + * @param output + * the Object which represents destination, it can be + * ImageOutputStream or other objects. */ public void setOutput(Object output) { if (output != null) { @@ -244,26 +267,26 @@ public abstract class ImageWriter implements ImageTranscoder { } /** - * Writes a completed image stream that contains the specified image, + * Writes a completed image stream that contains the specified image, * default metadata, and thumbnails to the output. * - * @param image the specified image to be written. - * - * @throws IOException Signals that an I/O exception has occurred - * during writting. + * @param image + * the specified image to be written. + * @throws IOException + * if an I/O exception has occurred during writing. */ public void write(IIOImage image) throws IOException { write(null, image, null); } /** - * Writes a completed image stream that contains the specified - * rendered image, default metadata, and thumbnails to the output. - * - * @param image the specified RenderedImage to be written. + * Writes a completed image stream that contains the specified rendered + * image, default metadata, and thumbnails to the output. * - * @throws IOException Signals that an I/O exception has occurred - * during writting. + * @param image + * the specified RenderedImage to be written. + * @throws IOException + * if an I/O exception has occurred during writing. */ public void write(RenderedImage image) throws IOException { write(null, new IIOImage(image, null, null), null); @@ -273,16 +296,18 @@ public abstract class ImageWriter implements ImageTranscoder { * Writes a completed image stream that contains the specified image, * metadata and thumbnails to the output. * - * @param streamMetadata the stream metadata, or null. - * @param image the specified image to be written, if - * canWriteRaster() method returns false, then Image must contain - * only RenderedImage. - * @param param the ImageWriteParam, or null. - * - * @throws IOException - if an error occurs during writing. + * @param streamMetadata + * the stream metadata, or null. + * @param image + * the specified image to be written, if canWriteRaster() method + * returns false, then Image must contain only RenderedImage. + * @param param + * the ImageWriteParam, or null. + * @throws IOException + * if an error occurs during writing. */ - public abstract void write(IIOMetadata streamMetadata, - IIOImage image, ImageWriteParam param) throws IOException; + public abstract void write(IIOMetadata streamMetadata, IIOImage image, ImageWriteParam param) + throws IOException; /** * Disposes of any resources. @@ -292,26 +317,26 @@ public abstract class ImageWriter implements ImageTranscoder { } /** - * Requests an abort operation for current writing operation. + * Requests an abort operation for current writing operation. */ public synchronized void abort() { aborted = true; } /** - * Checks whether or not a request to abort the current write operation - * has been made successfully. + * Checks whether or not a request to abort the current write operation has + * been made successfully. * - * @return true, if the request to abort the current write operation - * has been made successfully, false otherwise. + * @return true, if the request to abort the current write operation has + * been made successfully, false otherwise. */ protected synchronized boolean abortRequested() { return aborted; } /** - * Clears all previous abort request, and abortRequested returns false - * after calling this method. + * Clears all previous abort request, and abortRequested returns false after + * calling this method. */ protected synchronized void clearAbortRequest() { aborted = false; @@ -320,7 +345,8 @@ public abstract class ImageWriter implements ImageTranscoder { /** * Adds the IIOWriteProgressListener listener. * - * @param listener the IIOWriteProgressListener listener. + * @param listener + * the IIOWriteProgressListener listener. */ public void addIIOWriteProgressListener(IIOWriteProgressListener listener) { if (listener == null) { @@ -337,7 +363,8 @@ public abstract class ImageWriter implements ImageTranscoder { /** * Adds the IIOWriteWarningListener. * - * @param listener the IIOWriteWarningListener listener. + * @param listener + * the IIOWriteWarningListener listener. */ public void addIIOWriteWarningListener(IIOWriteWarningListener listener) { if (listener == null) { @@ -356,8 +383,8 @@ public abstract class ImageWriter implements ImageTranscoder { /** * Gets the output object that was set by setOutput method. * - * @return the output object such as ImageOutputStream, or null if - * it is not set. + * @return the output object such as ImageOutputStream, or null if it is not + * set. */ public Object getOutput() { return output; @@ -366,7 +393,7 @@ public abstract class ImageWriter implements ImageTranscoder { /** * Check output return false. * - * @return true, if successful + * @return true, if successful. */ private final boolean checkOutputReturnFalse() { if (getOutput() == null) { @@ -385,124 +412,122 @@ public abstract class ImageWriter implements ImageTranscoder { throw new UnsupportedOperationException("Unsupported write variant!"); } - /** - * Returns true if a new empty image can be inserted at - * the specified index. + * Returns true if a new empty image can be inserted at the specified index. * - * @param imageIndex the specified index of image. - * - * @return true if a new empty image can be inserted at - * the specified index, false otherwise. - * - * @throws IOException Signals that an I/O exception has occurred. + * @param imageIndex + * the specified index of image. + * @return true if a new empty image can be inserted at the specified index, + * false otherwise. + * @throws IOException + * Signals that an I/O exception has occurred. */ public boolean canInsertEmpty(int imageIndex) throws IOException { return checkOutputReturnFalse(); } /** - * Returns true if a new image can be inserted at the specified index. - * - * @param imageIndex the specified index of image. + * Returns true if a new image can be inserted at the specified index. * - * @return true if a new image can be inserted at the specified index, - * false otherwise. - * - * @throws IOException Signals that an I/O exception has occurred. + * @param imageIndex + * the specified index of image. + * @return true if a new image can be inserted at the specified index, false + * otherwise. + * @throws IOException + * Signals that an I/O exception has occurred. */ public boolean canInsertImage(int imageIndex) throws IOException { return checkOutputReturnFalse(); } /** - * Returnes true if the image with the specified index can be removed. - * - * @param imageIndex the specified index of image. + * Returns true if the image with the specified index can be removed. * - * @return true if the image with the specified index can be removed, - * false otherwise. - * - * @throws IOException Signals that an I/O exception has occurred. + * @param imageIndex + * the specified index of image. + * @return true if the image with the specified index can be removed, false + * otherwise. + * @throws IOException + * Signals that an I/O exception has occurred. */ public boolean canRemoveImage(int imageIndex) throws IOException { return checkOutputReturnFalse(); } /** - * Returns true if metadata of the image with the specified index - * can be replaced. - * - * @param imageIndex the specified image index. + * Returns true if metadata of the image with the specified index can be + * replaced. * - * @return true if metadata of the image with the specified index - * can be replaced, false otherwise. - * - * @throws IOException Signals that an I/O exception has occurred. + * @param imageIndex + * the specified image index. + * @return true if metadata of the image with the specified index can be + * replaced, false otherwise. + * @throws IOException + * if an I/O exception has occurred. */ public boolean canReplaceImageMetadata(int imageIndex) throws IOException { return checkOutputReturnFalse(); } /** - * Returns true if pixels of the image with the specified index - * can be replaced by the replacePixels methods. - * - * @param imageIndex the image's index. + * Returns true if pixels of the image with the specified index can be + * replaced by the replacePixels methods. * - * @return true if pixels of the image with the specified index - * can be replaced by the replacePixels methods, false otherwise. - * - * @throws IOException Signals that an I/O exception has occurred. + * @param imageIndex + * the image's index. + * @return true if pixels of the image with the specified index can be + * replaced by the replacePixels methods, false otherwise. + * @throws IOException + * Signals that an I/O exception has occurred. */ public boolean canReplacePixels(int imageIndex) throws IOException { return checkOutputReturnFalse(); } /** - * Returns true if the stream metadata presented in the output - * can be removed. - * - * @return true if the stream metadata presented in the output - * can be removed, false otherwise. + * Returns true if the stream metadata presented in the output can be + * removed. * - * @throws IOException Signals that an I/O exception has occurred. + * @return true if the stream metadata presented in the output can be + * removed, false otherwise. + * @throws IOException + * if an I/O exception has occurred. */ public boolean canReplaceStreamMetadata() throws IOException { return checkOutputReturnFalse(); } /** - * Returns true if the writing of a complete image stream which - * contains a single image is supported with undefined pixel - * values and associated metadata and thumbnails to the output. - * - * @return true if the writing of a complete image stream which - * contains a single image is supported, false otherwise. + * Returns true if the writing of a complete image stream which contains a + * single image is supported with undefined pixel values and associated + * metadata and thumbnails to the output. * - * @throws IOException Signals that an I/O exception has occurred. + * @return true if the writing of a complete image stream which contains a + * single image is supported, false otherwise. + * @throws IOException + * if an I/O exception has occurred. */ public boolean canWriteEmpty() throws IOException { return checkOutputReturnFalse(); } /** - * Returns true if the methods which taken an IIOImageParameter - * can deal with a Raster source image. + * Returns true if the methods which taken an IIOImageParameter can deal + * with a Raster source image. * - * @return true if the methods which taken an IIOImageParameter - * can deal with a Raster source image, false otherwise. + * @return true if the methods which taken an IIOImageParameter can deal + * with a Raster source image, false otherwise. */ public boolean canWriteRasters() { return false; } /** - * Returns true if the writer can add an image to stream that - * already contains header information. + * Returns true if the writer can add an image to stream that already + * contains header information. * - * @return if the writer can add an image to stream that - * already contains header information, false otherwise. + * @return if the writer can add an image to stream that already contains + * header information, false otherwise. */ public boolean canWriteSequence() { return false; @@ -511,16 +536,18 @@ public abstract class ImageWriter implements ImageTranscoder { /** * Ends the insertion of a new image. * - * @throws IOException Signals that an I/O exception has occurred. + * @throws IOException + * if an I/O exception has occurred. */ public void endInsertEmpty() throws IOException { unsupportedOperation(); } /** - * Ends the repalce pixels operation. + * Ends the replace pixels operation. * - * @throws IOException Signals that an I/O exception has occurred. + * @throws IOException + * if an I/O exception has occurred. */ public void endReplacePixels() throws IOException { unsupportedOperation(); @@ -529,7 +556,8 @@ public abstract class ImageWriter implements ImageTranscoder { /** * Ends an empty write operation. * - * @throws IOException Signals that an I/O exception has occurred. + * @throws IOException + * if an I/O exception has occurred. */ public void endWriteEmpty() throws IOException { unsupportedOperation(); @@ -538,7 +566,8 @@ public abstract class ImageWriter implements ImageTranscoder { /** * Ends the sequence of write operations. * - * @throws IOException Signals that an I/O exception has occurred. + * @throws IOException + * if an I/O exception has occurred. */ public void endWriteSequence() throws IOException { unsupportedOperation(); @@ -558,25 +587,24 @@ public abstract class ImageWriter implements ImageTranscoder { } /** - * Gets an IIOMetadata object that contains default values - * for encoding an image with the specified type. - * - * @param imageType the ImageTypeSpecifier. - * @param param the ImageWriteParam. + * Gets an IIOMetadata object that contains default values for encoding an + * image with the specified type. * + * @param imageType + * the ImageTypeSpecifier. + * @param param + * the ImageWriteParam. * @return the IIOMetadata object. */ - public abstract IIOMetadata getDefaultImageMetadata( - ImageTypeSpecifier imageType, - ImageWriteParam param - ); + public abstract IIOMetadata getDefaultImageMetadata(ImageTypeSpecifier imageType, + ImageWriteParam param); /** - * Gets an IIOMetadata object that contains default values - * for encoding a stream of images. - * - * @param param the ImageWriteParam. + * Gets an IIOMetadata object that contains default values for encoding a + * stream of images. * + * @param param + * the ImageWriteParam. * @return the IIOMetadata object. */ public abstract IIOMetadata getDefaultStreamMetadata(ImageWriteParam param); @@ -591,9 +619,8 @@ public abstract class ImageWriter implements ImageTranscoder { } /** - * Gets the default write param. - * Gets a new ImageWriteParam object for this ImageWriter with the - * current Locale. + * Gets the default write param. Gets a new ImageWriteParam object for this + * ImageWriter with the current Locale. * * @return a new ImageWriteParam object for this ImageWriter. */ @@ -602,124 +629,131 @@ public abstract class ImageWriter implements ImageTranscoder { } /** - * Gets the number of thumbnails suported by the format - * being written with supported image type, image write - * parameters, stream, and image metadata objects. + * Gets the number of thumbnails supported by the format being written with + * supported image type, image write parameters, stream, and image metadata + * objects. * - * @param imageType the ImageTypeSpecifier. - * @param param the image's parameters. - * @param streamMetadata the stream metadata. - * @param imageMetadata the image metadata. - * - * @return the number of thumbnails supported + * @param imageType + * the ImageTypeSpecifier. + * @param param + * the image's parameters. + * @param streamMetadata + * the stream metadata. + * @param imageMetadata + * the image metadata. + * @return the number of thumbnails supported. */ - public int getNumThumbnailsSupported( - ImageTypeSpecifier imageType, - ImageWriteParam param, - IIOMetadata streamMetadata, - IIOMetadata imageMetadata - ) { + public int getNumThumbnailsSupported(ImageTypeSpecifier imageType, ImageWriteParam param, + IIOMetadata streamMetadata, IIOMetadata imageMetadata) { return 0; } /** - * Gets the preferred thumbnail sizes. - * Gets an array of Dimensions with the sizes for thumbnail images - * as they are encoded in the output file or stream. - * - * @param imageType the ImageTypeSpecifier. - * @param param the ImageWriteParam. - * @param streamMetadata the stream metadata. - * @param imageMetadata the image metadata. + * Gets the preferred thumbnail sizes. Gets an array of Dimensions with the + * sizes for thumbnail images as they are encoded in the output file or + * stream. * - * @return the preferred thumbnail sizes + * @param imageType + * the ImageTypeSpecifier. + * @param param + * the ImageWriteParam. + * @param streamMetadata + * the stream metadata. + * @param imageMetadata + * the image metadata. + * @return the preferred thumbnail sizes. */ - public Dimension[] getPreferredThumbnailSizes( - ImageTypeSpecifier imageType, - ImageWriteParam param, - IIOMetadata streamMetadata, - IIOMetadata imageMetadata - ) { + public Dimension[] getPreferredThumbnailSizes(ImageTypeSpecifier imageType, + ImageWriteParam param, IIOMetadata streamMetadata, IIOMetadata imageMetadata) { return null; } /** - * Prepares insertion of an empty image by requesting the insertion of - * a new image into an existing image stream. - * - * @param imageIndex the image index. - * @param imageType the image type. - * @param width the width of the image. - * @param height the height of the image. - * @param imageMetadata the image metadata, or null. - * @param thumbnails the array thumbnails for this image, or null. - * @param param the ImageWriteParam, or null. - * - * @throws IOException Signals that an I/O exception has occurred. - */ - public void prepareInsertEmpty( - int imageIndex, ImageTypeSpecifier imageType, - int width, int height, - IIOMetadata imageMetadata, List thumbnails, - ImageWriteParam param - ) throws IOException { + * Prepares insertion of an empty image by requesting the insertion of a new + * image into an existing image stream. + * + * @param imageIndex + * the image index. + * @param imageType + * the image type. + * @param width + * the width of the image. + * @param height + * the height of the image. + * @param imageMetadata + * the image metadata, or null. + * @param thumbnails + * the array thumbnails for this image, or null. + * @param param + * the ImageWriteParam, or null. + * @throws IOException + * if an I/O exception has occurred. + */ + public void prepareInsertEmpty(int imageIndex, ImageTypeSpecifier imageType, int width, + int height, IIOMetadata imageMetadata, List thumbnails, + ImageWriteParam param) throws IOException { unsupportedOperation(); } /** - * Prepares the writer to call the replacePixels method for the - * specified region. - * - * @param imageIndex the image's index. - * @param region the specified region. + * Prepares the writer to call the replacePixels method for the specified + * region. * - * @throws IOException Signals that an I/O exception has occurred. + * @param imageIndex + * the image's index. + * @param region + * the specified region. + * @throws IOException + * if an I/O exception has occurred. */ public void prepareReplacePixels(int imageIndex, Rectangle region) throws IOException { unsupportedOperation(); } /** - * Prepares the writer for writing an empty image by beginning the - * process of writing a complete image stream that contains a single image - * with undefined pixel values, metadata and thumbnails, - * to the output. - * - * @param streamMetadata the stream metadata. - * @param imageType the image type. - * @param width the width of the image. - * @param height the height of the image. - * @param imageMetadata the image's metadata, or null. - * @param thumbnails the image's thumbnails, or null. - * @param param the image's parameters, or null. - * - * @throws IOException Signals that an I/O exception has occurred. - */ - public void prepareWriteEmpty( - IIOMetadata streamMetadata, ImageTypeSpecifier imageType, - int width, int height, - IIOMetadata imageMetadata, List thumbnails, - ImageWriteParam param - ) throws IOException { + * Prepares the writer for writing an empty image by beginning the process + * of writing a complete image stream that contains a single image with + * undefined pixel values, metadata and thumbnails, to the output. + * + * @param streamMetadata + * the stream metadata. + * @param imageType + * the image type. + * @param width + * the width of the image. + * @param height + * the height of the image. + * @param imageMetadata + * the image's metadata, or null. + * @param thumbnails + * the image's thumbnails, or null. + * @param param + * the image's parameters, or null. + * @throws IOException + * if an I/O exception has occurred. + */ + public void prepareWriteEmpty(IIOMetadata streamMetadata, ImageTypeSpecifier imageType, + int width, int height, IIOMetadata imageMetadata, + List thumbnails, ImageWriteParam param) throws IOException { unsupportedOperation(); } /** - * Prepares a stream to accept calls of writeToSequence method - * using the metadata object. - * - * @param streamMetadata the stream metadata. + * Prepares a stream to accept calls of writeToSequence method using the + * metadata object. * - * @throws IOException Signals that an I/O exception has occurred. + * @param streamMetadata + * the stream metadata. + * @throws IOException + * if an I/O exception has occurred. */ public void prepareWriteSequence(IIOMetadata streamMetadata) throws IOException { unsupportedOperation(); } /** - * Processes the completion of a thumbnail read - * by calling their thumbnailComplete method - * of registered IIOWriteProgressListeners. + * Processes the completion of a thumbnail read by calling their + * thumbnailComplete method of registered IIOWriteProgressListeners. */ protected void processThumbnailComplete() { if (progressListeners != null) { @@ -730,11 +764,11 @@ public abstract class ImageWriter implements ImageTranscoder { } /** - * Processes the current percentage of thumbnail completion - * by calling their thumbnailProgress method of registered - * IIOWriteProgressListeners. + * Processes the current percentage of thumbnail completion by calling their + * thumbnailProgress method of registered IIOWriteProgressListeners. * - * @param percentageDone the percentage done. + * @param percentageDone + * the percentage done. */ protected void processThumbnailProgress(float percentageDone) { if (progressListeners != null) { @@ -745,11 +779,13 @@ public abstract class ImageWriter implements ImageTranscoder { } /** - * Processes the start of a thumbnail read by calling - * thumbnailStarted method of registered IIOWriteProgressListeners. + * Processes the start of a thumbnail read by calling thumbnailStarted + * method of registered IIOWriteProgressListeners. * - * @param imageIndex the image index. - * @param thumbnailIndex the thumbnail index. + * @param imageIndex + * the image index. + * @param thumbnailIndex + * the thumbnail index. */ protected void processThumbnailStarted(int imageIndex, int thumbnailIndex) { if (progressListeners != null) { @@ -760,7 +796,7 @@ public abstract class ImageWriter implements ImageTranscoder { } /** - * Processes that the writing has been aborted by calling writeAborted + * Processes that the writing has been aborted by calling writeAborted * method of registered IIOWriteProgressListeners. */ protected void processWriteAborted() { @@ -789,8 +825,8 @@ public abstract class ImageWriter implements ImageTranscoder { /** * Removes the specified IIOWriteProgressListener listener. * - * @param listener the registered IIOWriteProgressListener - * to be removed. + * @param listener + * the registered IIOWriteProgressListener to be removed. */ public void removeIIOWriteProgressListener(IIOWriteProgressListener listener) { if (progressListeners != null && listener != null) { @@ -803,8 +839,8 @@ public abstract class ImageWriter implements ImageTranscoder { /** * Removes the specified IIOWriteWarningListener listener. * - * @param listener the registered IIOWriteWarningListener listener - * to be removed. + * @param listener + * the registered IIOWriteWarningListener listener to be removed. */ public void removeIIOWriteWarningListener(IIOWriteWarningListener listener) { if (warningListeners == null || listener == null) { @@ -826,9 +862,10 @@ public abstract class ImageWriter implements ImageTranscoder { /** * Removes the image with the specified index from the stream. * - * @param imageIndex the image's index. - * - * @throws IOException Signals that an I/O exception has occurred. + * @param imageIndex + * the image's index. + * @throws IOException + * if an I/O exception has occurred. */ public void removeImage(int imageIndex) throws IOException { unsupportedOperation(); @@ -837,36 +874,42 @@ public abstract class ImageWriter implements ImageTranscoder { /** * Replaces image metadata of the image with specified index. * - * @param imageIndex the image's index. - * @param imageMetadata the image metadata. - * - * @throws IOException Signals that an I/O exception has occurred. + * @param imageIndex + * the image's index. + * @param imageMetadata + * the image metadata. + * @throws IOException + * if an I/O exception has occurred. */ public void replaceImageMetadata(int imageIndex, IIOMetadata imageMetadata) throws IOException { unsupportedOperation(); } /** - * Replaces a part of an image presented in the output - * with the specified RenderedImage. + * Replaces a part of an image presented in the output with the specified + * RenderedImage. * - * @param image the RenderedImage. - * @param param the ImageWriteParam. - * - * @throws IOException Signals that an I/O exception has occurred. + * @param image + * the RenderedImage. + * @param param + * the ImageWriteParam. + * @throws IOException + * if an I/O exception has occurred. */ public void replacePixels(RenderedImage image, ImageWriteParam param) throws IOException { unsupportedOperation(); } /** - * Replaces a part of an image presented in the output - * with the specified Raster. - * - * @param raster the Raster. - * @param param the ImageWriteParam. + * Replaces a part of an image presented in the output with the specified + * Raster. * - * @throws IOException Signals that an I/O exception has occurred. + * @param raster + * the Raster. + * @param param + * the ImageWriteParam. + * @throws IOException + * if an I/O exception has occurred. */ public void replacePixels(Raster raster, ImageWriteParam param) throws IOException { unsupportedOperation(); @@ -875,9 +918,10 @@ public abstract class ImageWriter implements ImageTranscoder { /** * Replaces the stream metadata of the output with new IIOMetadata. * - * @param streamMetadata the new stream metadata. - * - * @throws IOException Signals that an I/O exception has occurred. + * @param streamMetadata + * the new stream metadata. + * @throws IOException + * if an I/O exception has occurred. */ public void replaceStreamMetadata(IIOMetadata streamMetadata) throws IOException { unsupportedOperation(); @@ -886,7 +930,8 @@ public abstract class ImageWriter implements ImageTranscoder { /** * Sets the locale of this ImageWriter. * - * @param locale the new locale. + * @param locale + * the new locale. */ public void setLocale(Locale locale) { if (locale == null) { @@ -924,26 +969,31 @@ public abstract class ImageWriter implements ImageTranscoder { } /** - * Inserts image into existing output stream. - * - * @param imageIndex the image index where an image will be written. - * @param image the specified image to be written. - * @param param the ImageWriteParam, or null. + * Inserts image into existing output stream. * - * @throws IOException Signals that an I/O exception has occurred. + * @param imageIndex + * the image index where an image will be written. + * @param image + * the specified image to be written. + * @param param + * the ImageWriteParam, or null. + * @throws IOException + * if an I/O exception has occurred. */ - public void writeInsert(int imageIndex, IIOImage image, ImageWriteParam param) throws IOException { + public void writeInsert(int imageIndex, IIOImage image, ImageWriteParam param) + throws IOException { unsupportedOperation(); } /** * Writes the specified image to the sequence. * - * @param image the image to be written. - * @param param the ImageWriteParam, or null. - * - * @throws IOException Signals that an I/O exception has occurred - * during writting. + * @param image + * the image to be written. + * @param param + * the ImageWriteParam, or null. + * @throws IOException + * if an I/O exception has occurred during writing. */ public void writeToSequence(IIOImage image, ImageWriteParam param) throws IOException { unsupportedOperation(); diff --git a/awt/javax/imageio/event/IIOReadProgressListener.java b/awt/javax/imageio/event/IIOReadProgressListener.java index 3d658076cf261..2944896396560 100644 --- a/awt/javax/imageio/event/IIOReadProgressListener.java +++ b/awt/javax/imageio/event/IIOReadProgressListener.java @@ -18,86 +18,104 @@ * @author Sergey I. Salishev * @version $Revision: 1.2 $ */ + package javax.imageio.event; import java.util.EventListener; import javax.imageio.ImageReader; /** - * The IIOReadProgressListener interface notifies callers - * about the progress of the image and thumbnail reading methods. + * The IIOReadProgressListener interface notifies callers about the progress of + * the image and thumbnail reading methods. + * + * @since Android 1.0 */ public interface IIOReadProgressListener extends EventListener { /** - * Notifies this listener that the image reading has been completed. + * Notifies this listener that the image reading has been completed. * - * @param source the ImageReader object which calls this method. + * @param source + * the ImageReader object which calls this method. */ void imageComplete(ImageReader source); - + /** * Notifies this listener about the degree of completion of the read call. * - * @param source the ImageReader object which calls this method. - * @param percentageDone the percentage of decoding done. + * @param source + * the ImageReader object which calls this method. + * @param percentageDone + * the percentage of decoding done. */ void imageProgress(ImageReader source, float percentageDone); - + /** - * Notifies this listener that an image read operation has been started. + * Notifies this listener that an image read operation has been started. * - * @param source the ImageReader object which calls this method. - * @param imageIndex the index of the image in an input file or - * stream to be read. + * @param source + * the ImageReader object which calls this method. + * @param imageIndex + * the index of the image in an input file or stream to be read. */ void imageStarted(ImageReader source, int imageIndex); - + /** * Notifies this listener that a read operation has been aborted. * - * @param source the ImageReader object which calls this method. + * @param source + * the ImageReader object which calls this method. */ void readAborted(ImageReader source); - + /** - * Notifies this listener that a sequence of read operations has been completed. + * Notifies this listener that a sequence of read operations has been + * completed. * - * @param source the ImageReader object which calls this method. + * @param source + * the ImageReader object which calls this method. */ void sequenceComplete(ImageReader source); - + /** - * Notifies this listener that a sequence of read operation has been started. + * Notifies this listener that a sequence of read operation has been + * started. * - * @param source the ImageReader object which calls this method. - * @param minIndex the index of the first image to be read. + * @param source + * the ImageReader object which calls this method. + * @param minIndex + * the index of the first image to be read. */ void sequenceStarted(ImageReader source, int minIndex); - + /** * Notifies that a thumbnail read operation has been completed. * - * @param source the ImageReader object which calls this method. + * @param source + * the ImageReader object which calls this method. */ void thumbnailComplete(ImageReader source); - + /** * Notifies this listener about the degree of completion of the read call. * - * @param source the ImageReader object which calls this method. - * @param percentageDone the percentage of decoding done. + * @param source + * the ImageReader object which calls this method. + * @param percentageDone + * the percentage of decoding done. */ void thumbnailProgress(ImageReader source, float percentageDone); - + /** - * Notifies this listener that a thumbnail reading operation has been started. + * Notifies this listener that a thumbnail reading operation has been + * started. * - * @param source the ImageReader object which calls this method. - * @param imageIndex the index of the image in an input file or - * stream to be read. - * @param thumbnailIndex the index of the thumbnail to be read. + * @param source + * the ImageReader object which calls this method. + * @param imageIndex + * the index of the image in an input file or stream to be read. + * @param thumbnailIndex + * the index of the thumbnail to be read. */ void thumbnailStarted(ImageReader source, int imageIndex, int thumbnailIndex); } - diff --git a/awt/javax/imageio/event/IIOReadUpdateListener.java b/awt/javax/imageio/event/IIOReadUpdateListener.java index ce5e2f1a8b555..49bdbcb411f33 100644 --- a/awt/javax/imageio/event/IIOReadUpdateListener.java +++ b/awt/javax/imageio/event/IIOReadUpdateListener.java @@ -18,6 +18,7 @@ * @author Sergey I. Salishev * @version $Revision: 1.2 $ */ + package javax.imageio.event; import java.awt.image.BufferedImage; @@ -30,109 +31,152 @@ import javax.imageio.ImageReader; */ /** - * The IIOReadUpdateListener interface provides functionality - * to receive notification of pixel updates during image and thumbnail - * reading operations. + * The IIOReadUpdateListener interface provides functionality to receive + * notification of pixel updates during image and thumbnail reading operations. + * + * @since Android 1.0 */ public interface IIOReadUpdateListener extends EventListener { /** - * Notifies this listener that the specified area of the image has been updated. + * Notifies this listener that the specified area of the image has been + * updated. * - * @param source the ImageReader object which calls this method. - * @param theImage the image to be updated. - * @param minX the minimum X coordinate of the pixels in the updated area. - * @param minY the minimum Y coordinate of the pixels in the updated area. - * @param width the width of updated area. - * @param height the height of updated area. - * @param periodX the horizontal spacing period between updated - * pixels, if it equals 1, there is no space between pixels. - * @param periodY the vertical spacing period between updated - * pixels, if it equals 1, there is no space between pixels. - * @param bands the array of int values indicating the bands being updated. + * @param source + * the ImageReader object which calls this method. + * @param theImage + * the image to be updated. + * @param minX + * the minimum X coordinate of the pixels in the updated area. + * @param minY + * the minimum Y coordinate of the pixels in the updated area. + * @param width + * the width of updated area. + * @param height + * the height of updated area. + * @param periodX + * the horizontal spacing period between updated pixels, if it + * equals 1, there is no space between pixels. + * @param periodY + * the vertical spacing period between updated pixels, if it + * equals 1, there is no space between pixels. + * @param bands + * the array of integer values indicating the bands being + * updated. */ - void imageUpdate(ImageReader source, BufferedImage theImage, int minX, - int minY, int width, int height, int periodX, int periodY, - int[] bands); - + void imageUpdate(ImageReader source, BufferedImage theImage, int minX, int minY, int width, + int height, int periodX, int periodY, int[] bands); + /** - * Notifies this listener that the current read operation has completed a + * Notifies this listener that the current read operation has completed a * progressive pass. * - * @param source the ImageReader object which calls this method. - * @param theImage the image to be updated. + * @param source + * the ImageReader object which calls this method. + * @param theImage + * the image to be updated. */ void passComplete(ImageReader source, BufferedImage theImage); - + /** - * Notifies this listener that the current read operation has begun - * a progressive pass. + * Notifies this listener that the current read operation has begun a + * progressive pass. * - * @param source the ImageReader object which calls this method. - * @param theImage the image to be updated. - * @param pass the numer of the pass. - * @param minPass the index of the first pass that will be decoded. - * @param maxPass the index of the last pass that will be decoded. - * @param minX the minimum X coordinate of the pixels in the updated area. - * @param minY the minimum Y coordinate of the pixels in the updated area. - * @param periodX the horizontal spacing period between updated - * pixels, if it equals 1, there is no space between pixels. - * @param periodY the vertical spacing period between updated - * pixels, if it equals 1, there is no space between pixels. - * @param bands the array of int values indicating the bands being updated. + * @param source + * the ImageReader object which calls this method. + * @param theImage + * the image to be updated. + * @param pass + * the number of the pass. + * @param minPass + * the index of the first pass that will be decoded. + * @param maxPass + * the index of the last pass that will be decoded. + * @param minX + * the minimum X coordinate of the pixels in the updated area. + * @param minY + * the minimum Y coordinate of the pixels in the updated area. + * @param periodX + * the horizontal spacing period between updated pixels, if it + * equals 1, there is no space between pixels. + * @param periodY + * the vertical spacing period between updated pixels, if it + * equals 1, there is no space between pixels. + * @param bands + * the array of integer values indicating the bands being + * updated. */ - void passStarted(ImageReader source, BufferedImage theImage, int pass, - int minPass, int maxPass, int minX, int minY, int periodX, - int periodY, int[] bands); + void passStarted(ImageReader source, BufferedImage theImage, int pass, int minPass, + int maxPass, int minX, int minY, int periodX, int periodY, int[] bands); /** - * Notifies this listener that the current thumbnail read operation has + * Notifies this listener that the current thumbnail read operation has * completed a progressive pass. * - * @param source the ImageReader object which calls this method. - * @param theImage the thumbnail to be updated. + * @param source + * the ImageReader object which calls this method. + * @param theImage + * the thumbnail to be updated. */ void thumbnailPassComplete(ImageReader source, BufferedImage theImage); - + /** - * Notifies this listener that the current thumbnail read operation has + * Notifies this listener that the current thumbnail read operation has * begun a progressive pass. * - * @param source the ImageReader object which calls this method. - * @param theThumbnail the thumbnail to be updated. - * @param pass the numer of the pass. - * @param minPass the index of the first pass that will be decoded. - * @param maxPass the index of the last pass that will be decoded. - * @param minX the minimum X coordinate of the pixels in the updated area. - * @param minY the minimum Y coordinate of the pixels in the updated area. - * @param periodX the horizontal spacing period between updated - * pixels, if it equals 1, there is no space between pixels. - * @param periodY the vertical spacing period between updated - * pixels, if it equals 1, there is no space between pixels. - * @param bands the array of int values indicating the bands being updated. + * @param source + * the ImageReader object which calls this method. + * @param theThumbnail + * the thumbnail to be updated. + * @param pass + * the number of the pass. + * @param minPass + * the index of the first pass that will be decoded. + * @param maxPass + * the index of the last pass that will be decoded. + * @param minX + * the minimum X coordinate of the pixels in the updated area. + * @param minY + * the minimum Y coordinate of the pixels in the updated area. + * @param periodX + * the horizontal spacing period between updated pixels, if it + * equals 1, there is no space between pixels. + * @param periodY + * the vertical spacing period between updated pixels, if it + * equals 1, there is no space between pixels. + * @param bands + * the array of integer values indicating the bands being + * updated. */ - void thumbnailPassStarted(ImageReader source, BufferedImage theThumbnail, - int pass, int minPass, int maxPass, int minX, int minY, - int periodX, int periodY, int[] bands); - + void thumbnailPassStarted(ImageReader source, BufferedImage theThumbnail, int pass, + int minPass, int maxPass, int minX, int minY, int periodX, int periodY, int[] bands); + /** - * Notifies this listener that a specified area of a thumbnail image has been - * updated. + * Notifies this listener that a specified area of a thumbnail image has + * been updated. * - * @param source the ImageReader object which calls this method. - * @param theThumbnail the thumbnail to be updated. - * @param minX the minimum X coordinate of the pixels in the updated area. - * @param minY the minimum Y coordinate of the pixels in the updated area. - * @param width the width of updated area. - * @param height the height of updated area. - * @param periodX the horizontal spacing period between updated - * pixels, if it equals 1, there is no space between pixels. - * @param periodY the vertical spacing period between updated - * pixels, if it equals 1, there is no space between pixels. - * @param bands the array of int values indicating the bands being updated. + * @param source + * the ImageReader object which calls this method. + * @param theThumbnail + * the thumbnail to be updated. + * @param minX + * the minimum X coordinate of the pixels in the updated area. + * @param minY + * the minimum Y coordinate of the pixels in the updated area. + * @param width + * the width of updated area. + * @param height + * the height of updated area. + * @param periodX + * the horizontal spacing period between updated pixels, if it + * equals 1, there is no space between pixels. + * @param periodY + * the vertical spacing period between updated pixels, if it + * equals 1, there is no space between pixels. + * @param bands + * the array of integer values indicating the bands being + * updated. */ - void thumbnailUpdate(ImageReader source, BufferedImage theThumbnail, - int minX, int minY, int width, int height, int periodX, - int periodY, int[] bands); + void thumbnailUpdate(ImageReader source, BufferedImage theThumbnail, int minX, int minY, + int width, int height, int periodX, int periodY, int[] bands); } - diff --git a/awt/javax/imageio/event/IIOReadWarningListener.java b/awt/javax/imageio/event/IIOReadWarningListener.java index 92fa275adbdd9..318a5df463489 100644 --- a/awt/javax/imageio/event/IIOReadWarningListener.java +++ b/awt/javax/imageio/event/IIOReadWarningListener.java @@ -18,6 +18,7 @@ * @author Sergey I. Salishev * @version $Revision: 1.2 $ */ + package javax.imageio.event; import java.util.EventListener; @@ -29,18 +30,20 @@ import javax.imageio.ImageReader; */ /** - * The IIOReadWarningListener provides methods to receive notification - * of warning messages generated by image - * and thumbnail reading methods. + * The IIOReadWarningListener provides methods to receive notification of + * warning messages generated by image and thumbnail reading methods. + * + * @since Android 1.0 */ public interface IIOReadWarningListener extends EventListener { /** - * Notifies this listener about a warning (non-fatal error) during decoding. + * Notifies this listener about a warning (non-fatal error) during decoding. * - * @param source the ImageReader object which calls this method. - * @param warning the string describing the warning. + * @param source + * the ImageReader object which calls this method. + * @param warning + * the string describing the warning. */ public void warningOccurred(ImageReader source, String warning); } - diff --git a/awt/javax/imageio/event/IIOWriteProgressListener.java b/awt/javax/imageio/event/IIOWriteProgressListener.java index 19ae495ab654f..4a2c595ab2f57 100644 --- a/awt/javax/imageio/event/IIOWriteProgressListener.java +++ b/awt/javax/imageio/event/IIOWriteProgressListener.java @@ -18,69 +18,84 @@ * @author Rustem V. Rafikov * @version $Revision: 1.3 $ */ + package javax.imageio.event; import javax.imageio.ImageWriter; import java.util.EventListener; /** - * The IIOWriteProgressListener interface provides methods to - * receive notification about the progress of the image and - * thumbnail writing methods. + * The IIOWriteProgressListener interface provides methods to receive + * notification about the progress of the image and thumbnail writing methods. + * + * @since Android 1.0 */ public interface IIOWriteProgressListener extends EventListener { - + /** - * Notifies this listener that an image write operation has been started. + * Notifies this listener that an image write operation has been started. * - * @param source the ImageWriter object which calls this method. - * @param imageIndex the index of the image being written. + * @param source + * the ImageWriter object which calls this method. + * @param imageIndex + * the index of the image being written. */ void imageStarted(ImageWriter source, int imageIndex); - + /** * Notifies this listener about the degree of completion of the write call. * - * @param source the ImageWriter object which calls this method. - * @param percentageDone the percentage of encoding done. + * @param source + * the ImageWriter object which calls this method. + * @param percentageDone + * the percentage of encoding done. */ void imageProgress(ImageWriter source, float percentageDone); - + /** - * Notifies this listener that the image writing has been completed. + * Notifies this listener that the image writing has been completed. * - * @param source the ImageWriter object which calls this method. + * @param source + * the ImageWriter object which calls this method. */ void imageComplete(ImageWriter source); - + /** - * Notifies this listener that a thumbnail write operation has been started. + * Notifies this listener that a thumbnail write operation has been started. * - * @param source the ImageWriter object which calls this method. - * @param imageIndex the index of the image being written. - * @param thumbnailIndex the index of the thumbnail being written. + * @param source + * the ImageWriter object which calls this method. + * @param imageIndex + * the index of the image being written. + * @param thumbnailIndex + * the index of the thumbnail being written. */ void thumbnailStarted(ImageWriter source, int imageIndex, int thumbnailIndex); - + /** * Notifies this listener about the degree of completion of the write call. * - * @param source the ImageWriter object which calls this method. - * @param percentageDone the percentage of encoding done. + * @param source + * the ImageWriter object which calls this method. + * @param percentageDone + * the percentage of encoding done. */ void thumbnailProgress(ImageWriter source, float percentageDone); - + /** - * Notifies this listener that a thumbnail write operation has been completed. + * Notifies this listener that a thumbnail write operation has been + * completed. * - * @param source the ImageWriter object which calls this method. + * @param source + * the ImageWriter object which calls this method. */ void thumbnailComplete(ImageWriter source); - + /** * Notifies this listener that writing operation has been aborted. * - * @param source the ImageWriter object which calls this method. + * @param source + * the ImageWriter object which calls this method. */ void writeAborted(ImageWriter source); } diff --git a/awt/javax/imageio/event/IIOWriteWarningListener.java b/awt/javax/imageio/event/IIOWriteWarningListener.java index f530d256e2b77..8ee41cddd0604 100644 --- a/awt/javax/imageio/event/IIOWriteWarningListener.java +++ b/awt/javax/imageio/event/IIOWriteWarningListener.java @@ -18,23 +18,29 @@ * @author Rustem V. Rafikov * @version $Revision: 1.3 $ */ + package javax.imageio.event; import javax.imageio.ImageWriter; import java.util.EventListener; /** - * The IIOWriteWarningListener provides methods to receive notification - * of warnings generated by image and thumbnail writing methods. + * The IIOWriteWarningListener provides methods to receive notification of + * warnings generated by image and thumbnail writing methods. + * + * @since Android 1.0 */ public interface IIOWriteWarningListener extends EventListener { - + /** - * Notifies this listener about a warning (non-fatal error) during encoding. + * Notifies this listener about a warning (non-fatal error) during encoding. * - * @param source the ImageWriter object which calls this method. - * @param imageIndex the index of the image generating the warning. - * @param warning the string describing the warning. + * @param source + * the ImageWriter object which calls this method. + * @param imageIndex + * the index of the image generating the warning. + * @param warning + * the string describing the warning. */ void warningOccurred(ImageWriter source, int imageIndex, String warning); } diff --git a/awt/javax/imageio/event/package.html b/awt/javax/imageio/event/package.html new file mode 100644 index 0000000000000..c2fe39fae42f3 --- /dev/null +++ b/awt/javax/imageio/event/package.html @@ -0,0 +1,8 @@ + + +

    + This package provides interfaces to handle events which can be fired during the reading or writing of images. +

    + @since Android 1.0 + + diff --git a/awt/javax/imageio/metadata/IIOInvalidTreeException.java b/awt/javax/imageio/metadata/IIOInvalidTreeException.java index 8690b2bb65a4c..ba906577b3766 100644 --- a/awt/javax/imageio/metadata/IIOInvalidTreeException.java +++ b/awt/javax/imageio/metadata/IIOInvalidTreeException.java @@ -21,21 +21,26 @@ import org.w3c.dom.Node; import javax.imageio.IIOException; /** - * The IIOInvalidTreeException provides notification about - * fails of IIOMetadataNodes tree parsing by IIOMetadata object. + * The IIOInvalidTreeException provides notification about fails of + * IIOMetadataNodes tree parsing by IIOMetadata object. + * + * @since Android 1.0 */ public class IIOInvalidTreeException extends IIOException { - - /** The offending node. */ + + /** + * The offending node. + */ protected Node offendingNode = null; /** - * Instantiates an IIOInvalidTreeException with the - * specified detailed message and specified offending - * Node. + * Instantiates an IIOInvalidTreeException with the specified detailed + * message and specified offending Node. * - * @param message the detailed message. - * @param offendingNode the offending node. + * @param message + * the detailed message. + * @param offendingNode + * the offending node. */ public IIOInvalidTreeException(String message, Node offendingNode) { super(message); @@ -43,13 +48,15 @@ public class IIOInvalidTreeException extends IIOException { } /** - * Instantiates a new IIOInvalidTreeException with the - * specified detailed message and specified offending - * Node. + * Instantiates a new IIOInvalidTreeException with the specified detailed + * message and specified offending Node. * - * @param message the detailed message. - * @param cause the cause of this exception. - * @param offendingNode the offending node + * @param message + * the detailed message. + * @param cause + * the cause of this exception. + * @param offendingNode + * the offending node. */ public IIOInvalidTreeException(String message, Throwable cause, Node offendingNode) { super(message, cause); diff --git a/awt/javax/imageio/metadata/IIOMetadata.java b/awt/javax/imageio/metadata/IIOMetadata.java index f2387cc6d2c4a..96cebf98d63bf 100644 --- a/awt/javax/imageio/metadata/IIOMetadata.java +++ b/awt/javax/imageio/metadata/IIOMetadata.java @@ -14,6 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package javax.imageio.metadata; import java.util.ArrayList; @@ -22,73 +23,90 @@ import org.apache.harmony.x.imageio.metadata.IIOMetadataUtils; import org.w3c.dom.Node; /** - * The Class IIOMetadata represents the metadata (bundled with an image) - * as a Dom-type tree. + * The class IIOMetadata represents the metadata (bundled with an image) as a + * Dom-type tree. + * + * @since Android 1.0 */ public abstract class IIOMetadata { - /** Whether the standard metadata format is supported. */ + /** + * Whether the standard metadata format is supported. + */ protected boolean standardFormatSupported; - - /** The native metadata format name. */ + + /** + * The native metadata format name. + */ protected String nativeMetadataFormatName; - - /** The native metadata format class name. */ + + /** + * The native metadata format class name. + */ protected String nativeMetadataFormatClassName; - - /** The extra metadata format names. */ + + /** + * The extra metadata format names. + */ protected String[] extraMetadataFormatNames; - - /** The extra metadata format class names. */ + + /** + * The extra metadata format class names. + */ protected String[] extraMetadataFormatClassNames; - - /** The default controller. */ + + /** + * The default controller. + */ protected IIOMetadataController defaultController; - - /** The controller. */ + + /** + * The controller. + */ protected IIOMetadataController controller; /** * Instantiates a new IIOMetadata with no data set. */ - protected IIOMetadata() {} + protected IIOMetadata() { + } /** * Instantiates a new IIOMetadata with the specified data parameters. * - * @param standardMetadataFormatSupported whether the standard metadata format is supported - * @param nativeMetadataFormatName the native metadata format name - * @param nativeMetadataFormatClassName the native metadata format class name - * @param extraMetadataFormatNames the extra metadata format names - * @param extraMetadataFormatClassNames the extra metadata format class names - */ - protected IIOMetadata(boolean standardMetadataFormatSupported, - String nativeMetadataFormatName, - String nativeMetadataFormatClassName, - String[] extraMetadataFormatNames, - String[] extraMetadataFormatClassNames) { + * @param standardMetadataFormatSupported + * whether the standard metadata format is supported. + * @param nativeMetadataFormatName + * the native metadata format name. + * @param nativeMetadataFormatClassName + * the native metadata format class name. + * @param extraMetadataFormatNames + * the extra metadata format names. + * @param extraMetadataFormatClassNames + * the extra metadata format class names. + */ + protected IIOMetadata(boolean standardMetadataFormatSupported, String nativeMetadataFormatName, + String nativeMetadataFormatClassName, String[] extraMetadataFormatNames, + String[] extraMetadataFormatClassNames) { standardFormatSupported = standardMetadataFormatSupported; this.nativeMetadataFormatName = nativeMetadataFormatName; this.nativeMetadataFormatClassName = nativeMetadataFormatClassName; if (extraMetadataFormatNames == null) { if (extraMetadataFormatClassNames != null) { throw new IllegalArgumentException( - "extraMetadataFormatNames == null && extraMetadataFormatClassNames != null!" - ); + "extraMetadataFormatNames == null && extraMetadataFormatClassNames != null!"); } } else { if (extraMetadataFormatClassNames == null) { throw new IllegalArgumentException( - "extraMetadataFormatNames != null && extraMetadataFormatClassNames == null!" - ); + "extraMetadataFormatNames != null && extraMetadataFormatClassNames == null!"); } if (extraMetadataFormatNames.length == 0) { throw new IllegalArgumentException("extraMetadataFormatNames.length == 0!"); } if (extraMetadataFormatClassNames.length != extraMetadataFormatNames.length) { throw new IllegalArgumentException( - "extraMetadataFormatClassNames.length != extraMetadataFormatNames.length!" - ); + "extraMetadataFormatClassNames.length != extraMetadataFormatNames.length!"); } this.extraMetadataFormatNames = extraMetadataFormatNames.clone(); this.extraMetadataFormatClassNames = extraMetadataFormatClassNames.clone(); @@ -98,30 +116,32 @@ public abstract class IIOMetadata { /** * Gets the metadata as tree-type document. * - * @param formatName the format name - * - * @return the node in tree format + * @param formatName + * the format name. + * @return the node in tree format. */ public abstract Node getAsTree(String formatName); - + /** * Checks if the metadata is read only. * * @return true, if the metadata is read only. */ public abstract boolean isReadOnly(); - + /** * Merges the specified tree with this metadata tree. * - * @param formatName the format of the specified tree - * @param root the root node of the metadata tree - * - * @throws IIOInvalidTreeException if the specified tree - * is incompatible with the this metadata tree. + * @param formatName + * the format of the specified tree. + * @param root + * the root node of the metadata tree. + * @throws IIOInvalidTreeException + * if the specified tree is incompatible with the this metadata + * tree. */ public abstract void mergeTree(String formatName, Node root) throws IIOInvalidTreeException; - + /** * Resets the controller. */ @@ -130,7 +150,7 @@ public abstract class IIOMetadata { /** * Gets the controller associated with this metadata document. * - * @return the controller + * @return the controller. */ public IIOMetadataController getController() { return controller; @@ -139,7 +159,7 @@ public abstract class IIOMetadata { /** * Checks whether this metadata has a controller. * - * @return true, if this metadata has a controller + * @return true, if this metadata has a controller. */ public boolean hasController() { return getController() != null; @@ -148,7 +168,7 @@ public abstract class IIOMetadata { /** * Activate the controller. * - * @return true, if successful + * @return true, if successful. */ public boolean activateController() { if (!hasController()) { @@ -160,7 +180,7 @@ public abstract class IIOMetadata { /** * Gets the default controller. * - * @return the default controller + * @return the default controller. */ public IIOMetadataController getDefaultController() { return defaultController; @@ -169,7 +189,7 @@ public abstract class IIOMetadata { /** * Gets the extra metadata format names. * - * @return the extra metadata format names + * @return the extra metadata format names. */ public String[] getExtraMetadataFormatNames() { return extraMetadataFormatNames == null ? null : extraMetadataFormatNames.clone(); @@ -178,23 +198,20 @@ public abstract class IIOMetadata { /** * Gets the metadata format. * - * @param formatName the format name - * - * @return the metadata format + * @param formatName + * the format name. + * @return the metadata format. */ public IIOMetadataFormat getMetadataFormat(String formatName) { - return IIOMetadataUtils.instantiateMetadataFormat( - formatName, - standardFormatSupported, - nativeMetadataFormatName, nativeMetadataFormatClassName, - extraMetadataFormatNames, extraMetadataFormatClassNames - ); + return IIOMetadataUtils.instantiateMetadataFormat(formatName, standardFormatSupported, + nativeMetadataFormatName, nativeMetadataFormatClassName, extraMetadataFormatNames, + extraMetadataFormatClassNames); } /** * Gets the native metadata format name. * - * @return the native metadata format name + * @return the native metadata format name. */ public String getNativeMetadataFormatName() { return nativeMetadataFormatName; @@ -203,7 +220,7 @@ public abstract class IIOMetadata { /** * Checks if the standard metadata format is supported. * - * @return true, if the standard metadata format is supported + * @return true, if the standard metadata format is supported. */ public boolean isStandardMetadataFormatSupported() { return standardFormatSupported; @@ -212,7 +229,7 @@ public abstract class IIOMetadata { /** * Gets the metadata format names. * - * @return the metadata format names + * @return the metadata format names. */ public String[] getMetadataFormatNames() { ArrayList res = new ArrayList(); @@ -239,7 +256,7 @@ public abstract class IIOMetadata { /** * Gets the standard chroma node. * - * @return the standard chroma node + * @return the standard chroma node. */ protected IIOMetadataNode getStandardChromaNode() { return null; @@ -248,7 +265,7 @@ public abstract class IIOMetadata { /** * Gets the standard compression node. * - * @return the standard compression node + * @return the standard compression node. */ protected IIOMetadataNode getStandardCompressionNode() { return null; @@ -257,7 +274,7 @@ public abstract class IIOMetadata { /** * Gets the standard data node. * - * @return the standard data node + * @return the standard data node. */ protected IIOMetadataNode getStandardDataNode() { return null; @@ -266,7 +283,7 @@ public abstract class IIOMetadata { /** * Gets the standard dimension node. * - * @return the standard dimension node + * @return the standard dimension node. */ protected IIOMetadataNode getStandardDimensionNode() { return null; @@ -275,7 +292,7 @@ public abstract class IIOMetadata { /** * Gets the standard document node. * - * @return the standard document node + * @return the standard document node. */ protected IIOMetadataNode getStandardDocumentNode() { return null; @@ -284,7 +301,7 @@ public abstract class IIOMetadata { /** * Gets the standard text node. * - * @return the standard text node + * @return the standard text node. */ protected IIOMetadataNode getStandardTextNode() { return null; @@ -293,7 +310,7 @@ public abstract class IIOMetadata { /** * Gets the standard tile node. * - * @return the standard tile node + * @return the standard tile node. */ protected IIOMetadataNode getStandardTileNode() { return null; @@ -302,7 +319,7 @@ public abstract class IIOMetadata { /** * Gets the standard transparency node. * - * @return the standard transparency node + * @return the standard transparency node. */ protected IIOMetadataNode getStandardTransparencyNode() { return null; @@ -311,7 +328,7 @@ public abstract class IIOMetadata { /** * Gets the metadata as a tree in standard format. * - * @return the metadata as a tree in standard format + * @return the metadata as a tree in standard format. */ protected final IIOMetadataNode getStandardTree() { // Create root node @@ -342,14 +359,15 @@ public abstract class IIOMetadata { if ((node = getStandardTransparencyNode()) != null) { root.appendChild(node); } - + return root; } /** * Sets the controller. * - * @param controller the new controller + * @param controller + * the new controller. */ public void setController(IIOMetadataController controller) { this.controller = controller; @@ -358,11 +376,13 @@ public abstract class IIOMetadata { /** * Sets the from tree. * - * @param formatName the name of the metatdata format of the from tree - * @param root the root node of the from tree - * - * @throws IIOInvalidTreeException if the tree or its format is not compatible with - * this metadata. + * @param formatName + * the name of the metatdata format of the from tree. + * @param root + * the root node of the from tree. + * @throws IIOInvalidTreeException + * if the tree or its format is not compatible with this + * metadata. */ public void setFromTree(String formatName, Node root) throws IIOInvalidTreeException { reset(); diff --git a/awt/javax/imageio/metadata/IIOMetadataController.java b/awt/javax/imageio/metadata/IIOMetadataController.java index dfd4e5c169510..140594830152d 100644 --- a/awt/javax/imageio/metadata/IIOMetadataController.java +++ b/awt/javax/imageio/metadata/IIOMetadataController.java @@ -18,6 +18,7 @@ * @author Sergey I. Salishev * @version $Revision: 1.2 $ */ + package javax.imageio.metadata; /* @@ -26,20 +27,20 @@ package javax.imageio.metadata; */ /** - * The IIOMetadataController interface provides a method for - * implementing objects to activate the controller without - * defining how the controller obtains values. + * The IIOMetadataController interface provides a method for implementing + * objects to activate the controller without defining how the controller + * obtains values. + * + * @since Android 1.0 */ public interface IIOMetadataController { /** * Activates a controller. * - * @param metadata the metadata to be modified. - * - * @return true if the IIOMetadata has been modified, - * false otherwise. + * @param metadata + * the metadata to be modified. + * @return true, if the IIOMetadata has been modified, false otherwise. */ public boolean activate(IIOMetadata metadata); } - diff --git a/awt/javax/imageio/metadata/IIOMetadataFormat.java b/awt/javax/imageio/metadata/IIOMetadataFormat.java index 9e246b48c280c..0e7e6979c2080 100644 --- a/awt/javax/imageio/metadata/IIOMetadataFormat.java +++ b/awt/javax/imageio/metadata/IIOMetadataFormat.java @@ -21,327 +21,384 @@ import javax.imageio.ImageTypeSpecifier; import java.util.Locale; /** - * The Interface IIOMetadataFormat is implemented by classes that - * describe the rules and allowed elements for a metadata document - * tree. + * The Interface IIOMetadataFormat is implemented by classes that describe the + * rules and allowed elements for a metadata document tree. + * + * @since Android 1.0 */ public interface IIOMetadataFormat { - /** The CHILD_POLICY_EMPTY. */ + /** + * The CHILD_POLICY_EMPTY. + */ int CHILD_POLICY_EMPTY = 0; - - /** The CHILD_POLICY_ALL. */ + + /** + * The CHILD_POLICY_ALL. + */ int CHILD_POLICY_ALL = 1; - - /** The CHILD_POLICY_SOME. */ + + /** + * The CHILD_POLICY_SOME. + */ int CHILD_POLICY_SOME = 2; - - /** The CHILD_POLICY_CHOICE. */ + + /** + * The CHILD_POLICY_CHOICE. + */ int CHILD_POLICY_CHOICE = 3; - - /** The CHILD_POLICY_SEQUENCE. */ + + /** + * The CHILD_POLICY_SEQUENCE. + */ int CHILD_POLICY_SEQUENCE = 4; - - /** The CHILD_POLICY_REPEAT. */ + + /** + * The CHILD_POLICY_REPEAT. + */ int CHILD_POLICY_REPEAT = 5; - - /** The maximum value for the child policy. */ + + /** + * The maximum value for the child policy. + */ int CHILD_POLICY_MAX = CHILD_POLICY_REPEAT; - /** The DATATYPE_STRING. */ + /** + * The DATATYPE_STRING. + */ int DATATYPE_STRING = 0; - - /** The DATATYPE_BOOLEAN. */ + + /** + * The DATATYPE_BOOLEAN. + */ int DATATYPE_BOOLEAN = 1; - - /** The DATATYPE_INTEGER. */ + + /** + * The DATATYPE_INTEGER. + */ int DATATYPE_INTEGER = 2; - - /** The DATATYPE_FLOAT. */ + + /** + * The DATATYPE_FLOAT. + */ int DATATYPE_FLOAT = 3; - - /** The DATATYPE_DOUBLE. */ + + /** + * The DATATYPE_DOUBLE. + */ int DATATYPE_DOUBLE = 4; - /** The VALUE_NONE. */ + /** + * The VALUE_NONE. + */ int VALUE_NONE = 0; - - /** The VALUE_ARBITRARY. */ + + /** + * The VALUE_ARBITRARY. + */ int VALUE_ARBITRARY = 1; - - /** The VALUE_RANGE. */ + + /** + * The VALUE_RANGE. + */ int VALUE_RANGE = 2; - - /** The VALUE_RANGE_MIN_INCLUSIVE_MASK. */ + + /** + * The VALUE_RANGE_MIN_INCLUSIVE_MASK. + */ int VALUE_RANGE_MIN_INCLUSIVE_MASK = 4; - - /** The VALUE_RANGE_MAX_INCLUSIVE_MASK. */ + + /** + * The VALUE_RANGE_MAX_INCLUSIVE_MASK. + */ int VALUE_RANGE_MAX_INCLUSIVE_MASK = 8; - - /** The VALUE_ENUMERATION. */ + + /** + * The VALUE_ENUMERATION. + */ int VALUE_ENUMERATION = 16; - - /** The VALUE_LIST. */ + + /** + * The VALUE_LIST. + */ int VALUE_LIST = 32; - - /** The VALUE_RANGE_MIN_INCLUSIVE. */ + + /** + * The VALUE_RANGE_MIN_INCLUSIVE. + */ int VALUE_RANGE_MIN_INCLUSIVE = VALUE_RANGE | VALUE_RANGE_MIN_INCLUSIVE_MASK; - - /** The VALUE_RANGE_MAX_INCLUSIVE. */ + + /** + * The VALUE_RANGE_MAX_INCLUSIVE. + */ int VALUE_RANGE_MAX_INCLUSIVE = VALUE_RANGE | VALUE_RANGE_MAX_INCLUSIVE_MASK; - - /** The VALUE_RANGE_MIN_MAX_INCLUSIVE. */ - int VALUE_RANGE_MIN_MAX_INCLUSIVE = - VALUE_RANGE | VALUE_RANGE_MIN_INCLUSIVE_MASK | VALUE_RANGE_MAX_INCLUSIVE_MASK; /** - * Tells whether the specified element is allowed for the specified - * image type. - * - * @param elementName the element name - * @param imageType the image type - * - * @return true, if the specified element is allowed for the specified - * image type + * The VALUE_RANGE_MIN_MAX_INCLUSIVE. + */ + int VALUE_RANGE_MIN_MAX_INCLUSIVE = VALUE_RANGE | VALUE_RANGE_MIN_INCLUSIVE_MASK + | VALUE_RANGE_MAX_INCLUSIVE_MASK; + + /** + * Tells whether the specified element is allowed for the specified image + * type. + * + * @param elementName + * the element name. + * @param imageType + * the image type. + * @return true, if the specified element is allowed for the specified image + * type. */ boolean canNodeAppear(String elementName, ImageTypeSpecifier imageType); /** * Gets data type of the specified attribute of the specified element. * - * @param elementName the element name - * @param attrName the attribute name - * - * @return the attribute's data type + * @param elementName + * the element name. + * @param attrName + * the attribute name. + * @return the attribute's data type. */ int getAttributeDataType(String elementName, String attrName); - + /** - * Gets the default value of the specified attribute of the specified element. - * - * @param elementName the element name - * @param attrName the attribute name - * - * @return the attribute's default value + * Gets the default value of the specified attribute of the specified + * element. + * + * @param elementName + * the element name. + * @param attrName + * the attribute name. + * @return the attribute's default value. */ String getAttributeDefaultValue(String elementName, String attrName); - + /** * Gets the user-friendly description of the attribute. * - * @param elementName the element name - * @param attrName the attribute name - * @param locale the locale giving the desired language for the - * description - * - * @return the attribute description + * @param elementName + * the element name. + * @param attrName + * the attribute name. + * @param locale + * the locale giving the desired language for the description. + * @return the attribute description. */ String getAttributeDescription(String elementName, String attrName, Locale locale); - + /** * Gets the attribute enumerations. * - * @param elementName the element name - * @param attrName the attribute name - * - * @return the attribute enumerations + * @param elementName + * the element name. + * @param attrName + * the attribute name. + * @return the attribute enumerations. */ String[] getAttributeEnumerations(String elementName, String attrName); - + /** * Gets the maximum length of the attribute list. * - * @param elementName the element name - * @param attrName the attribute name - * - * @return the maximum length of the attribute list + * @param elementName + * the element name. + * @param attrName + * the attribute name. + * @return the maximum length of the attribute list. */ int getAttributeListMaxLength(String elementName, String attrName); - + /** * Gets the minimum length of the attribute list. * - * @param elementName the element name - * @param attrName the attribute name - * - * @return the minimum length of the attribute list + * @param elementName + * the element name. + * @param attrName + * the attribute name. + * @return the minimum length of the attribute list. */ int getAttributeListMinLength(String elementName, String attrName); - + /** * Gets the maximum value allowed for the attribute. * - * @param elementName the element name - * @param attrName the attribute name - * - * @return the maximum value allowed for the attribute + * @param elementName + * the element name. + * @param attrName + * the attribute name. + * @return the maximum value allowed for the attribute. */ String getAttributeMaxValue(String elementName, String attrName); - + /** * Gets the minimum value allowed for the attribute. * - * @param elementName the element name - * @param attrName the attribute name - * - * @return the minimum value allowed for the attribute + * @param elementName + * the element name. + * @param attrName + * the attribute name. + * @return the minimum value allowed for the attribute. */ String getAttributeMinValue(String elementName, String attrName); - + /** * Gets the attribute names allowed for the specified element. * - * @param elementName the element name - * - * @return the attribute names + * @param elementName + * the element name. + * @return the attribute names. */ String[] getAttributeNames(String elementName); - + /** * Gets the attribute value type. * - * @param elementName the element name - * @param attrName the attribute name - * - * @return the attribute value type + * @param elementName + * the element name. + * @param attrName + * the attribute name. + * @return the attribute value type. */ int getAttributeValueType(String elementName, String attrName); - + /** - * Checks whether the specified attribute is required - * for the specified element. - * - * @param elementName the element name - * @param attrName the attribute name - * - * @return true, if the specified attribute is required for the - * specified element + * Checks whether the specified attribute is required for the specified + * element. + * + * @param elementName + * the element name. + * @param attrName + * the attribute name. + * @return true, if the specified attribute is required for the specified + * element. */ boolean isAttributeRequired(String elementName, String attrName); /** * Gets the names of the possible child elements for the given element. * - * @param elementName the element name - * - * @return the child names + * @param elementName + * the element name. + * @return the child names. */ String[] getChildNames(String elementName); - + /** * Gets the constant describing the element's child policy. * - * @param elementName the element name - * - * @return the child policy + * @param elementName + * the element name. + * @return the child policy. */ int getChildPolicy(String elementName); /** * Gets the user-friendly description of the element. * - * @param elementName the element name - * @param locale the locale giving the desired language for the - * description - * - * @return the element description + * @param elementName + * the element name. + * @param locale + * the locale giving the desired language for the description. + * @return the element description. */ String getElementDescription(String elementName, Locale locale); - + /** * Gets the maximum number of children allowed for the element. * - * @param elementName the element name - * - * @return the maximum number of children allowed for the element + * @param elementName + * the element name. + * @return the maximum number of children allowed for the element. */ int getElementMaxChildren(String elementName); - + /** * Gets the minimum number of children allowed for the element. * - * @param elementName the element name - * - * @return the minimum number of children allowed for the element + * @param elementName + * the element name. + * @return the minimum number of children allowed for the element. */ int getElementMinChildren(String elementName); /** * Gets the maximum object array length allowed for the element. * - * @param elementName the element name - * - * @return the maximum object array length allowed for the element + * @param elementName + * the element name. + * @return the maximum object array length allowed for the element. */ int getObjectArrayMaxLength(String elementName); - + /** * Gets the minimum object array length allowed for the element. * - * @param elementName the element name - * - * @return the minimum object array length allowed for the element + * @param elementName + * the element name. + * @return the minimum object array length allowed for the element. */ int getObjectArrayMinLength(String elementName); - + /** * Gets the object class corresponding to the specified element. * - * @param elementName the element name - * - * @return the object class corresponding to the specified element + * @param elementName + * the element name. + * @return the object class corresponding to the specified element. */ Class getObjectClass(String elementName); - + /** * Gets the object default value for the element. * - * @param elementName the element name - * - * @return the object default value for the element + * @param elementName + * the element name. + * @return the object default value for the element. */ Object getObjectDefaultValue(String elementName); - + /** * Gets the object enumerations. * - * @param elementName the element name - * - * @return the object enumerations + * @param elementName + * the element name. + * @return the object enumerations. */ Object[] getObjectEnumerations(String elementName); - + /** * Gets the maximum value allowed for the element's object. * - * @param elementName the element name - * - * @return the maximum value allowed for the element's object + * @param elementName + * the element name. + * @return the maximum value allowed for the element's object. */ Comparable getObjectMaxValue(String elementName); - + /** * Gets the minimum value allowed for the element's object. * - * @param elementName the element name - * - * @return the minimum value allowed for the element's object + * @param elementName + * the element name. + * @return the minimum value allowed for the element's object. */ Comparable getObjectMinValue(String elementName); - + /** * Gets the constant that indicates the type of the element's value. * - * @param elementName the element name - * - * @return the constant that indicates the type of the element's value + * @param elementName + * the element name. + * @return the constant that indicates the type of the element's value. */ int getObjectValueType(String elementName); /** * Gets the name of the root element. * - * @return the name of the root element + * @return the name of the root element. */ String getRootName(); } diff --git a/awt/javax/imageio/metadata/IIOMetadataFormatImpl.java b/awt/javax/imageio/metadata/IIOMetadataFormatImpl.java index 438ae909560f2..1a6e5685386a2 100644 --- a/awt/javax/imageio/metadata/IIOMetadataFormatImpl.java +++ b/awt/javax/imageio/metadata/IIOMetadataFormatImpl.java @@ -23,45 +23,60 @@ import java.security.AccessController; import java.security.PrivilegedAction; /** - * The IIOMetadataFormatImpl class provides an implementation of the + * The IIOMetadataFormatImpl class provides an implementation of the * IIOMetadataFormat interface. + * + * @since Android 1.0 */ public abstract class IIOMetadataFormatImpl implements IIOMetadataFormat { - - /** The Constant standardMetadataFormatName. */ - @SuppressWarnings({"ConstantDeclaredInAbstractClass"}) + + /** + * The Constant standardMetadataFormatName. + */ + @SuppressWarnings( { + "ConstantDeclaredInAbstractClass" + }) public static final String standardMetadataFormatName = "javax_imageio_1.0"; - /** The standard format. */ - @SuppressWarnings({"StaticNonFinalField"}) + /** + * The standard format. + */ + @SuppressWarnings( { + "StaticNonFinalField" + }) private static IIOMetadataFormatImpl standardFormat; - /** The root name. */ + /** + * The root name. + */ private String rootName; - - /** The element hash. */ + + /** + * The element hash. + */ private HashMap elementHash = new HashMap(); - /** The resource base name. */ + /** + * The resource base name. + */ private String resourceBaseName = getClass().getName() + "Resources"; /** - * Instantiates an IIOMetadataFormatImpl with the specified root - * name and child policy (not CHILD_POLICY_REPEAT). + * Instantiates an IIOMetadataFormatImpl with the specified root name and + * child policy (not CHILD_POLICY_REPEAT). * - * @param rootName the name of root element. - * @param childPolicy the child policy defined by one of the - * CHILD_POLICY_* constants (except CHILD_POLICY_REPEAT). + * @param rootName + * the name of root element. + * @param childPolicy + * the child policy defined by one of the CHILD_POLICY_* + * constants (except CHILD_POLICY_REPEAT). */ public IIOMetadataFormatImpl(String rootName, int childPolicy) { if (rootName == null) { throw new IllegalArgumentException("rootName is null"); } - if ( - childPolicy < CHILD_POLICY_EMPTY || - childPolicy > CHILD_POLICY_MAX || - childPolicy == CHILD_POLICY_REPEAT - ) { + if (childPolicy < CHILD_POLICY_EMPTY || childPolicy > CHILD_POLICY_MAX + || childPolicy == CHILD_POLICY_REPEAT) { throw new IllegalArgumentException("childPolicy is not one of the predefined constants"); } @@ -73,12 +88,15 @@ public abstract class IIOMetadataFormatImpl implements IIOMetadataFormat { } /** - * Instantiates an IIOMetadataFormatImpl with the specified root - * name and CHILD_POLICY_REPEAT child policy. + * Instantiates an IIOMetadataFormatImpl with the specified root name and + * CHILD_POLICY_REPEAT child policy. * - * @param rootName the name of root element. - * @param minChildren the minimum number of children. - * @param maxChildren the maximum number of children + * @param rootName + * the name of root element. + * @param minChildren + * the minimum number of children. + * @param maxChildren + * the maximum number of children */ public IIOMetadataFormatImpl(String rootName, int minChildren, int maxChildren) { if (rootName == null) { @@ -100,25 +118,31 @@ public abstract class IIOMetadataFormatImpl implements IIOMetadataFormat { elementHash.put(rootName, root); } - @SuppressWarnings({"AbstractMethodOverridesAbstractMethod"}) + @SuppressWarnings( { + "AbstractMethodOverridesAbstractMethod" + }) public abstract boolean canNodeAppear(String elementName, ImageTypeSpecifier imageType); /** * Adds a new attribute to an existing element. * - * @param elementName the name of the element to which the new attribute - * will be added. - * @param attrName the attribute name. - * @param dataType the data type of the new attribute. - * @param required the flag which indicates whether this attribute - * must be present. - * @param listMinLength the minimum legal number of list items. - * @param listMaxLength the the maximum legal number of list items. - */ - protected void addAttribute( - String elementName, String attrName, int dataType, - boolean required, int listMinLength, int listMaxLength - ) { + * @param elementName + * the name of the element to which the new attribute will be + * added. + * @param attrName + * the attribute name. + * @param dataType + * the data type of the new attribute. + * @param required + * the flag which indicates whether this attribute must be + * present. + * @param listMinLength + * the minimum legal number of list items. + * @param listMaxLength + * the the maximum legal number of list items. + */ + protected void addAttribute(String elementName, String attrName, int dataType, + boolean required, int listMinLength, int listMaxLength) { if (attrName == null) { throw new IllegalArgumentException("attrName == null!"); } @@ -144,18 +168,21 @@ public abstract class IIOMetadataFormatImpl implements IIOMetadataFormat { /** * Adds a new attribute to an existing element. * - * @param elementName the name of the element to which the new attribute - * will be added. - * @param attrName the attribute name. - * @param dataType the data type of the new attribute. - * @param required the flag which indicates whether this attribute - * must be present. - * @param defaultValue the default value of the attribute. - */ - protected void addAttribute( - String elementName, String attrName, int dataType, - boolean required, String defaultValue - ) { + * @param elementName + * the name of the element to which the new attribute will be + * added. + * @param attrName + * the attribute name. + * @param dataType + * the data type of the new attribute. + * @param required + * the flag which indicates whether this attribute must be + * present. + * @param defaultValue + * the default value of the attribute. + */ + protected void addAttribute(String elementName, String attrName, int dataType, + boolean required, String defaultValue) { if (attrName == null) { throw new IllegalArgumentException("attrName == null!"); } @@ -177,20 +204,23 @@ public abstract class IIOMetadataFormatImpl implements IIOMetadataFormat { /** * Adds a new attribute to an existing element. * - * @param elementName the name of the element to which the new attribute - * will be added. - * @param attrName the attribute name. - * @param dataType the data type of the new attribute. - * @param required the flag which indicates whether this attribute - * must be present. - * @param defaultValue the default value of the attribute. - * @param enumeratedValues the legal values for the attribute as - * a list of strings. - */ - protected void addAttribute( - String elementName, String attrName, int dataType, - boolean required, String defaultValue, List enumeratedValues - ) { + * @param elementName + * the name of the element to which the new attribute will be + * added. + * @param attrName + * the attribute name. + * @param dataType + * the data type of the new attribute. + * @param required + * the flag which indicates whether this attribute must be + * present. + * @param defaultValue + * the default value of the attribute. + * @param enumeratedValues + * the legal values for the attribute as a list of strings. + */ + protected void addAttribute(String elementName, String attrName, int dataType, + boolean required, String defaultValue, List enumeratedValues) { if (attrName == null) { throw new IllegalArgumentException("attrName == null!"); } @@ -226,26 +256,30 @@ public abstract class IIOMetadataFormatImpl implements IIOMetadataFormat { /** * Adds a new attribute to an existing element. * - * @param elementName the name of the element to which the new attribute - * will be added. - * @param attrName the attribute name. - * @param dataType the data type of the new attribute. - * @param required the flag which indicates whether this attribute - * must be present. - * @param defaultValue the default value of attribute. - * @param minValue the minimum legal value of an attribute. - * @param maxValue the maximum legal value of an attribute. - * @param minInclusive the flag which indicates - * whether the minValue is inclusive. - * @param maxInclusive the flag which indicates - * whether the maxValue is inclusive. - */ - protected void addAttribute( - String elementName, String attrName, int dataType, - boolean required, String defaultValue, - String minValue, String maxValue, - boolean minInclusive, boolean maxInclusive - ) { + * @param elementName + * the name of the element to which the new attribute will be + * added. + * @param attrName + * the attribute name. + * @param dataType + * the data type of the new attribute. + * @param required + * the flag which indicates whether this attribute must be + * present. + * @param defaultValue + * the default value of attribute. + * @param minValue + * the minimum legal value of an attribute. + * @param maxValue + * the maximum legal value of an attribute. + * @param minInclusive + * the flag which indicates whether the minValue is inclusive. + * @param maxInclusive + * the flag which indicates whether the maxValue is inclusive. + */ + protected void addAttribute(String elementName, String attrName, int dataType, + boolean required, String defaultValue, String minValue, String maxValue, + boolean minInclusive, boolean maxInclusive) { if (attrName == null) { throw new IllegalArgumentException("attrName == null!"); } @@ -272,20 +306,21 @@ public abstract class IIOMetadataFormatImpl implements IIOMetadataFormat { } /** - * Adds a new attribute with boolean data type to an existing - * element. + * Adds a new attribute with boolean data type to an existing element. * - * @param elementName the name of the element to which the new attribute - * will be added. - * @param attrName the attribute name. - * @param hasDefaultValue the flag which indicates whether this attribute - * must have a default value. - * @param defaultValue the default value. - */ - protected void addBooleanAttribute( - String elementName, String attrName, - boolean hasDefaultValue, boolean defaultValue - ) { + * @param elementName + * the name of the element to which the new attribute will be + * added. + * @param attrName + * the attribute name. + * @param hasDefaultValue + * the flag which indicates whether this attribute must have a + * default value. + * @param defaultValue + * the default value. + */ + protected void addBooleanAttribute(String elementName, String attrName, + boolean hasDefaultValue, boolean defaultValue) { String defaultVal = hasDefaultValue ? (defaultValue ? "TRUE" : "FALSE") : null; ArrayList values = new ArrayList(2); values.add("TRUE"); @@ -295,11 +330,13 @@ public abstract class IIOMetadataFormatImpl implements IIOMetadataFormat { } /** - * Adds an existing element to the list of child elements - * of the specified parent element. + * Adds an existing element to the list of child elements of the specified + * parent element. * - * @param elementName the name of the element to be added. - * @param parentName the parent element name. + * @param elementName + * the name of the element to be added. + * @param parentName + * the parent element name. */ protected void addChildElement(String elementName, String parentName) { Element parent = findElement(parentName); @@ -308,23 +345,23 @@ public abstract class IIOMetadataFormatImpl implements IIOMetadataFormat { } /** - * Adds a new element type to this IIOMetadataFormat with - * a child policy (if policy is not CHILD_POLICY_REPEAT). + * Adds a new element type to this IIOMetadataFormat with a child policy (if + * policy is not CHILD_POLICY_REPEAT). * - * @param elementName the name of the element to be added. - * @param parentName the parent element name. - * @param childPolicy one of the CHILD_POLICY_* constants defined - * by IIOMetadataFormat. + * @param elementName + * the name of the element to be added. + * @param parentName + * the parent element name. + * @param childPolicy + * one of the CHILD_POLICY_* constants defined by + * IIOMetadataFormat. */ protected void addElement(String elementName, String parentName, int childPolicy) { - if ( - childPolicy < CHILD_POLICY_EMPTY || - childPolicy > CHILD_POLICY_MAX || - childPolicy == CHILD_POLICY_REPEAT - ) { + if (childPolicy < CHILD_POLICY_EMPTY || childPolicy > CHILD_POLICY_MAX + || childPolicy == CHILD_POLICY_REPEAT) { throw new IllegalArgumentException("childPolicy is not one of the predefined constants"); } - + Element parent = findElement(parentName); Element element = new Element(); element.name = elementName; @@ -334,19 +371,21 @@ public abstract class IIOMetadataFormatImpl implements IIOMetadataFormat { } /** - * Adds a new element type to this IIOMetadataFormat with - * CHILD_POLICY_REPEAT and the specified minimum and maximum - * number of child elements. + * Adds a new element type to this IIOMetadataFormat with + * CHILD_POLICY_REPEAT and the specified minimum and maximum number of child + * elements. * - * @param elementName the element name to be added. - * @param parentName the parent element name. - * @param minChildren the minimum number of child elements. - * @param maxChildren the maximum number of child elements. - */ - protected void addElement( - String elementName, String parentName, - int minChildren, int maxChildren - ) { + * @param elementName + * the element name to be added. + * @param parentName + * the parent element name. + * @param minChildren + * the minimum number of child elements. + * @param maxChildren + * the maximum number of child elements. + */ + protected void addElement(String elementName, String parentName, int minChildren, + int maxChildren) { if (minChildren < 0) { throw new IllegalArgumentException("minChildren < 0!"); } @@ -365,19 +404,20 @@ public abstract class IIOMetadataFormatImpl implements IIOMetadataFormat { } /** - * Adds an Object reference with the specified class type to be - * stored as element's value. + * Adds an Object reference with the specified class type to be stored as + * element's value. * - * @param elementName the element name. - * @param classType the class indicates the legal types for - * the object's value. - * @param arrayMinLength the minimum legal length for the array. - * @param arrayMaxLength the maximum legal length for the array. - */ - protected void addObjectValue( - String elementName, Class classType, - int arrayMinLength, int arrayMaxLength - ) { + * @param elementName + * the element name. + * @param classType + * the class indicates the legal types for the object's value. + * @param arrayMinLength + * the minimum legal length for the array. + * @param arrayMaxLength + * the maximum legal length for the array. + */ + protected void addObjectValue(String elementName, Class classType, int arrayMinLength, + int arrayMaxLength) { Element element = findElement(elementName); ObjectValue objVal = new ObjectValue(); @@ -390,20 +430,20 @@ public abstract class IIOMetadataFormatImpl implements IIOMetadataFormat { } /** - * Adds an Object reference with the specified class type to be - * stored as an element's value. + * Adds an Object reference with the specified class type to be stored as an + * element's value. * - * @param elementName the element name. - * @param classType the class indicates the legal types for - * the object's value. - * @param required a flag indicated that this object value - * must be present. - * @param defaultValue the default value, or null. - */ - protected void addObjectValue( - String elementName, Class classType, - boolean required, T defaultValue - ) { + * @param elementName + * the element name. + * @param classType + * the class indicates the legal types for the object's value. + * @param required + * a flag indicated that this object value must be present. + * @param defaultValue + * the default value, or null. + */ + protected void addObjectValue(String elementName, Class classType, boolean required, + T defaultValue) { // note: reqired is an unused parameter Element element = findElement(elementName); @@ -416,22 +456,22 @@ public abstract class IIOMetadataFormatImpl implements IIOMetadataFormat { } /** - * Adds an Object reference with the specified class type to be - * stored as the element's value. + * Adds an Object reference with the specified class type to be stored as + * the element's value. * - * @param elementName the element name. - * @param classType the class indicates the legal types for - * the object value. - * @param required a flag indicated that this object value - * must be present. - * @param defaultValue the default value, or null. - * @param enumeratedValues the list of legal values for the object. - */ - protected void addObjectValue( - String elementName, Class classType, - boolean required, T defaultValue, - List enumeratedValues - ) { + * @param elementName + * the element name. + * @param classType + * the class indicates the legal types for the object value. + * @param required + * a flag indicated that this object value must be present. + * @param defaultValue + * the default value, or null. + * @param enumeratedValues + * the list of legal values for the object. + */ + protected void addObjectValue(String elementName, Class classType, boolean required, + T defaultValue, List enumeratedValues) { // note: reqired is an unused parameter if (enumeratedValues == null || enumeratedValues.isEmpty()) { throw new IllegalArgumentException("enumeratedValues is empty or null"); @@ -444,7 +484,8 @@ public abstract class IIOMetadataFormatImpl implements IIOMetadataFormat { } } } catch (ClassCastException e) { - throw new IllegalArgumentException("enumeratedValues contains a value not of class classType!"); + throw new IllegalArgumentException( + "enumeratedValues contains a value not of class classType!"); } Element element = findElement(elementName); @@ -459,25 +500,27 @@ public abstract class IIOMetadataFormatImpl implements IIOMetadataFormat { } /** - * Adds an Object reference with the specified class type to be - * stored as the element's value. + * Adds an Object reference with the specified class type to be stored as + * the element's value. * - * @param elementName the element name. - * @param classType the class indicates the legal types for - * the object value. - * @param defaultValue the default value, or null. - * @param minValue the minimum legal value for the object value. - * @param maxValue the maximum legal value for the object value. - * @param minInclusive the flag which indicates - * whether the minValue is inclusive. - * @param maxInclusive the flag which indicates - * whether the maxValue is inclusive. - */ - protected > void addObjectValue( - String elementName, Class classType, - T defaultValue, Comparable minValue, Comparable maxValue, - boolean minInclusive, boolean maxInclusive - ) { + * @param elementName + * the element name. + * @param classType + * the class indicates the legal types for the object value. + * @param defaultValue + * the default value, or null. + * @param minValue + * the minimum legal value for the object value. + * @param maxValue + * the maximum legal value for the object value. + * @param minInclusive + * the flag which indicates whether the minValue is inclusive. + * @param maxInclusive + * the flag which indicates whether the maxValue is inclusive. + */ + protected > void addObjectValue(String elementName, + Class classType, T defaultValue, Comparable minValue, + Comparable maxValue, boolean minInclusive, boolean maxInclusive) { Element element = findElement(elementName); ObjectValue objVal = new ObjectValue(); @@ -540,7 +583,7 @@ public abstract class IIOMetadataFormatImpl implements IIOMetadataFormat { if ((attr.valueType & VALUE_RANGE) == 0) { throw new IllegalArgumentException("Attribute is not a range!"); } - return attr.maxValue; + return attr.maxValue; } public String getAttributeMinValue(String elementName, String attrName) { @@ -558,12 +601,13 @@ public abstract class IIOMetadataFormatImpl implements IIOMetadataFormat { public int getAttributeValueType(String elementName, String attrName) { Attlist attr = findAttribute(elementName, attrName); - return attr.valueType; + return attr.valueType; } public String[] getChildNames(String elementName) { Element element = findElement(elementName); - if (element.childPolicy == CHILD_POLICY_EMPTY) { // Element cannot have children + if (element.childPolicy == CHILD_POLICY_EMPTY) { // Element cannot have + // children return null; } return element.children.toArray(new String[element.children.size()]); @@ -689,10 +733,12 @@ public abstract class IIOMetadataFormatImpl implements IIOMetadataFormat { } /** - * Removes the specified attribute from the specified element. - * - * @param elementName the specified element name. - * @param attrName the specified attribute name. + * Removes the specified attribute from the specified element. + * + * @param elementName + * the specified element name. + * @param attrName + * the specified attribute name. */ protected void removeAttribute(String elementName, String attrName) { Element element = findElement(elementName); @@ -702,7 +748,8 @@ public abstract class IIOMetadataFormatImpl implements IIOMetadataFormat { /** * Removes the specified element from this format. * - * @param elementName the specified element name. + * @param elementName + * the specified element name. */ protected void removeElement(String elementName) { Element element; @@ -717,18 +764,20 @@ public abstract class IIOMetadataFormatImpl implements IIOMetadataFormat { /** * Removes the object value from the specified element. * - * @param elementName the element name. + * @param elementName + * the element name. */ protected void removeObjectValue(String elementName) { Element element = findElement(elementName); element.objectValue = null; } - + /** - * Sets a new base name for ResourceBundles containing - * descriptions of elements and attributes for this format. + * Sets a new base name for ResourceBundles containing descriptions of + * elements and attributes for this format. * - * @param resourceBaseName the new resource base name. + * @param resourceBaseName + * the new resource base name. */ protected void setResourceBaseName(String resourceBaseName) { if (resourceBaseName == null) { @@ -740,117 +789,181 @@ public abstract class IIOMetadataFormatImpl implements IIOMetadataFormat { /** * The Class Element. */ - @SuppressWarnings({"ClassWithoutConstructor"}) + @SuppressWarnings( { + "ClassWithoutConstructor" + }) private class Element { - - /** The name. */ + + /** + * The name. + */ String name; - /** The children. */ + /** + * The children. + */ ArrayList children = new ArrayList(); - - /** The attributes. */ + + /** + * The attributes. + */ HashMap attributes = new HashMap(); - /** The min children. */ + /** + * The min children. + */ int minChildren; - - /** The max children. */ + + /** + * The max children. + */ int maxChildren; - - /** The child policy. */ + + /** + * The child policy. + */ int childPolicy; - /** The object value. */ + /** + * The object value. + */ ObjectValue objectValue; } /** * The Class Attlist. */ - @SuppressWarnings({"ClassWithoutConstructor"}) + @SuppressWarnings( { + "ClassWithoutConstructor" + }) private class Attlist { - - /** The name. */ + + /** + * The name. + */ String name; - /** The data type. */ + /** + * The data type. + */ int dataType; - - /** The required. */ + + /** + * The required. + */ boolean required; - - /** The list min length. */ + + /** + * The list min length. + */ int listMinLength; - - /** The list max length. */ + + /** + * The list max length. + */ int listMaxLength; - - /** The default value. */ + + /** + * The default value. + */ String defaultValue; - - /** The enumerated values. */ + + /** + * The enumerated values. + */ List enumeratedValues; - - /** The min value. */ + + /** + * The min value. + */ String minValue; - - /** The max value. */ + + /** + * The max value. + */ String maxValue; - - /** The min inclusive. */ + + /** + * The min inclusive. + */ boolean minInclusive; - - /** The max inclusive. */ + + /** + * The max inclusive. + */ boolean maxInclusive; - /** The value type. */ + /** + * The value type. + */ int valueType; } /** * The Class ObjectValue. */ - @SuppressWarnings({"ClassWithoutConstructor"}) + @SuppressWarnings( { + "ClassWithoutConstructor" + }) private class ObjectValue { - - /** The class type. */ + + /** + * The class type. + */ Class classType; - - /** The array min length. */ + + /** + * The array min length. + */ int arrayMinLength; - - /** The array max length. */ + + /** + * The array max length. + */ int arrayMaxLength; - - /** The default value. */ + + /** + * The default value. + */ T defaultValue; - - /** The enumerated values. */ + + /** + * The enumerated values. + */ List enumeratedValues; - - /** The min value. */ + + /** + * The min value. + */ Comparable minValue; - - /** The max value. */ + + /** + * The max value. + */ Comparable maxValue; - - /** The min inclusive. */ + + /** + * The min inclusive. + */ boolean minInclusive; - - /** The max inclusive. */ + + /** + * The max inclusive. + */ boolean maxInclusive; - /** The value type. */ + /** + * The value type. + */ int valueType; } /** * Find element. * - * @param name the name - * - * @return the element + * @param name + * the name. + * @return the element. */ private Element findElement(String name) { Element element; @@ -864,16 +977,18 @@ public abstract class IIOMetadataFormatImpl implements IIOMetadataFormat { /** * Find attribute. * - * @param elementName the element name - * @param attributeName the attribute name - * - * @return the attlist + * @param elementName + * the element name. + * @param attributeName + * the attribute name. + * @return the attlist. */ private Attlist findAttribute(String elementName, String attributeName) { Element element = findElement(elementName); Attlist attribute; if ((attribute = element.attributes.get(attributeName)) == null) { - throw new IllegalArgumentException("attribute name is null or no such attribute: " + attributeName); + throw new IllegalArgumentException("attribute name is null or no such attribute: " + + attributeName); } return attribute; @@ -882,9 +997,9 @@ public abstract class IIOMetadataFormatImpl implements IIOMetadataFormat { /** * Find object value. * - * @param elementName the element name - * - * @return the object value + * @param elementName + * the element name. + * @return the object value. */ private ObjectValue findObjectValue(String elementName) { Element element = findElement(elementName); @@ -898,23 +1013,25 @@ public abstract class IIOMetadataFormatImpl implements IIOMetadataFormat { /** * Gets the resource string. * - * @param key the key - * @param locale the locale - * - * @return the resource string + * @param key + * the key. + * @param locale + * the locale. + * @return the resource string. */ private String getResourceString(String key, Locale locale) { if (locale == null) { locale = Locale.getDefault(); } - // Get the context class loader and try to locate the bundle with it first - ClassLoader contextClassloader = AccessController.doPrivileged( - new PrivilegedAction() { + // Get the context class loader and try to locate the bundle with it + // first + ClassLoader contextClassloader = AccessController + .doPrivileged(new PrivilegedAction() { public ClassLoader run() { return Thread.currentThread().getContextClassLoader(); } - }); + }); // Now try to get the resource bundle ResourceBundle rb; diff --git a/awt/javax/imageio/metadata/IIOMetadataNode.java b/awt/javax/imageio/metadata/IIOMetadataNode.java index d5ab7a52b41f0..adc6d67b62b2d 100644 --- a/awt/javax/imageio/metadata/IIOMetadataNode.java +++ b/awt/javax/imageio/metadata/IIOMetadataNode.java @@ -27,47 +27,71 @@ import org.w3c.dom.Element; import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; import org.w3c.dom.NodeList; + //???AWT //import org.w3c.dom.TypeInfo; //import org.w3c.dom.UserDataHandler; /** - * The Class IIOMetadataNode represents a node of the - * (DOM-style) metadata tree. + * The Class IIOMetadataNode represents a node of the (DOM-style) metadata tree. + * + * @since Android 1.0 */ public class IIOMetadataNode implements Element, NodeList { - /** The node name. */ + /** + * The node name. + */ private String nodeName; - - /** The node value. */ + + /** + * The node value. + */ private String nodeValue; - - /** The attributes. */ + + /** + * The attributes. + */ private IIOMetadataNodeList attrs = new IIOMetadataNodeList(new ArrayList()); - /** The parent node. */ + /** + * The parent node. + */ private IIOMetadataNode parent; - - /** The first child node. */ + + /** + * The first child node. + */ private IIOMetadataNode firstChild; - - /** The last child node. */ + + /** + * The last child node. + */ private IIOMetadataNode lastChild; - - /** The previous sibling. */ + + /** + * The previous sibling. + */ private IIOMetadataNode previousSibling; - - /** The next sibling. */ + + /** + * The next sibling. + */ private IIOMetadataNode nextSibling; - /** The number of children. */ + /** + * The number of children. + */ private int nChildren; - /** The user object associated with this node. */ + /** + * The user object associated with this node. + */ private Object userObject; - /** The text content of this node. */ + /** + * The text content of this node. + */ private String textContent; /** @@ -79,18 +103,20 @@ public class IIOMetadataNode implements Element, NodeList { /** * Instantiates a new empty node with the specified name. * - * @param nodeName the node name + * @param nodeName + * the node name. */ public IIOMetadataNode(String nodeName) { this.nodeName = nodeName; } /** - * Instantiates a new IIOMetadataNode with the specified - * name and value. + * Instantiates a new IIOMetadataNode with the specified name and value. * - * @param nodeName the node name - * @param nodeValue the node value + * @param nodeName + * the node name. + * @param nodeValue + * the node value. */ private IIOMetadataNode(String nodeName, String nodeValue) { this.nodeName = nodeName; @@ -102,12 +128,12 @@ public class IIOMetadataNode implements Element, NodeList { } public String getAttribute(String name) { - Attr attrNode = (Attr) attrs.getNamedItem(name); + Attr attrNode = (Attr)attrs.getNamedItem(name); return (attrNode == null) ? "" : attrNode.getValue(); } public void setAttribute(String name, String value) throws DOMException { - Attr attr = (Attr) attrs.getNamedItem(name); + Attr attr = (Attr)attrs.getNamedItem(name); if (attr != null) { attr.setValue(value); } else { @@ -116,7 +142,7 @@ public class IIOMetadataNode implements Element, NodeList { } public void removeAttribute(String name) throws DOMException { - IIOMetadataAttr attr = (IIOMetadataAttr) attrs.getNamedItem(name); + IIOMetadataAttr attr = (IIOMetadataAttr)attrs.getNamedItem(name); if (attr != null) { attr.setOwnerElement(null); attrs.list.remove(attr); @@ -124,17 +150,19 @@ public class IIOMetadataNode implements Element, NodeList { } public Attr getAttributeNode(String name) { - return (Attr) attrs.getNamedItem(name); + return (Attr)attrs.getNamedItem(name); } public Attr setAttributeNode(Attr newAttr) throws DOMException { // Check if this attribute is already in use. Element owner = newAttr.getOwnerElement(); if (owner != null) { - if (owner == this) { // Replacing an attribute node by itself has no effect + if (owner == this) { // Replacing an attribute node by itself has no + // effect return null; } else { - throw new DOMException(DOMException.INUSE_ATTRIBUTE_ERR, "Attribute is already in use"); + throw new DOMException(DOMException.INUSE_ATTRIBUTE_ERR, + "Attribute is already in use"); } } @@ -146,7 +174,7 @@ public class IIOMetadataNode implements Element, NodeList { IIOMetadataAttr iioAttr; if (newAttr instanceof IIOMetadataAttr) { - iioAttr = (IIOMetadataAttr) newAttr; + iioAttr = (IIOMetadataAttr)newAttr; iioAttr.setOwnerElement(this); } else { iioAttr = new IIOMetadataAttr(name, newAttr.getValue(), this); @@ -206,7 +234,8 @@ public class IIOMetadataNode implements Element, NodeList { return getAttribute(localName); } - public void setAttributeNS(String namespaceURI, String qualifiedName, String value) throws DOMException { + public void setAttributeNS(String namespaceURI, String qualifiedName, String value) + throws DOMException { setAttribute(qualifiedName, value); } @@ -222,7 +251,8 @@ public class IIOMetadataNode implements Element, NodeList { return setAttributeNode(newAttr); } - public NodeList getElementsByTagNameNS(String namespaceURI, String localName) throws DOMException { + public NodeList getElementsByTagNameNS(String namespaceURI, String localName) + throws DOMException { return getElementsByTagName(localName); } @@ -234,20 +264,105 @@ public class IIOMetadataNode implements Element, NodeList { return hasAttribute(localName); } - //???AWT + // ???AWT /* - public TypeInfo getSchemaTypeInfo() { - throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Method not supported"); - }*/ + * public TypeInfo getSchemaTypeInfo() { throw new + * DOMException(DOMException.NOT_SUPPORTED_ERR, "Method not supported"); } + */ + /** + * Description copied from interface: org.w3c.dom.Element (DOM Level + * 3) + *

    + * If the parameter isId is true, this method declares the specified + * attribute to be a user-determined ID attribute . This affects the value + * of Attr.isId and the behavior of Document.getElementById, but does not + * change any schema that may be in use, in particular this does not affect + * the Attr.schemaTypeInfo of the specified Attr node. Use the value false + * for the parameter isId to undeclare an attribute for being a + * user-determined ID attribute. To specify an attribute by local name and + * namespace URI, use the setIdAttributeNS method. + *

    + * + * @param name + * the name of the attribute. + * @param isId + * the flag which determines whether this attribute is of type + * ID. + * @throws DOMException + * if a DOM error occurred while setting the attribute type. + *

    + * NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly. + *
    + * NOT_FOUND_ERR: Raised if the specified node is not an + * attribute of this element. + *

    + */ public void setIdAttribute(String name, boolean isId) throws DOMException { throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Method not supported"); } - public void setIdAttributeNS(String namespaceURI, String localName, boolean isId) throws DOMException { + /** + * Description copied from interface: org.w3c.dom.Element (DOM Level + * 3) + *

    + * If the parameter isId is true, this method declares the specified + * attribute to be a user-determined ID attribute . This affects the value + * of Attr.isId and the behavior of Document.getElementById, but does not + * change any schema that may be in use, in particular this does not affect + * the Attr.schemaTypeInfo of the specified Attr node. Use the value false + * for the parameter isId to undeclare an attribute for being a + * user-determined ID attribute. + *

    + * + * @param namespaceURI + * the namespace URI of the attribute. + * @param localName + * the local name of the attribute. + * @param isId + * the flag which determines whether this attribute is of type + * ID. + * @throws DOMException + * if a DOM error occurred while setting the attribute type. + *

    + * NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly. + *
    + * NOT_FOUND_ERR: Raised if the specified node is not an + * attribute of this element. + *

    + */ + public void setIdAttributeNS(String namespaceURI, String localName, boolean isId) + throws DOMException { throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Method not supported"); } + /** + * Description copied from interface: org.w3c.dom.Element (DOM Level + * 3) + *

    + * If the parameter isId is true, this method declares the specified + * attribute to be a user-determined ID attribute . This affects the value + * of Attr.isId and the behavior of Document.getElementById, but does not + * change any schema that may be in use, in particular this does not affect + * the Attr.schemaTypeInfo of the specified Attr node. Use the value false + * for the parameter isId to undeclare an attribute for being a + * user-determined ID attribute. + *

    + * + * @param idAttr + * the attribute node. + * @param isId + * the flag which determines whether this attribute is of type + * ID. + * @throws DOMException + * if a DOM error occurred while setting the attribute type. + *

    + * NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly. + *
    + * NOT_FOUND_ERR: Raised if the specified node is not an + * attribute of this element. + *

    + */ public void setIdAttributeNode(Attr idAttr, boolean isId) throws DOMException { throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Method not supported"); } @@ -305,8 +420,8 @@ public class IIOMetadataNode implements Element, NodeList { throw new IllegalArgumentException("newChild == null!"); } - IIOMetadataNode newIIOChild = (IIOMetadataNode) newChild; - IIOMetadataNode refIIOChild = (IIOMetadataNode) refChild; + IIOMetadataNode newIIOChild = (IIOMetadataNode)newChild; + IIOMetadataNode refIIOChild = (IIOMetadataNode)refChild; newIIOChild.parent = this; @@ -349,8 +464,8 @@ public class IIOMetadataNode implements Element, NodeList { throw new IllegalArgumentException("newChild == null!"); } - IIOMetadataNode newIIOChild = (IIOMetadataNode) newChild; - IIOMetadataNode oldIIOChild = (IIOMetadataNode) oldChild; + IIOMetadataNode newIIOChild = (IIOMetadataNode)newChild; + IIOMetadataNode oldIIOChild = (IIOMetadataNode)oldChild; IIOMetadataNode next = oldIIOChild.nextSibling; IIOMetadataNode previous = oldIIOChild.previousSibling; @@ -389,7 +504,7 @@ public class IIOMetadataNode implements Element, NodeList { throw new IllegalArgumentException("oldChild == null!"); } - IIOMetadataNode oldIIOChild = (IIOMetadataNode) oldChild; + IIOMetadataNode oldIIOChild = (IIOMetadataNode)oldChild; // Fix next and previous IIOMetadataNode previous = oldIIOChild.previousSibling; @@ -439,7 +554,8 @@ public class IIOMetadataNode implements Element, NodeList { } } - return cloned; //To change body of implemented methods use File | Settings | File Templates. + return cloned; // To change body of implemented methods use File | + // Settings | File Templates. } public void normalize() { @@ -470,52 +586,314 @@ public class IIOMetadataNode implements Element, NodeList { return attrs.list.size() > 0; } + /** + * Description copied from interface: org.w3c.dom.Node (DOM Level 3) + *

    + * The absolute base URI of this node or null if the implementation wasn't + * able to obtain an absolute URI. This value is computed as described in. + * However, when the Document supports the feature "HTML" [DOM Level 2 + * HTML], the base URI is computed using first the value of the href + * attribute of the HTML BASE element if any, and the value of the + * documentURI attribute from the Document interface otherwise. + *

    + * + * @return the string representation of the absolute base URI. + */ public String getBaseURI() { throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Method not supported"); } + /** + * Description copied from interface: org.w3c.dom.Node (DOM Level 3) + *

    + * Compares the reference node, i.e. the node on which this method is being + * called, with a node, i.e. the one passed as a parameter, with regard to + * their position in the document and according to the document order. + *

    + * + * @param other + * the node to compare against the reference node. + * @return Returns how the node is positioned relatively to the reference + * node. + * @throws DOMException + * NOT_SUPPORTED_ERR: when the compared nodes are from different + * DOM implementations that do not coordinate to return + * consistent implementation-specific results. + */ public short compareDocumentPosition(Node other) throws DOMException { throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Method not supported"); } + /** + * Description copied from interface: org.w3c.dom.Node (DOM Level 3) + *

    + * This attribute returns the text content of this node and its descendants. + * When it is defined to be null, setting it has no effect. On setting, any + * possible children this node may have are removed and, if it the new + * string is not empty or null, replaced by a single Text node containing + * the string this attribute is set to. On getting, no serialization is + * performed, the returned string does not contain any markup. No whitespace + * normalization is performed and the returned string does not contain the + * white spaces in element content (see the attribute + * Text.isElementContentWhitespace). Similarly, on setting, no parsing is + * performed either, the input string is taken as pure textual content. The + * string returned is made of the text content of this node depending on its + * type, as defined below: + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
    Node typeContent
    ELEMENT_NODE, ATTRIBUTE_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE, + * DOCUMENT_FRAGMENT_NODEconcatenation of the textContent attribute value of every child node, + * excluding COMMENT_NODE and PROCESSING_INSTRUCTION_NODE nodes. This is the + * empty string if the node has no children.
    TEXT_NODE, CDATA_SECTION_NODE, COMMENT_NODE, + * PROCESSING_INSTRUCTION_NODEnodeValue
    DOCUMENT_NODE, DOCUMENT_TYPE_NODE, NOTATION_NODEnull
    + *

    + * + * @return the text content depending on the type of this node. + * @throws DOMException + * DOMSTRING_SIZE_ERR: Raised when it would return more + * characters than fit in a DOMString variable on the + * implementation platform. + */ public String getTextContent() throws DOMException { return textContent; } + /** + * Description copied from interface: org.w3c.dom.Node (DOM Level 3) + *

    + * This attribute returns the text content of this node and its descendants. + * When it is defined to be null, setting it has no effect. On setting, any + * possible children this node may have are removed and, if it the new + * string is not empty or null, replaced by a single Text node containing + * the string this attribute is set to. On getting, no serialization is + * performed, the returned string does not contain any markup. No whitespace + * normalization is performed and the returned string does not contain the + * white spaces in element content (see the attribute + * Text.isElementContentWhitespace). Similarly, on setting, no parsing is + * performed either, the input string is taken as pure textual content. The + * string returned is made of the text content of this node depending on its + * type, as defined below: + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
    Node typeContent
    ELEMENT_NODE, ATTRIBUTE_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE, + * DOCUMENT_FRAGMENT_NODEconcatenation of the textContent attribute value of every child node, + * excluding COMMENT_NODE and PROCESSING_INSTRUCTION_NODE nodes. This is the + * empty string if the node has no children.
    TEXT_NODE, CDATA_SECTION_NODE, COMMENT_NODE, + * PROCESSING_INSTRUCTION_NODEnodeValue
    DOCUMENT_NODE, DOCUMENT_TYPE_NODE, NOTATION_NODEnull
    + *

    + * + * @param textContent + * the text content for this node. + * @throws DOMException + * NO_MODIFICATION_ALLOWED_ERR: Raised when the node is + * readonly. + */ public void setTextContent(String textContent) throws DOMException { this.textContent = textContent; } + /** + * Description copied from interface: org.w3c.dom.Node (DOM Level 3) + *

    + * Returns whether this node is the same node as the given one. This method + * provides a way to determine whether two Node references returned by the + * implementation reference the same object. When two Node references are + * references to the same object, even if through a proxy, the references + * may be used completely interchangeably, such that all attributes have the + * same values and calling the same DOM method on either reference always + * has exactly the same effect. + *

    + * + * @param other + * the node to test against. + * @return true, if the nodes are the same, false otherwise. + */ public boolean isSameNode(Node other) { throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Method not supported"); } + /** + * Description copied from interface: org.w3c.dom.Node (DOM Level 3) + *

    + * Look up the prefix associated to the given namespace URI, starting from + * this node. The default namespace declarations are ignored by this method. + * See for details on the algorithm used by this method. + *

    + * + * @param namespaceURI + * the namespace URI to look for. + * @return the associated namespace prefix if found or null if none is + * found. If more than one prefix are associated to the namespace + * prefix, the returned namespace prefix is implementation + * dependent. + */ public String lookupPrefix(String namespaceURI) { throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Method not supported"); } + /** + * Description copied from interface: org.w3c.dom.Node (DOM Level 3) + *

    + * This method checks if the specified namespaceURI is the default namespace + * or not. + *

    + * + * @param namespaceURI + * the namespace URI to look for. + * @return true, if the specified namespaceURI is the default namespace, + * false otherwise. + */ public boolean isDefaultNamespace(String namespaceURI) { throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Method not supported"); } + /** + * Description copied from interface: org.w3c.dom.Node (DOM Level 3) + *

    + * Look up the namespace URI associated to the given prefix, starting from + * this node. See for details on the algorithm used by this method. + *

    + * + * @param prefix + * the prefix to look for. If this parameter is null, the method + * will return the default namespace URI if any. + * @return the associated namespace URI or null if none is found. + */ public String lookupNamespaceURI(String prefix) { throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Method not supported"); } + /** + * Description copied from interface: org.w3c.dom.Node (DOM Level 3) + *

    + * Tests whether two nodes are equal. This method tests for equality of + * nodes, not sameness (i.e., whether the two nodes are references to the + * same object) which can be tested with Node.isSameNode(). All nodes that + * are the same will also be equal, though the reverse may not be true. Two + * nodes are equal if and only if the following conditions are satisfied: + *

    + *

  • The two nodes are of the same type.
  • + *
  • The following string attributes are equal: nodeName, localName, + * namespaceURI, prefix, nodeValue . This is: they are both null, or they + * have the same length and are character for character identical.
  • + *
  • The attributes NamedNodeMaps are equal. This is: they are both null, + * or they have the same length and for each node that exists in one map + * there is a node that exists in the other map and is equal, although not + * necessarily at the same index.
  • + *
  • The childNodes NodeLists are equal. This is: they are both null, or + * they have the same length and contain equal nodes at the same index. Note + * that normalization can affect equality; to avoid this, nodes should be + * normalized before being compared.
  • + *

    + * For two DocumentType nodes to be equal, the following conditions must + * also be satisfied: + *

    + *

  • The following string attributes are equal: publicId, systemId, + * internalSubset.
  • + *
  • The entities NamedNodeMaps are equal.
  • + *
  • The notations NamedNodeMaps are equal.
  • + *

    + * On the other hand, the following do not affect equality: the + * ownerDocument, baseURI, and parentNode attributes, the specified + * attribute for Attr nodes, the schemaTypeInfo attribute for Attr and + * Element nodes, the Text.isElementContentWhitespace attribute for Text + * nodes, as well as any user data or event listeners registered on the + * nodes.

    + *

    + * Note: As a general rule, anything not mentioned in the description above + * is not significant in consideration of equality checking. Note that + * future versions of this specification may take into account more + * attributes and implementations conform to this specification are expected + * to be updated accordingly. + *

    + * + * @param arg + * the node to compare equality with. + * @return true, if the nodes are equal, false otherwise. + */ public boolean isEqualNode(Node arg) { throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Method not supported"); } + /** + * Description copied from interface: org.w3c.dom.Node (DOM Level 3) + *

    + * This method returns a specialized object which implements the specialized + * APIs of the specified feature and version, as specified in. The + * specialized object may also be obtained by using binding-specific casting + * methods but is not necessarily expected to, as discussed in. This method + * also allow the implementation to provide specialized objects which do not + * support the Node interface. + *

    + * + * @param feature + * the name of the feature requested. Note that any plus sign "+" + * prepended to the name of the feature will be ignored since it + * is not significant in the context of this method. + * @param version + * this is the version number of the feature to test. + * @return the object which implements the specialized APIs of the specified + * feature and version, if any, or null if there is no object which + * implements interfaces associated with that feature. If the + * DOMObject returned by this method implements the Node interface, + * it must delegate to the primary core Node and not return results + * inconsistent with the primary core Node such as attributes, + * childNodes, etc. + */ public Object getFeature(String feature, String version) { throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Method not supported"); } - //???AWT + // ???AWT /* - public Object setUserData(String key, Object data, UserDataHandler handler) { - throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Method not supported"); - }*/ + * public Object setUserData(String key, Object data, UserDataHandler + * handler) { throw new DOMException(DOMException.NOT_SUPPORTED_ERR, + * "Method not supported"); } + */ + /** + * Description copied from interface: org.w3c.dom.Node (DOM Level 3) + *

    + * Retrieves the object associated to a key on a this node. The object must + * first have been set to this node by calling setUserData with the same + * key. + *

    + * + * @param key + * the key the object is associated to. + * @return the DOMUserData associated to the given key on this node, or null + * if there was none. + */ public Object getUserData(String key) { throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Method not supported"); } @@ -540,7 +918,7 @@ public class IIOMetadataNode implements Element, NodeList { /** * Gets the user object associated with this node. * - * @return the user object associated with this node + * @return the user object associated with this node. */ public Object getUserObject() { return userObject; @@ -549,7 +927,8 @@ public class IIOMetadataNode implements Element, NodeList { /** * Sets the user object associated with this node. * - * @param userObject the new user object associated with this node + * @param userObject + * the new user object associated with this node. */ public void setUserObject(Object userObject) { this.userObject = userObject; @@ -559,16 +938,21 @@ public class IIOMetadataNode implements Element, NodeList { * The Class IIOMetadataAttr. */ private class IIOMetadataAttr extends IIOMetadataNode implements Attr { - - /** The owner element. */ + + /** + * The owner element. + */ private Element ownerElement; /** * Instantiates a new iIO metadata attr. * - * @param name the name - * @param value the value - * @param owner the owner + * @param name + * the name. + * @param value + * the value. + * @param owner + * the owner. */ public IIOMetadataAttr(String name, String value, Element owner) { super(name, value); @@ -598,12 +982,16 @@ public class IIOMetadataNode implements Element, NodeList { /** * Sets the owner element. * - * @param ownerElement the new owner element + * @param ownerElement + * the new owner element. */ public void setOwnerElement(Element ownerElement) { this.ownerElement = ownerElement; } + /** + * @return + */ public boolean isId() { throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Method not supported"); } @@ -618,14 +1006,17 @@ public class IIOMetadataNode implements Element, NodeList { * The Class IIOMetadataNodeList. */ private class IIOMetadataNodeList implements NodeList, NamedNodeMap { - - /** The list. */ + + /** + * The list. + */ private List list; /** * Instantiates a new iIO metadata node list. * - * @param list the list + * @param list + * the list. */ IIOMetadataNodeList(List list) { this.list = list; @@ -644,7 +1035,7 @@ public class IIOMetadataNode implements Element, NodeList { } public Node getNamedItem(String name) { - for(IIOMetadataNode node:list) { + for (IIOMetadataNode node : list) { if (name.equals(node.getNodeName())) { return node; } @@ -653,11 +1044,13 @@ public class IIOMetadataNode implements Element, NodeList { } public Node setNamedItem(Node arg) throws DOMException { - throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, "This NamedNodeMap is read-only!"); + throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, + "This NamedNodeMap is read-only!"); } public Node removeNamedItem(String name) throws DOMException { - throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, "This NamedNodeMap is read-only!"); + throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, + "This NamedNodeMap is read-only!"); } public Node getNamedItemNS(String namespaceURI, String localName) throws DOMException { @@ -665,11 +1058,13 @@ public class IIOMetadataNode implements Element, NodeList { } public Node setNamedItemNS(Node arg) throws DOMException { - throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, "This NamedNodeMap is read-only!"); + throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, + "This NamedNodeMap is read-only!"); } public Node removeNamedItemNS(String namespaceURI, String localName) throws DOMException { - throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, "This NamedNodeMap is read-only!"); + throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, + "This NamedNodeMap is read-only!"); } } } diff --git a/awt/javax/imageio/metadata/IIOStandardMetadataFormat.java b/awt/javax/imageio/metadata/IIOStandardMetadataFormat.java index 94d2125638b3a..706cb2f7ab283 100644 --- a/awt/javax/imageio/metadata/IIOStandardMetadataFormat.java +++ b/awt/javax/imageio/metadata/IIOStandardMetadataFormat.java @@ -15,18 +15,19 @@ * limitations under the License. */ - package javax.imageio.metadata; import javax.imageio.ImageTypeSpecifier; import java.util.ArrayList; /** - * The Class IIOStandardMetadataFormat describes the rules of the - * standard metadata format. + * The class IIOStandardMetadataFormat describes the rules of the standard + * metadata format. + * + * @since Android 1.0 */ -class IIOStandardMetadataFormat extends IIOMetadataFormatImpl { - +class IIOStandardMetadataFormat extends IIOMetadataFormatImpl { + /** * Instantiates a new IIOStandardMetadataFormat. */ @@ -41,7 +42,7 @@ class IIOStandardMetadataFormat extends IIOMetadataFormatImpl { } /** - * Builds the dtd that describes the standard metadata format. + * Builds the DTD that describes the standard metadata format. */ private void buildDTD() { // CHROMA @@ -80,7 +81,10 @@ class IIOStandardMetadataFormat extends IIOMetadataFormatImpl { addAttribute("ColorSpaceType", "name", DATATYPE_STRING, true, null, values); addElement("NumChannels", "Chroma", CHILD_POLICY_EMPTY); - addAttribute("NumChannels", "value", DATATYPE_INTEGER, true, 0, Integer.MAX_VALUE); // list - why? + addAttribute("NumChannels", "value", DATATYPE_INTEGER, true, 0, Integer.MAX_VALUE); // list + // - + // why + // ? addElement("Gamma", "Chroma", CHILD_POLICY_EMPTY); addAttribute("Gamma", "value", DATATYPE_FLOAT, true, null); @@ -142,10 +146,8 @@ class IIOStandardMetadataFormat extends IIOMetadataFormatImpl { addAttribute("BitsPerSample", "value", DATATYPE_INTEGER, true, 1, Integer.MAX_VALUE); // list addElement("SignificantBitsPerSample", "Data", CHILD_POLICY_EMPTY); - addAttribute( - "SignificantBitsPerSample", "value", - DATATYPE_INTEGER, true, 1, Integer.MAX_VALUE - ); // list + addAttribute("SignificantBitsPerSample", "value", DATATYPE_INTEGER, true, 1, + Integer.MAX_VALUE); // list addElement("SampleMSB", "Data", CHILD_POLICY_EMPTY); addAttribute("SampleMSB", "value", DATATYPE_INTEGER, true, 1, Integer.MAX_VALUE); // list @@ -224,49 +226,29 @@ class IIOStandardMetadataFormat extends IIOMetadataFormatImpl { addElement("ImageCreationTime", "Document", CHILD_POLICY_EMPTY); addAttribute("ImageCreationTime", "year", DATATYPE_INTEGER, true, null); - addAttribute( - "ImageCreationTime", "month", - DATATYPE_INTEGER, true, null, "1", "12", true, true - ); - addAttribute( - "ImageCreationTime", "day", - DATATYPE_INTEGER, true, null, "1", "31", true, true - ); - addAttribute( - "ImageCreationTime", "hour", - DATATYPE_INTEGER, false, "0", "0", "23", true, true - ); - addAttribute( - "ImageCreationTime", "minute", - DATATYPE_INTEGER, false, "0", "0", "59", true, true - ); - addAttribute( - "ImageCreationTime", "second", - DATATYPE_INTEGER, false, "0", "0", "60", true, true - ); + addAttribute("ImageCreationTime", "month", DATATYPE_INTEGER, true, null, "1", "12", true, + true); + addAttribute("ImageCreationTime", "day", DATATYPE_INTEGER, true, null, "1", "31", true, + true); + addAttribute("ImageCreationTime", "hour", DATATYPE_INTEGER, false, "0", "0", "23", true, + true); + addAttribute("ImageCreationTime", "minute", DATATYPE_INTEGER, false, "0", "0", "59", true, + true); + addAttribute("ImageCreationTime", "second", DATATYPE_INTEGER, false, "0", "0", "60", true, + true); addElement("ImageModificationTime", "Document", CHILD_POLICY_EMPTY); addAttribute("ImageModificationTime", "year", DATATYPE_INTEGER, true, null); - addAttribute( - "ImageModificationTime", "month", - DATATYPE_INTEGER, true, null, "1", "12", true, true - ); - addAttribute( - "ImageModificationTime", "day", - DATATYPE_INTEGER, true, null, "1", "31", true, true - ); - addAttribute( - "ImageModificationTime", "hour", - DATATYPE_INTEGER, false, "0", "0", "23", true, true - ); - addAttribute( - "ImageModificationTime", "minute", - DATATYPE_INTEGER, false, "0", "0", "59", true, true - ); - addAttribute( - "ImageModificationTime", "second", - DATATYPE_INTEGER, false, "0", "0", "60", true, true - ); + addAttribute("ImageModificationTime", "month", DATATYPE_INTEGER, true, null, "1", "12", + true, true); + addAttribute("ImageModificationTime", "day", DATATYPE_INTEGER, true, null, "1", "31", true, + true); + addAttribute("ImageModificationTime", "hour", DATATYPE_INTEGER, false, "0", "0", "23", + true, true); + addAttribute("ImageModificationTime", "minute", DATATYPE_INTEGER, false, "0", "0", "59", + true, true); + addAttribute("ImageModificationTime", "second", DATATYPE_INTEGER, false, "0", "0", "60", + true, true); // TEXT addElement("Text", standardMetadataFormatName, 0, Integer.MAX_VALUE); // CHILD_POLICY_REPEAT @@ -313,4 +295,3 @@ class IIOStandardMetadataFormat extends IIOMetadataFormatImpl { addAttribute("OpaqueTile", "y", DATATYPE_INTEGER, true, null); } } - diff --git a/awt/javax/imageio/metadata/package.html b/awt/javax/imageio/metadata/package.html new file mode 100644 index 0000000000000..29bd51b2c4c14 --- /dev/null +++ b/awt/javax/imageio/metadata/package.html @@ -0,0 +1,8 @@ + + +

    + This package contains classes which allows to read and write describing metadata of image files. +

    + @since Android 1.0 + + diff --git a/awt/javax/imageio/package.html b/awt/javax/imageio/package.html new file mode 100644 index 0000000000000..2fd614874872c --- /dev/null +++ b/awt/javax/imageio/package.html @@ -0,0 +1,8 @@ + + +

    + This package contains classes and interfaces which provides an Image I/O API. The contained classes and interfaces allow reading and writing image files of different formats. +

    + @since Android 1.0 + + diff --git a/awt/javax/imageio/plugins/bmp/BMPImageWriteParam.java b/awt/javax/imageio/plugins/bmp/BMPImageWriteParam.java index 0cd44db4aaea8..ecfb20ad38cd3 100644 --- a/awt/javax/imageio/plugins/bmp/BMPImageWriteParam.java +++ b/awt/javax/imageio/plugins/bmp/BMPImageWriteParam.java @@ -15,19 +15,21 @@ * limitations under the License. */ - package javax.imageio.plugins.bmp; import javax.imageio.ImageWriteParam; import java.util.Locale; /** - * The BMPImageWriteParam class allows encoding an image in - * BMP format. + * The BMPImageWriteParam class allows encoding an image in BMP format. + * + * @since Android 1.0 */ public class BMPImageWriteParam extends ImageWriteParam { - - /** The top down. */ + + /** + * The top down. + */ private boolean topDown; // Default is bottom-up /** @@ -41,33 +43,35 @@ public class BMPImageWriteParam extends ImageWriteParam { /** * Instantiates a new BMPImageWriteParam with the specified Locale. * - * @param locale the specified Locale. + * @param locale + * the specified Locale. */ public BMPImageWriteParam(Locale locale) { super(locale); // Set the compression canWriteCompressed = true; - compressionTypes = new String[] {"BI_RGB", "BI_RLE8", "BI_RLE4", "BI_BITFIELDS"}; - compressionType = compressionTypes[0]; + compressionTypes = new String[] { + "BI_RGB", "BI_RLE8", "BI_RLE4", "BI_BITFIELDS" + }; + compressionType = compressionTypes[0]; } /** - * Sets true if the data will be written in a top-down order, - * false otherwise. + * Sets true if the data will be written in a top-down order, false + * otherwise. * - * @param topDown the new top-down value. + * @param topDown + * the new top-down value. */ public void setTopDown(boolean topDown) { this.topDown = topDown; } /** - * Returns true if the data is written in top-down order, false - * otherwise. + * Returns true if the data is written in top-down order, false otherwise. * - * @return true if the data is written in top-down order, false - * otherwise. + * @return true if the data is written in top-down order, false otherwise. */ public boolean isTopDown() { return topDown; diff --git a/awt/javax/imageio/plugins/bmp/package.html b/awt/javax/imageio/plugins/bmp/package.html new file mode 100644 index 0000000000000..9494a102db7e8 --- /dev/null +++ b/awt/javax/imageio/plugins/bmp/package.html @@ -0,0 +1,8 @@ + + +

    + This package contains auxiliary classes for the built-in BMP image plug-in. +

    + @since Android 1.0 + + diff --git a/awt/javax/imageio/plugins/jpeg/JPEGHuffmanTable.java b/awt/javax/imageio/plugins/jpeg/JPEGHuffmanTable.java index 398c960ad4965..67b504be25565 100644 --- a/awt/javax/imageio/plugins/jpeg/JPEGHuffmanTable.java +++ b/awt/javax/imageio/plugins/jpeg/JPEGHuffmanTable.java @@ -18,82 +18,90 @@ package javax.imageio.plugins.jpeg; /** - * The JPEGHuffmanTable class represents a single JPEG Huffman table. - * It contains the standard tables from the JPEG specification. + * The JPEGHuffmanTable class represents a single JPEG Huffman table. It + * contains the standard tables from the JPEG specification. + * + * @since Android 1.0 */ public class JPEGHuffmanTable { - - /** The standard DC luminance Huffman table . */ - public static final JPEGHuffmanTable StdDCLuminance = new JPEGHuffmanTable( - new short[] {0, 1, 5, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0}, - new short[] {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0x0A, 0x0B}, - false - ); - - /** The standard DC chrominance Huffman table. */ - public static final JPEGHuffmanTable StdDCChrominance = new JPEGHuffmanTable( - new short[] {0, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0}, - new short[] {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0x0A, 0x0B}, - false - ); - - /** The standard AC luminance Huffman table. */ - public static final JPEGHuffmanTable StdACLuminance = new JPEGHuffmanTable( - new short[] {0, 2, 1, 3, 3, 2, 4, 3, 5, 5, 4, 4, 0, 0, 1, 0x7D}, - new short[] { - 0x01, 0x02, 0x03, 0x00, 0x04, 0x11, 0x05, 0x12, 0x21, 0x31, 0x41, 0x06, - 0x13, 0x51, 0x61, 0x07, 0x22, 0x71, 0x14, 0x32, 0x81, 0x91, 0xA1, 0x08, - 0x23, 0x42, 0xB1, 0xC1, 0x15, 0x52, 0xD1, 0xF0, 0x24, 0x33, 0x62, 0x72, - 0x82, 0x09, 0x0A, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x25, 0x26, 0x27, 0x28, - 0x29, 0x2A, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3A, 0x43, 0x44, 0x45, - 0x46, 0x47, 0x48, 0x49, 0x4A, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, - 0x5A, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6A, 0x73, 0x74, 0x75, - 0x76, 0x77, 0x78, 0x79, 0x7A, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, - 0x8A, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9A, 0xA2, 0xA3, - 0xA4, 0xA5, 0xA6, 0xA7, 0xA8, 0xA9, 0xAA, 0xB2, 0xB3, 0xB4, 0xB5, 0xB6, - 0xB7, 0xB8, 0xB9, 0xBA, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7, 0xC8, 0xC9, - 0xCA, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6, 0xD7, 0xD8, 0xD9, 0xDA, 0xE1, 0xE2, - 0xE3, 0xE4, 0xE5, 0xE6, 0xE7, 0xE8, 0xE9, 0xEA, 0xF1, 0xF2, 0xF3, 0xF4, - 0xF5, 0xF6, 0xF7, 0xF8, 0xF9, 0xFA - }, - false - ); - - /** - * The standard AC chrominance Huffman table. */ - public static final JPEGHuffmanTable StdACChrominance = new JPEGHuffmanTable( - new short[] {0, 2, 1, 2, 4, 4, 3, 4, 7, 5, 4, 4, 0, 1, 2, 0x77}, - new short[] { - 0x00, 0x01, 0x02, 0x03, 0x11, 0x04, 0x05, 0x21, 0x31, 0x06, 0x12, 0x41, - 0x51, 0x07, 0x61, 0x71, 0x13, 0x22, 0x32, 0x81, 0x08, 0x14, 0x42, 0x91, - 0xA1, 0xB1, 0xC1, 0x09, 0x23, 0x33, 0x52, 0xF0, 0x15, 0x62, 0x72, 0xD1, - 0x0A, 0x16, 0x24, 0x34, 0xE1, 0x25, 0xF1, 0x17, 0x18, 0x19, 0x1A, 0x26, - 0x27, 0x28, 0x29, 0x2A, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3A, 0x43, 0x44, - 0x45, 0x46, 0x47, 0x48, 0x49, 0x4A, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, - 0x59, 0x5A, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6A, 0x73, 0x74, - 0x75, 0x76, 0x77, 0x78, 0x79, 0x7A, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, - 0x88, 0x89, 0x8A, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9A, - 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, 0xA7, 0xA8, 0xA9, 0xAA, 0xB2, 0xB3, 0xB4, - 0xB5, 0xB6, 0xB7, 0xB8, 0xB9, 0xBA, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7, - 0xC8, 0xC9, 0xCA, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6, 0xD7, 0xD8, 0xD9, 0xDA, - 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7, 0xE8, 0xE9, 0xEA, 0xF2, 0xF3, 0xF4, - 0xF5, 0xF6, 0xF7, 0xF8, 0xF9, 0xFA - }, - false - ); - - /** The lengths. */ + + /** + * The standard DC luminance Huffman table . + */ + public static final JPEGHuffmanTable StdDCLuminance = new JPEGHuffmanTable(new short[] { + 0, 1, 5, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0 + }, new short[] { + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0x0A, 0x0B + }, false); + + /** + * The standard DC chrominance Huffman table. + */ + public static final JPEGHuffmanTable StdDCChrominance = new JPEGHuffmanTable(new short[] { + 0, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0 + }, new short[] { + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0x0A, 0x0B + }, false); + + /** + * The standard AC luminance Huffman table. + */ + public static final JPEGHuffmanTable StdACLuminance = new JPEGHuffmanTable(new short[] { + 0, 2, 1, 3, 3, 2, 4, 3, 5, 5, 4, 4, 0, 0, 1, 0x7D + }, new short[] { + 0x01, 0x02, 0x03, 0x00, 0x04, 0x11, 0x05, 0x12, 0x21, 0x31, 0x41, 0x06, 0x13, 0x51, + 0x61, 0x07, 0x22, 0x71, 0x14, 0x32, 0x81, 0x91, 0xA1, 0x08, 0x23, 0x42, 0xB1, 0xC1, + 0x15, 0x52, 0xD1, 0xF0, 0x24, 0x33, 0x62, 0x72, 0x82, 0x09, 0x0A, 0x16, 0x17, 0x18, + 0x19, 0x1A, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2A, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, + 0x3A, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4A, 0x53, 0x54, 0x55, 0x56, 0x57, + 0x58, 0x59, 0x5A, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6A, 0x73, 0x74, 0x75, + 0x76, 0x77, 0x78, 0x79, 0x7A, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8A, 0x92, + 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9A, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, 0xA7, + 0xA8, 0xA9, 0xAA, 0xB2, 0xB3, 0xB4, 0xB5, 0xB6, 0xB7, 0xB8, 0xB9, 0xBA, 0xC2, 0xC3, + 0xC4, 0xC5, 0xC6, 0xC7, 0xC8, 0xC9, 0xCA, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6, 0xD7, 0xD8, + 0xD9, 0xDA, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7, 0xE8, 0xE9, 0xEA, 0xF1, 0xF2, + 0xF3, 0xF4, 0xF5, 0xF6, 0xF7, 0xF8, 0xF9, 0xFA + }, false); + + /** + * The standard AC chrominance Huffman table. + */ + public static final JPEGHuffmanTable StdACChrominance = new JPEGHuffmanTable(new short[] { + 0, 2, 1, 2, 4, 4, 3, 4, 7, 5, 4, 4, 0, 1, 2, 0x77 + }, new short[] { + 0x00, 0x01, 0x02, 0x03, 0x11, 0x04, 0x05, 0x21, 0x31, 0x06, 0x12, 0x41, 0x51, 0x07, + 0x61, 0x71, 0x13, 0x22, 0x32, 0x81, 0x08, 0x14, 0x42, 0x91, 0xA1, 0xB1, 0xC1, 0x09, + 0x23, 0x33, 0x52, 0xF0, 0x15, 0x62, 0x72, 0xD1, 0x0A, 0x16, 0x24, 0x34, 0xE1, 0x25, + 0xF1, 0x17, 0x18, 0x19, 0x1A, 0x26, 0x27, 0x28, 0x29, 0x2A, 0x35, 0x36, 0x37, 0x38, + 0x39, 0x3A, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4A, 0x53, 0x54, 0x55, 0x56, + 0x57, 0x58, 0x59, 0x5A, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6A, 0x73, 0x74, + 0x75, 0x76, 0x77, 0x78, 0x79, 0x7A, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, + 0x8A, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9A, 0xA2, 0xA3, 0xA4, 0xA5, + 0xA6, 0xA7, 0xA8, 0xA9, 0xAA, 0xB2, 0xB3, 0xB4, 0xB5, 0xB6, 0xB7, 0xB8, 0xB9, 0xBA, + 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7, 0xC8, 0xC9, 0xCA, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6, + 0xD7, 0xD8, 0xD9, 0xDA, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7, 0xE8, 0xE9, 0xEA, 0xF2, + 0xF3, 0xF4, 0xF5, 0xF6, 0xF7, 0xF8, 0xF9, 0xFA + }, false); + + /** + * The lengths. + */ private short lengths[]; - - /** The values. */ + + /** + * The values. + */ private short values[]; /** * Instantiates a new jPEG huffman table. * - * @param lengths the lengths - * @param values the values - * @param copy the copy + * @param lengths + * the lengths + * @param values + * the values + * @param copy + * the copy */ JPEGHuffmanTable(short[] lengths, short[] values, boolean copy) { // Construction of standard tables without checks @@ -106,9 +114,11 @@ public class JPEGHuffmanTable { /** * Instantiates a new JPEGHuffmanTable. * - * @param lengths the array of shorts lengths. - * @param values the array of shorts containing - * the values in order of increasing code length. + * @param lengths + * the array of shorts lengths. + * @param values + * the array of shorts containing the values in order of + * increasing code length. */ public JPEGHuffmanTable(short[] lengths, short[] values) { if (lengths == null) { @@ -145,8 +155,8 @@ public class JPEGHuffmanTable { /** * Gets an array of lengths in the Huffman table. * - * @return the array of short values representing the - * length values in the Huffman table. + * @return the array of short values representing the length values in the + * Huffman table. */ public short[] getLengths() { short newLengths[] = new short[lengths.length]; @@ -155,8 +165,7 @@ public class JPEGHuffmanTable { } /** - * Gets an array of values represented by increasing length of - * their codes. + * Gets an array of values represented by increasing length of their codes. * * @return the array of values. */ @@ -169,8 +178,10 @@ public class JPEGHuffmanTable { /** * Check huffman table. * - * @param lengths the lengths - * @param values the values + * @param lengths + * the lengths. + * @param values + * the values. */ private static void checkHuffmanTable(short[] lengths, short[] values) { int numLeaves = 0; @@ -179,13 +190,15 @@ public class JPEGHuffmanTable { numLeaves += length; possibleLeaves -= length; if (possibleLeaves < 0) { - throw new IllegalArgumentException("Invalid Huffman table provided, lengths are incorrect."); + throw new IllegalArgumentException( + "Invalid Huffman table provided, lengths are incorrect."); } possibleLeaves <<= 1; } if (values.length != numLeaves) { - throw new IllegalArgumentException("Invalid Huffman table provided, sum of lengths != values."); + throw new IllegalArgumentException( + "Invalid Huffman table provided, sum of lengths != values."); } } diff --git a/awt/javax/imageio/plugins/jpeg/JPEGImageReadParam.java b/awt/javax/imageio/plugins/jpeg/JPEGImageReadParam.java index dd08d51b603ea..2f3a9a8fbdb25 100644 --- a/awt/javax/imageio/plugins/jpeg/JPEGImageReadParam.java +++ b/awt/javax/imageio/plugins/jpeg/JPEGImageReadParam.java @@ -20,18 +20,26 @@ package javax.imageio.plugins.jpeg; import javax.imageio.ImageReadParam; /** - * The JPEGImageReadParam class provides functionality to set Huffman tables - * and quantization tables when using the JPEG reader plug-in. + * The JPEGImageReadParam class provides functionality to set Huffman tables and + * quantization tables when using the JPEG reader plug-in. + * + * @since Android 1.0 */ public class JPEGImageReadParam extends ImageReadParam { - - /** The q tables. */ + + /** + * The q tables. + */ private JPEGQTable qTables[]; - - /** The dc huffman tables. */ + + /** + * The dc huffman tables. + */ private JPEGHuffmanTable dcHuffmanTables[]; - - /** The ac huffman tables. */ + + /** + * The ac huffman tables. + */ private JPEGHuffmanTable acHuffmanTables[]; /** @@ -43,29 +51,28 @@ public class JPEGImageReadParam extends ImageReadParam { /** * Returns true if tables are set, false otherwise. * - * @return true if tables are set, false otherwise. + * @return true, if tables are set, false otherwise. */ public boolean areTablesSet() { return qTables != null; } /** - * Sets the quantization and Huffman tables for using in - * decoding streams. + * Sets the quantization and Huffman tables for using in decoding streams. * - * @param qTables the quantization tables. - * @param DCHuffmanTables the standart DC Huffman tables. - * @param ACHuffmanTables the standart AC huffman tables. + * @param qTables + * the quantization tables. + * @param DCHuffmanTables + * the standart DC Huffman tables. + * @param ACHuffmanTables + * the standart AC huffman tables. */ - public void setDecodeTables( - JPEGQTable[] qTables, - JPEGHuffmanTable[] DCHuffmanTables, - JPEGHuffmanTable[] ACHuffmanTables - ) { + public void setDecodeTables(JPEGQTable[] qTables, JPEGHuffmanTable[] DCHuffmanTables, + JPEGHuffmanTable[] ACHuffmanTables) { if (qTables == null || DCHuffmanTables == null || ACHuffmanTables == null) { throw new IllegalArgumentException("Invalid JPEG table arrays"); } - if(DCHuffmanTables.length != ACHuffmanTables.length) { + if (DCHuffmanTables.length != ACHuffmanTables.length) { throw new IllegalArgumentException("Invalid JPEG table arrays"); } if (qTables.length > 4 || DCHuffmanTables.length > 4) { @@ -112,5 +119,5 @@ public class JPEGImageReadParam extends ImageReadParam { */ public JPEGHuffmanTable[] getACHuffmanTables() { return acHuffmanTables == null ? null : acHuffmanTables.clone(); - } + } } diff --git a/awt/javax/imageio/plugins/jpeg/JPEGImageWriteParam.java b/awt/javax/imageio/plugins/jpeg/JPEGImageWriteParam.java index 34a3cd923f8f4..b9799112e04da 100644 --- a/awt/javax/imageio/plugins/jpeg/JPEGImageWriteParam.java +++ b/awt/javax/imageio/plugins/jpeg/JPEGImageWriteParam.java @@ -23,38 +23,52 @@ import javax.imageio.ImageWriteParam; import java.util.Locale; /** - * The JPEGImageWriteParam class allows to set JPEG Huffman tables - * and quantization when using the JPEG writer plug-in. + * The JPEGImageWriteParam class allows to set JPEG Huffman tables and + * quantization when using the JPEG writer plug-in. + * + * @since Android 1.0 */ public class JPEGImageWriteParam extends ImageWriteParam { - - /** The Constant COMP_QUALITY_VALUES. */ - private static final float[] COMP_QUALITY_VALUES = {0.05f, 0.75f, 0.95f}; - - /** The Constant COMP_QUALITY_DESCRIPTIONS. */ + + /** + * The Constant COMP_QUALITY_VALUES. + */ + private static final float[] COMP_QUALITY_VALUES = { + 0.05f, 0.75f, 0.95f + }; + + /** + * The Constant COMP_QUALITY_DESCRIPTIONS. + */ private static final String[] COMP_QUALITY_DESCRIPTIONS = { - "Minimum useful", - "Visually lossless", - "Maximum useful" + "Minimum useful", "Visually lossless", "Maximum useful" }; - /** The q tables. */ + /** + * The q tables. + */ private JPEGQTable[] qTables; - - /** The dc huffman tables. */ + + /** + * The dc huffman tables. + */ private JPEGHuffmanTable[] dcHuffmanTables; - - /** The ac huffman tables. */ + + /** + * The ac huffman tables. + */ private JPEGHuffmanTable[] acHuffmanTables; - /** The optimize huffman tables. */ + /** + * The optimize huffman tables. + */ private boolean optimizeHuffmanTables; /** - * Instantiates a new JPEGImageWriteParam object with - * the specified Locale. + * Instantiates a new JPEGImageWriteParam object with the specified Locale. * - * @param locale the Locale. + * @param locale + * the Locale. */ public JPEGImageWriteParam(Locale locale) { super(locale); @@ -63,37 +77,38 @@ public class JPEGImageWriteParam extends ImageWriteParam { progressiveMode = ImageWriteParam.MODE_DISABLED; canWriteCompressed = true; - compressionTypes = new String[]{"JPEG"}; - compressionType = compressionTypes[0]; + compressionTypes = new String[] { + "JPEG" + }; + compressionType = compressionTypes[0]; compressionQuality = JPEGConsts.DEFAULT_JPEG_COMPRESSION_QUALITY; } /** * Returns true if tables are set, false otherwise. * - * @return true if tables are set, false otherwise. + * @return true, if tables are set, false otherwise. */ public boolean areTablesSet() { return qTables != null; } /** - * Sets the quantization and Huffman tables for using in - * encoding streams. + * Sets the quantization and Huffman tables for using in encoding streams. * - * @param qTables the quantization tables. - * @param DCHuffmanTables the standart DC Huffman tables. - * @param ACHuffmanTables the standart AC huffman tables. + * @param qTables + * the quantization tables. + * @param DCHuffmanTables + * the standart DC Huffman tables. + * @param ACHuffmanTables + * the standart AC huffman tables. */ - public void setEncodeTables( - JPEGQTable[] qTables, - JPEGHuffmanTable[] DCHuffmanTables, - JPEGHuffmanTable[] ACHuffmanTables - ) { + public void setEncodeTables(JPEGQTable[] qTables, JPEGHuffmanTable[] DCHuffmanTables, + JPEGHuffmanTable[] ACHuffmanTables) { if (qTables == null || DCHuffmanTables == null || ACHuffmanTables == null) { throw new IllegalArgumentException("Invalid JPEG table arrays"); } - if(DCHuffmanTables.length != ACHuffmanTables.length) { + if (DCHuffmanTables.length != ACHuffmanTables.length) { throw new IllegalArgumentException("Invalid JPEG table arrays"); } if (qTables.length > 4 || DCHuffmanTables.length > 4) { @@ -155,21 +170,22 @@ public class JPEGImageWriteParam extends ImageWriteParam { } /** - * Sets the flag indicated that the writer will generate optimized - * Huffman tables for the image as part of the writing process. + * Sets the flag indicated that the writer will generate optimized Huffman + * tables for the image as part of the writing process. * - * @param optimize the flag of optimizing huffman tables. + * @param optimize + * the flag of optimizing huffman tables. */ public void setOptimizeHuffmanTables(boolean optimize) { optimizeHuffmanTables = optimize; } /** - * Returns true if the writer generates optimized Huffman tables, - * false otherwise. + * Returns true if the writer generates optimized Huffman tables, false + * otherwise. * - * @return the true if the writer generates optimized Huffman tables, - * false otherwise. + * @return true, if the writer generates optimized Huffman tables, false + * otherwise. */ public boolean getOptimizeHuffmanTables() { return optimizeHuffmanTables; diff --git a/awt/javax/imageio/plugins/jpeg/JPEGQTable.java b/awt/javax/imageio/plugins/jpeg/JPEGQTable.java index 0c5b37edce197..3461d466986cf 100644 --- a/awt/javax/imageio/plugins/jpeg/JPEGQTable.java +++ b/awt/javax/imageio/plugins/jpeg/JPEGQTable.java @@ -18,88 +18,92 @@ * @author Rustem V. Rafikov * @version $Revision: 1.3 $ */ + package javax.imageio.plugins.jpeg; /** - * The JPEGQTable class represents a single JPEG quantization table - * and provides for the standard tables taken from the JPEG specification. + * The JPEGQTable class represents a single JPEG quantization table and provides + * for the standard tables taken from the JPEG specification. + * + * @since Android 1.0 */ public class JPEGQTable { - /** The Constant SIZE. */ + /** + * The Constant SIZE. + */ private final static int SIZE = 64; - - /** The Constant BASELINE_MAX. */ + + /** + * The Constant BASELINE_MAX. + */ private final static int BASELINE_MAX = 255; - - /** The Constant MAX. */ - private final static int MAX = 32767; + /** + * The Constant MAX. + */ + private final static int MAX = 32767; - /** The table. */ + /** + * The table. + */ private int[] theTable; /* - * K1 & K2 tables can be found in the JPEG format specification - * at http://www.w3.org/Graphics/JPEG/itu-t81.pdf + * K1 & K2 tables can be found in the JPEG format specification at + * http://www.w3.org/Graphics/JPEG/itu-t81.pdf */ - /** The Constant K1LumTable. */ + /** + * The Constant K1LumTable. + */ private static final int[] K1LumTable = new int[] { - 16, 11, 10, 16, 24, 40, 51, 61, - 12, 12, 14, 19, 26, 58, 60, 55, - 14, 13, 16, 24, 40, 57, 69, 56, - 14, 17, 22, 29, 51, 87, 80, 62, - 18, 22, 37, 56, 68, 109, 103, 77, - 24, 35, 55, 64, 81, 104, 113, 92, - 49, 64, 78, 87, 103, 121, 120, 101, - 72, 92, 95, 98, 112, 100, 103, 99 + 16, 11, 10, 16, 24, 40, 51, 61, 12, 12, 14, 19, 26, 58, 60, 55, 14, 13, 16, 24, 40, 57, + 69, 56, 14, 17, 22, 29, 51, 87, 80, 62, 18, 22, 37, 56, 68, 109, 103, 77, 24, 35, 55, + 64, 81, 104, 113, 92, 49, 64, 78, 87, 103, 121, 120, 101, 72, 92, 95, 98, 112, 100, + 103, 99 }; - /** The Constant K2ChrTable. */ + /** + * The Constant K2ChrTable. + */ private static final int[] K2ChrTable = new int[] { - 17, 18, 24, 47, 99, 99, 99, 99, - 18, 21, 26, 66, 99, 99, 99, 99, - 24, 26, 56, 99, 99, 99, 99, 99, - 47, 66, 99, 99, 99, 99, 99, 99, - 99, 99, 99, 99, 99, 99, 99, 99, - 99, 99, 99, 99, 99, 99, 99, 99, - 99, 99, 99, 99, 99, 99, 99, 99, - 99, 99, 99, 99, 99, 99, 99, 99 + 17, 18, 24, 47, 99, 99, 99, 99, 18, 21, 26, 66, 99, 99, 99, 99, 24, 26, 56, 99, 99, 99, + 99, 99, 47, 66, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, + 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99 }; - /** - * The K1Luminance indicates standart table K.1 from JPEG - * specification and produces "good" quality output. + /** + * The K1Luminance indicates standard table K.1 from JPEG specification and + * produces "good" quality output. */ public static final JPEGQTable K1Luminance = new JPEGQTable(K1LumTable); - - /** - * The K1Div2Luminance indicates K.1 table from JPEG - * specification with all elements divided by 2 and produces - * "very good" quality output. + + /** + * The K1Div2Luminance indicates K.1 table from JPEG specification with all + * elements divided by 2 and produces "very good" quality output. */ public static final JPEGQTable K1Div2Luminance = K1Luminance.getScaledInstance(0.5f, true); - - /** - * The K2Chrominance indicates K.2 table from JPEG - * specification and produces "good" quality output. + + /** + * The K2Chrominance indicates K.2 table from JPEG specification and + * produces "good" quality output. */ public static final JPEGQTable K2Chrominance = new JPEGQTable(K2ChrTable); - - /** + + /** * The Constant K2Div2Chrominance indicates K.2 table from JPEG - * specification with all elements divided by 2 and produces - * "very good" quality output. + * specification with all elements divided by 2 and produces "very good" + * quality output. */ public static final JPEGQTable K2Div2Chrominance = K2Chrominance.getScaledInstance(0.5f, true);; - /** - * Instantiates a new JPEGQTable from the array, which - * should contain 64 elements in natural order. + * Instantiates a new JPEGQTable from the array, which should contain 64 + * elements in natural order. * - * @param table the quantization table. + * @param table + * the quantization table. */ public JPEGQTable(int[] table) { if (table == null) { @@ -112,23 +116,22 @@ public class JPEGQTable { } /** - * Gets the current quantization table as an array of int values. + * Gets the current quantization table as an array of integer values. * - * @return the current quantization table as an array of int values. + * @return the current quantization table as an array of integer values. */ public int[] getTable() { return theTable.clone(); } /** - * Gets the scaled instance as quantization table where - * the values are multiplied by the scaleFactor and then clamped - * if forceBaseline is true. - * - * @param scaleFactor the scale factor of table. - * @param forceBaseline the force baseline flag, the values - * should be clamped if true. + * Gets the scaled instance as quantization table where the values are + * multiplied by the scaleFactor and then clamped if forceBaseline is true. * + * @param scaleFactor + * the scale factor of table. + * @param forceBaseline + * the force baseline flag, the values should be clamped if true. * @return the new quantization table. */ public JPEGQTable getScaledInstance(float scaleFactor, boolean forceBaseline) { @@ -156,7 +159,7 @@ public class JPEGQTable { */ @Override public String toString() { - //-- TODO more informative info + // -- TODO more informative info return "JPEGQTable"; } } diff --git a/awt/javax/imageio/plugins/jpeg/package.html b/awt/javax/imageio/plugins/jpeg/package.html new file mode 100644 index 0000000000000..14575c417c2c1 --- /dev/null +++ b/awt/javax/imageio/plugins/jpeg/package.html @@ -0,0 +1,8 @@ + + +

    + This package contains auxiliary classes for the built-in JPEG image plug-in. +

    + @since Android 1.0 + + diff --git a/awt/javax/imageio/spi/IIORegistry.java b/awt/javax/imageio/spi/IIORegistry.java index 3c1c989db3403..01ddeaafeea4a 100644 --- a/awt/javax/imageio/spi/IIORegistry.java +++ b/awt/javax/imageio/spi/IIORegistry.java @@ -18,6 +18,7 @@ * @author Rustem V. Rafikov * @version $Revision: 1.3 $ */ + package javax.imageio.spi; import java.util.Arrays; @@ -39,37 +40,41 @@ import org.apache.harmony.x.imageio.spi.RAFIOSSpi; */ /** - * The IIORegistry class registers service provider instances - * (SPI). Service provider instances are recognized by specific - * meta-information in the JAR files containing them. The JAR - * files with SPI classes are loaded from the application class - * path. + * The IIORegistry class registers service provider instances (SPI). Service + * provider instances are recognized by specific meta-information in the JAR + * files containing them. The JAR files with SPI classes are loaded from the + * application class path. + * + * @since Android 1.0 */ public final class IIORegistry extends ServiceRegistry { - /** The instance. */ + /** + * The instance. + */ private static IIORegistry instance; - /** The Constant CATEGORIES. */ + /** + * The Constant CATEGORIES. + */ private static final Class[] CATEGORIES = new Class[] { - javax.imageio.spi.ImageWriterSpi.class, - javax.imageio.spi.ImageReaderSpi.class, - javax.imageio.spi.ImageInputStreamSpi.class, - //javax.imageio.spi.ImageTranscoderSpi.class, - javax.imageio.spi.ImageOutputStreamSpi.class + javax.imageio.spi.ImageWriterSpi.class, javax.imageio.spi.ImageReaderSpi.class, + javax.imageio.spi.ImageInputStreamSpi.class, + // javax.imageio.spi.ImageTranscoderSpi.class, + javax.imageio.spi.ImageOutputStreamSpi.class }; /** - * Instantiates a new iIO registry. + * Instantiates a new IIO registry. */ private IIORegistry() { - super(Arrays.>asList(CATEGORIES).iterator()); + super(Arrays.> asList(CATEGORIES).iterator()); registerBuiltinSpis(); registerApplicationClasspathSpis(); } /** - * Register builtin spis. + * Register built-in SPIs. */ private void registerBuiltinSpis() { registerServiceProvider(new JPEGImageWriterSpi()); @@ -80,9 +85,9 @@ public final class IIORegistry extends ServiceRegistry { registerServiceProvider(new FileIISSpi()); registerServiceProvider(new RAFIOSSpi()); registerServiceProvider(new RAFIISSpi()); - registerServiceProvider(new OutputStreamIOSSpi()); + registerServiceProvider(new OutputStreamIOSSpi()); registerServiceProvider(new InputStreamIISSpi()); - //-- TODO implement + // -- TODO implement } /** @@ -91,7 +96,8 @@ public final class IIORegistry extends ServiceRegistry { * @return the default IIORegistry instance. */ public static IIORegistry getDefaultInstance() { - // TODO implement own instance for each ThreadGroup (see also ThreadLocal) + // TODO implement own instance for each ThreadGroup (see also + // ThreadLocal) synchronized (IIORegistry.class) { if (instance == null) { instance = new IIORegistry(); @@ -101,10 +107,9 @@ public final class IIORegistry extends ServiceRegistry { } /** - * Registers all service providers from the application class - * path. + * Registers all service providers from the application class path. */ public void registerApplicationClasspathSpis() { - //-- TODO implement for non-builtin plugins + // -- TODO implement for non-builtin plugins } } diff --git a/awt/javax/imageio/spi/IIOServiceProvider.java b/awt/javax/imageio/spi/IIOServiceProvider.java index f5873bfb4fab7..e9476773ae697 100644 --- a/awt/javax/imageio/spi/IIOServiceProvider.java +++ b/awt/javax/imageio/spi/IIOServiceProvider.java @@ -18,27 +18,36 @@ * @author Rustem V. Rafikov * @version $Revision: 1.3 $ */ + package javax.imageio.spi; import java.util.Locale; /** - * The IIOServiceProvider abstract class provides base functionality - * for imageio service provider interfaces (SPIs). + * The IIOServiceProvider abstract class provides base functionality for ImageIO + * service provider interfaces (SPIs). + * + * @since Android 1.0 */ public abstract class IIOServiceProvider implements RegisterableService { - /** The vendor name of this service provider. */ + /** + * The vendor name of this service provider. + */ protected String vendorName; - - /** The version of this service provider. */ + + /** + * The version of this service provider. + */ protected String version; /** * Instantiates a new IIOServiceProvider. * - * @param vendorName the vendor name of service provider. - * @param version the version of service provider. + * @param vendorName + * the vendor name of service provider. + * @param version + * the version of service provider. */ public IIOServiceProvider(String vendorName, String version) { if (vendorName == null) { @@ -85,12 +94,11 @@ public abstract class IIOServiceProvider implements RegisterableService { } /** - * Gets a description of this service provider. - * The result string should be localized for the specified - * Locale. - * - * @param locale the specified Locale. + * Gets a description of this service provider. The result string should be + * localized for the specified Locale. * + * @param locale + * the specified Locale. * @return the description of this service provider. */ public abstract String getDescription(Locale locale); diff --git a/awt/javax/imageio/spi/ImageInputStreamSpi.java b/awt/javax/imageio/spi/ImageInputStreamSpi.java index 47d210a8426d1..fc859a87197cc 100644 --- a/awt/javax/imageio/spi/ImageInputStreamSpi.java +++ b/awt/javax/imageio/spi/ImageInputStreamSpi.java @@ -18,6 +18,7 @@ * @author Rustem V. Rafikov * @version $Revision: 1.3 $ */ + package javax.imageio.spi; import java.io.File; @@ -25,13 +26,16 @@ import java.io.IOException; import javax.imageio.stream.ImageInputStream; /** - * The ImageInputStreamSpi abstract class is a service provider - * interface (SPI) for ImageInputStreams. + * The ImageInputStreamSpi abstract class is a service provider interface (SPI) + * for ImageInputStreams. + * + * @since Android 1.0 */ -public abstract class ImageInputStreamSpi extends IIOServiceProvider implements - RegisterableService { - - /** The input class. */ +public abstract class ImageInputStreamSpi extends IIOServiceProvider implements RegisterableService { + + /** + * The input class. + */ protected Class inputClass; /** @@ -44,9 +48,12 @@ public abstract class ImageInputStreamSpi extends IIOServiceProvider implements /** * Instantiates a new ImageInputStreamSpi. * - * @param vendorName the vendor name. - * @param version the version. - * @param inputClass the input class. + * @param vendorName + * the vendor name. + * @param version + * the version. + * @param inputClass + * the input class. */ public ImageInputStreamSpi(String vendorName, String version, Class inputClass) { super(vendorName, version); @@ -54,8 +61,8 @@ public abstract class ImageInputStreamSpi extends IIOServiceProvider implements } /** - * Gets an input Class object that represents class or - * interface that must be implemented by an input source. + * Gets an input Class object that represents class or interface that must + * be implemented by an input source. * * @return the input class. */ @@ -64,61 +71,59 @@ public abstract class ImageInputStreamSpi extends IIOServiceProvider implements } /** - * Returns true if the ImageInputStream can use a cache - * file. If this method returns false, the value of the - * useCache parameter of createInputStreamInstance will - * be ignored. The default implementation returns false. + * Returns true if the ImageInputStream can use a cache file. If this method + * returns false, the value of the useCache parameter of + * createInputStreamInstance will be ignored. The default implementation + * returns false. * - * @return true if the ImageInputStream can use a cache - * file, false otherwise. + * @return true, if the ImageInputStream can use a cache file, false + * otherwise. */ public boolean canUseCacheFile() { - return false; //-- def + return false; // -- def } /** - * Returns true if the ImageInputStream implementation - * requires the use of a cache file. The default implementation - * returns false. + * Returns true if the ImageInputStream implementation requires the use of a + * cache file. The default implementation returns false. * - * @return true if the ImageInputStream implementation - * requires the use of a cache file, false otherwise. + * @return true, if the ImageInputStream implementation requires the use of + * a cache file, false otherwise. */ public boolean needsCacheFile() { return false; // def } /** - * Creates the ImageInputStream associated with this - * service provider. The input object should - * be an instance of the class returned by th getInputClass - * method. This method uses the specified directory - * for the cache file if the useCache parameter is true. - * - * @param input the input Object. - * @param useCache the flag indicating if a cache file - * is needed or not. - * @param cacheDir the cache directory. + * Creates the ImageInputStream associated with this service provider. The + * input object should be an instance of the class returned by the + * getInputClass method. This method uses the specified directory for the + * cache file if the useCache parameter is true. * + * @param input + * the input Object. + * @param useCache + * the flag indicating if a cache file is needed or not. + * @param cacheDir + * the cache directory. * @return the ImageInputStream. - * - * @throws IOException Signals that an I/O exception has occurred. + * @throws IOException + * if an I/O exception has occurred. */ public abstract ImageInputStream createInputStreamInstance(Object input, boolean useCache, File cacheDir) throws IOException; /** - * Creates the ImageInputStream associated with this - * service provider. The input object should - * be an instance of the class returned by getInputClass - * method. This method uses the default system directory - * for the cache file, if it is needed. - * - * @param input the input Object. + * Creates the ImageInputStream associated with this service provider. The + * input object should be an instance of the class returned by getInputClass + * method. This method uses the default system directory for the cache file, + * if it is needed. * + * @param input + * the input Object. * @return the ImageInputStream. - * - * @throws IOException Signals that an I/O exception has occurred. + * @throws IOException + * if an I/O exception has occurred. */ public ImageInputStream createInputStreamInstance(Object input) throws IOException { return createInputStreamInstance(input, true, null); diff --git a/awt/javax/imageio/spi/ImageOutputStreamSpi.java b/awt/javax/imageio/spi/ImageOutputStreamSpi.java index d45e24cce6aec..b7a9a5c33322a 100644 --- a/awt/javax/imageio/spi/ImageOutputStreamSpi.java +++ b/awt/javax/imageio/spi/ImageOutputStreamSpi.java @@ -18,6 +18,7 @@ * @author Rustem V. Rafikov * @version $Revision: 1.3 $ */ + package javax.imageio.spi; import javax.imageio.stream.ImageOutputStream; @@ -25,13 +26,17 @@ import java.io.IOException; import java.io.File; /** - * The ImageOutputStreamSpi abstract class is a service provider - * interface (SPI) for ImageOutputStreams. + * The ImageOutputStreamSpi abstract class is a service provider interface (SPI) + * for ImageOutputStreams. + * + * @since Android 1.0 */ public abstract class ImageOutputStreamSpi extends IIOServiceProvider implements RegisterableService { - - /** The output class. */ + + /** + * The output class. + */ protected Class outputClass; /** @@ -44,9 +49,12 @@ public abstract class ImageOutputStreamSpi extends IIOServiceProvider implements /** * Instantiates a new ImageOutputStreamSpi. * - * @param vendorName the vendor name. - * @param version the version. - * @param outputClass the output class. + * @param vendorName + * the vendor name. + * @param version + * the version. + * @param outputClass + * the output class. */ public ImageOutputStreamSpi(String vendorName, String version, Class outputClass) { super(vendorName, version); @@ -54,8 +62,8 @@ public abstract class ImageOutputStreamSpi extends IIOServiceProvider implements } /** - * Gets an output Class object that represents the class or - * interface that must be implemented by an output source. + * Gets an output Class object that represents the class or interface that + * must be implemented by an output source. * * @return the output class. */ @@ -64,63 +72,61 @@ public abstract class ImageOutputStreamSpi extends IIOServiceProvider implements } /** - * Returns true if the ImageOutputStream can use a cache - * file. If this method returns false, the value of the - * useCache parameter of createOutputStreamInstance will - * be ignored. The default implementation returns false. + * Returns true if the ImageOutputStream can use a cache file. If this + * method returns false, the value of the useCache parameter of + * createOutputStreamInstance will be ignored. The default implementation + * returns false. * - * @return true if the ImageOutputStream can use a cache - * file, false otherwise. + * @return true, if the ImageOutputStream can use a cache file, false + * otherwise. */ public boolean canUseCacheFile() { return false; // def } /** - * Returns true if the ImageOutputStream implementation - * requires the use of a cache file. The default implementation - * returns false. + * Returns true if the ImageOutputStream implementation requires the use of + * a cache file. The default implementation returns false. * - * @return true if the ImageOutputStream implementation - * requires the use of a cache file, false otherwise. + * @return true, if the ImageOutputStream implementation requires the use of + * a cache file, false otherwise. */ public boolean needsCacheFile() { return false; // def } /** - * Creates the ImageOutputStream associated with this - * service provider. The output object should - * be an instance of the class returned by getOutputClass - * method. This method uses the default system directory - * for the cache file, if it is needed. - * - * @param output the output Object. + * Creates the ImageOutputStream associated with this service provider. The + * output object should be an instance of the class returned by + * getOutputClass method. This method uses the default system directory for + * the cache file, if it is needed. * + * @param output + * the output Object. * @return the ImageOutputStream. - * - * @throws IOException Signals that an I/O exception has occurred. + * @throws IOException + * if an I/O exception has occurred. */ public ImageOutputStream createOutputStreamInstance(Object output) throws IOException { return createOutputStreamInstance(output, true, null); } /** - * Creates the ImageOutputStream associated with this - * service provider. The output object should - * be an instance of the class returned by getInputClass - * method. This method uses the specified directory - * for the cache file, if the useCache parameter is true. - * - * @param output the output Object. - * @param useCache the flag indicating if cache file - * is needed or not. - * @param cacheDir the cache directory. + * Creates the ImageOutputStream associated with this service provider. The + * output object should be an instance of the class returned by + * getInputClass method. This method uses the specified directory for the + * cache file, if the useCache parameter is true. * + * @param output + * the output Object. + * @param useCache + * the flag indicating if cache file is needed or not. + * @param cacheDir + * the cache directory. * @return the ImageOutputStream. - * - * @throws IOException Signals that an I/O exception has occurred. + * @throws IOException + * if an I/O exception has occurred. */ - public abstract ImageOutputStream createOutputStreamInstance(Object output, - boolean useCache, File cacheDir) throws IOException; + public abstract ImageOutputStream createOutputStreamInstance(Object output, boolean useCache, + File cacheDir) throws IOException; } diff --git a/awt/javax/imageio/spi/ImageReaderSpi.java b/awt/javax/imageio/spi/ImageReaderSpi.java index 2e2484c462aa7..0528d250b11d4 100644 --- a/awt/javax/imageio/spi/ImageReaderSpi.java +++ b/awt/javax/imageio/spi/ImageReaderSpi.java @@ -18,6 +18,7 @@ * @author Rustem V. Rafikov * @version $Revision: 1.3 $ */ + package javax.imageio.spi; import javax.imageio.stream.ImageInputStream; @@ -25,20 +26,28 @@ import javax.imageio.ImageReader; import java.io.IOException; /** - * The ImageReaderSpi abstract class is a service provider - * interface (SPI) for ImageReaders. + * The ImageReaderSpi abstract class is a service provider interface (SPI) for + * ImageReaders. + * + * @since Android 1.0 */ public abstract class ImageReaderSpi extends ImageReaderWriterSpi { - /** - * The STANDARD_INPUT_TYPE contains ImageInputStream.class. + /** + * The STANDARD_INPUT_TYPE contains ImageInputStream.class. */ - public static final Class[] STANDARD_INPUT_TYPE = new Class[] {ImageInputStream.class}; + public static final Class[] STANDARD_INPUT_TYPE = new Class[] { + ImageInputStream.class + }; - /** The input types. */ + /** + * The input types. + */ protected Class[] inputTypes; - - /** The writer SPI names. */ + + /** + * The writer SPI names. + */ protected String[] writerSpiNames; /** @@ -51,49 +60,62 @@ public abstract class ImageReaderSpi extends ImageReaderWriterSpi { /** * Instantiates a new ImageReaderSpi. * - * @param vendorName the vendor name. - * @param version the version. - * @param names the format names. - * @param suffixes the array of strings representing the file suffixes. - * @param MIMETypes the an array of strings representing MIME types. - * @param pluginClassName the plugin class name. - * @param inputTypes the input types. - * @param writerSpiNames the array of strings with class names of all - * associated ImageWriters. - * @param supportsStandardStreamMetadataFormat the value indicating - * if stream metadata can be described by standart metadata format. - * @param nativeStreamMetadataFormatName the native stream metadata - * format name, returned by getNativeStreamMetadataFormatName. - * @param nativeStreamMetadataFormatClassName the native stream - * metadata format class name, returned by getNativeStreamMetadataFormat. - * @param extraStreamMetadataFormatNames the extra stream metadata - * format names, returned by getExtraStreamMetadataFormatNames. - * @param extraStreamMetadataFormatClassNames the extra stream metadata - * format class names, returned by getStreamMetadataFormat. - * @param supportsStandardImageMetadataFormat the value indicating - * if image metadata can be described by standart metadata format. - * @param nativeImageMetadataFormatName the native image metadata - * format name, returned by getNativeImageMetadataFormatName. - * @param nativeImageMetadataFormatClassName the native image - * metadata format class name, returned by getNativeImageMetadataFormat. - * @param extraImageMetadataFormatNames the extra image metadata - * format names, returned by getExtraImageMetadataFormatNames. - * @param extraImageMetadataFormatClassNames the extra image metadata - * format class names, returned by getImageMetadataFormat. + * @param vendorName + * the vendor name. + * @param version + * the version. + * @param names + * the format names. + * @param suffixes + * the array of strings representing the file suffixes. + * @param MIMETypes + * the an array of strings representing MIME types. + * @param pluginClassName + * the plug-in class name. + * @param inputTypes + * the input types. + * @param writerSpiNames + * the array of strings with class names of all associated + * ImageWriters. + * @param supportsStandardStreamMetadataFormat + * the value indicating if stream metadata can be described by + * standard metadata format. + * @param nativeStreamMetadataFormatName + * the native stream metadata format name, returned by + * getNativeStreamMetadataFormatName. + * @param nativeStreamMetadataFormatClassName + * the native stream metadata format class name, returned by + * getNativeStreamMetadataFormat. + * @param extraStreamMetadataFormatNames + * the extra stream metadata format names, returned by + * getExtraStreamMetadataFormatNames. + * @param extraStreamMetadataFormatClassNames + * the extra stream metadata format class names, returned by + * getStreamMetadataFormat. + * @param supportsStandardImageMetadataFormat + * the value indicating if image metadata can be described by + * standard metadata format. + * @param nativeImageMetadataFormatName + * the native image metadata format name, returned by + * getNativeImageMetadataFormatName. + * @param nativeImageMetadataFormatClassName + * the native image metadata format class name, returned by + * getNativeImageMetadataFormat. + * @param extraImageMetadataFormatNames + * the extra image metadata format names, returned by + * getExtraImageMetadataFormatNames. + * @param extraImageMetadataFormatClassNames + * the extra image metadata format class names, returned by + * getImageMetadataFormat. */ public ImageReaderSpi(String vendorName, String version, String[] names, String[] suffixes, - String[] MIMETypes, String pluginClassName, - Class[] inputTypes, String[] writerSpiNames, - boolean supportsStandardStreamMetadataFormat, - String nativeStreamMetadataFormatName, - String nativeStreamMetadataFormatClassName, - String[] extraStreamMetadataFormatNames, - String[] extraStreamMetadataFormatClassNames, - boolean supportsStandardImageMetadataFormat, - String nativeImageMetadataFormatName, - String nativeImageMetadataFormatClassName, - String[] extraImageMetadataFormatNames, - String[] extraImageMetadataFormatClassNames) { + String[] MIMETypes, String pluginClassName, Class[] inputTypes, + String[] writerSpiNames, boolean supportsStandardStreamMetadataFormat, + String nativeStreamMetadataFormatName, String nativeStreamMetadataFormatClassName, + String[] extraStreamMetadataFormatNames, String[] extraStreamMetadataFormatClassNames, + boolean supportsStandardImageMetadataFormat, String nativeImageMetadataFormatName, + String nativeImageMetadataFormatClassName, String[] extraImageMetadataFormatNames, + String[] extraImageMetadataFormatClassNames) { super(vendorName, version, names, suffixes, MIMETypes, pluginClassName, supportsStandardStreamMetadataFormat, nativeStreamMetadataFormatName, nativeStreamMetadataFormatClassName, extraStreamMetadataFormatNames, @@ -109,8 +131,8 @@ public abstract class ImageReaderSpi extends ImageReaderWriterSpi { } /** - * Gets an array of Class objects whose types can be used - * as input for this reader. + * Gets an array of Class objects whose types can be used as input for this + * reader. * * @return the input types. */ @@ -119,66 +141,62 @@ public abstract class ImageReaderSpi extends ImageReaderWriterSpi { } /** - * Returns true if the format of source object is - * supported by this reader. + * Returns true if the format of source object is supported by this reader. * - * @param source the source object to be decoded - * (for example an ImageInputStream). - * - * @return true if the format of source object is - * supported by this reader, false otherwise. - * - * @throws IOException Signals that an I/O exception has occurred. + * @param source + * the source object to be decoded (for example an + * ImageInputStream). + * @return true, if the format of source object is supported by this reader, + * false otherwise. + * @throws IOException + * if an I/O exception has occurred. */ public abstract boolean canDecodeInput(Object source) throws IOException; /** - * Returns an instance of the ImageReader implementation for - * this service provider. + * Returns an instance of the ImageReader implementation for this service + * provider. * * @return the ImageReader. - * - * @throws IOException Signals that an I/O exception has occurred. + * @throws IOException + * if an I/O exception has occurred. */ public ImageReader createReaderInstance() throws IOException { return createReaderInstance(null); } /** - * Returns an instance of the ImageReader implementation for - * this service provider. - * - * @param extension the a plugin specific extension object, or null. + * Returns an instance of the ImageReader implementation for this service + * provider. * + * @param extension + * the a plug-in specific extension object, or null. * @return the ImageReader. - * - * @throws IOException Signals that an I/O exception has occurred. + * @throws IOException + * if an I/O exception has occurred. */ public abstract ImageReader createReaderInstance(Object extension) throws IOException; /** - * Checks whether or not the specified ImageReader object - * is an instance of the ImageReader associated with this - * service provider or not. - * - * @param reader the ImageReader. + * Checks whether or not the specified ImageReader object is an instance of + * the ImageReader associated with this service provider or not. * - * @return true, if the specified ImageReader object - * is an instance of the ImageReader associated with this - * service provider, false otherwise. + * @param reader + * the ImageReader. + * @return true, if the specified ImageReader object is an instance of the + * ImageReader associated with this service provider, false + * otherwise. */ public boolean isOwnReader(ImageReader reader) { throw new UnsupportedOperationException("Not supported yet"); } /** - * Gets an array of strings with names of the ImageWriterSpi - * classes that support the internal metadata representation - * used by the ImageReader of this service provider, or null if - * there are no such ImageWriters. + * Gets an array of strings with names of the ImageWriterSpi classes that + * support the internal metadata representation used by the ImageReader of + * this service provider, or null if there are no such ImageWriters. * - * @return an array of strings with names of the ImageWriterSpi - * classes. + * @return the array of strings with names of the ImageWriterSpi classes. */ public String[] getImageWriterSpiNames() { throw new UnsupportedOperationException("Not supported yet"); diff --git a/awt/javax/imageio/spi/ImageReaderWriterSpi.java b/awt/javax/imageio/spi/ImageReaderWriterSpi.java index b3c0f92fa064d..9ca08b5ea0853 100644 --- a/awt/javax/imageio/spi/ImageReaderWriterSpi.java +++ b/awt/javax/imageio/spi/ImageReaderWriterSpi.java @@ -18,6 +18,7 @@ * @author Rustem V. Rafikov * @version $Revision: 1.3 $ */ + package javax.imageio.spi; import org.apache.harmony.x.imageio.metadata.IIOMetadataUtils; @@ -25,97 +26,138 @@ import org.apache.harmony.x.imageio.metadata.IIOMetadataUtils; import javax.imageio.metadata.IIOMetadataFormat; /** - * The ImageReaderWriterSpi class is a superclass for the - * ImageReaderSpi and ImageWriterSpi SPIs. + * The ImageReaderWriterSpi class is a superclass for the ImageReaderSpi and + * ImageWriterSpi SPIs. + * + * @since Android 1.0 */ -public abstract class ImageReaderWriterSpi extends IIOServiceProvider - implements RegisterableService { +public abstract class ImageReaderWriterSpi extends IIOServiceProvider implements + RegisterableService { - /** The names. */ + /** + * The names. + */ protected String[] names; - - /** The suffixes. */ + + /** + * The suffixes. + */ protected String[] suffixes; - - /** The MIME types. */ + + /** + * The MIME types. + */ protected String[] MIMETypes; - - /** The plugin class name. */ + + /** + * The plug-in class name. + */ protected String pluginClassName; - - /** Whether the reader/writer supports standard stream metadata format. */ + + /** + * Whether the reader/writer supports standard stream metadata format. + */ protected boolean supportsStandardStreamMetadataFormat; - - /** The native stream metadata format name. */ + + /** + * The native stream metadata format name. + */ protected String nativeStreamMetadataFormatName; - - /** The native stream metadata format class name. */ + + /** + * The native stream metadata format class name. + */ protected String nativeStreamMetadataFormatClassName; - - /** The extra stream metadata format names. */ + + /** + * The extra stream metadata format names. + */ protected String[] extraStreamMetadataFormatNames; - - /** The extra stream metadata format class names. */ + + /** + * The extra stream metadata format class names. + */ protected String[] extraStreamMetadataFormatClassNames; - - /** Whether the reader/writer supports standard image metadata format. */ + + /** + * Whether the reader/writer supports standard image metadata format. + */ protected boolean supportsStandardImageMetadataFormat; - - /** The native image metadata format name. */ + + /** + * The native image metadata format name. + */ protected String nativeImageMetadataFormatName; - - /** The native image metadata format class name. */ + + /** + * The native image metadata format class name. + */ protected String nativeImageMetadataFormatClassName; - - /** The extra image metadata format names. */ + + /** + * The extra image metadata format names. + */ protected String[] extraImageMetadataFormatNames; - - /** The extra image metadata format class names. */ + + /** + * The extra image metadata format class names. + */ protected String[] extraImageMetadataFormatClassNames; /** * Instantiates a new ImageReaderWriterSpi. * - * @param vendorName the vendor name. - * @param version the version. - * @param names the format names. - * @param suffixes the array of strings representing the file suffixes. - * @param MIMETypes the an array of strings representing MIME types. - * @param pluginClassName the plugin class name. - * @param supportsStandardStreamMetadataFormat the value indicating - * if stream metadata can be described by standart metadata format. - * @param nativeStreamMetadataFormatName the native stream metadata - * format name, returned by getNativeStreamMetadataFormatName. - * @param nativeStreamMetadataFormatClassName the native stream - * metadata format class name, returned by getNativeStreamMetadataFormat. - * @param extraStreamMetadataFormatNames the extra stream metadata - * format names, returned by getExtraStreamMetadataFormatNames. - * @param extraStreamMetadataFormatClassNames the extra stream metadata - * format class names, returned by getStreamMetadataFormat. - * @param supportsStandardImageMetadataFormat the value indicating - * if image metadata can be described by standard metadata format. - * @param nativeImageMetadataFormatName the native image metadata - * format name, returned by getNativeImageMetadataFormatName. - * @param nativeImageMetadataFormatClassName the native image - * metadata format class name, returned by getNativeImageMetadataFormat. - * @param extraImageMetadataFormatNames the extra image metadata - * format names, returned by getExtraImageMetadataFormatNames. - * @param extraImageMetadataFormatClassNames the extra image metadata - * format class names, returned by getImageMetadataFormat. + * @param vendorName + * the vendor name. + * @param version + * the version. + * @param names + * the format names. + * @param suffixes + * the array of strings representing the file suffixes. + * @param MIMETypes + * the an array of strings representing MIME types. + * @param pluginClassName + * the plug-in class name. + * @param supportsStandardStreamMetadataFormat + * the value indicating if stream metadata can be described by + * standard metadata format. + * @param nativeStreamMetadataFormatName + * the native stream metadata format name, returned by + * getNativeStreamMetadataFormatName. + * @param nativeStreamMetadataFormatClassName + * the native stream metadata format class name, returned by + * getNativeStreamMetadataFormat. + * @param extraStreamMetadataFormatNames + * the extra stream metadata format names, returned by + * getExtraStreamMetadataFormatNames. + * @param extraStreamMetadataFormatClassNames + * the extra stream metadata format class names, returned by + * getStreamMetadataFormat. + * @param supportsStandardImageMetadataFormat + * the value indicating if image metadata can be described by + * standard metadata format. + * @param nativeImageMetadataFormatName + * the native image metadata format name, returned by + * getNativeImageMetadataFormatName. + * @param nativeImageMetadataFormatClassName + * the native image metadata format class name, returned by + * getNativeImageMetadataFormat. + * @param extraImageMetadataFormatNames + * the extra image metadata format names, returned by + * getExtraImageMetadataFormatNames. + * @param extraImageMetadataFormatClassNames + * the extra image metadata format class names, returned by + * getImageMetadataFormat. */ public ImageReaderWriterSpi(String vendorName, String version, String[] names, - String[] suffixes, String[] MIMETypes, - String pluginClassName, - boolean supportsStandardStreamMetadataFormat, - String nativeStreamMetadataFormatName, - String nativeStreamMetadataFormatClassName, - String[] extraStreamMetadataFormatNames, - String[] extraStreamMetadataFormatClassNames, - boolean supportsStandardImageMetadataFormat, - String nativeImageMetadataFormatName, - String nativeImageMetadataFormatClassName, - String[] extraImageMetadataFormatNames, - String[] extraImageMetadataFormatClassNames) { + String[] suffixes, String[] MIMETypes, String pluginClassName, + boolean supportsStandardStreamMetadataFormat, String nativeStreamMetadataFormatName, + String nativeStreamMetadataFormatClassName, String[] extraStreamMetadataFormatNames, + String[] extraStreamMetadataFormatClassNames, + boolean supportsStandardImageMetadataFormat, String nativeImageMetadataFormatName, + String nativeImageMetadataFormatClassName, String[] extraImageMetadataFormatNames, + String[] extraImageMetadataFormatClassNames) { super(vendorName, version); if (names == null || names.length == 0) { @@ -137,60 +179,54 @@ public abstract class ImageReaderWriterSpi extends IIOServiceProvider this.nativeStreamMetadataFormatName = nativeStreamMetadataFormatName; this.nativeStreamMetadataFormatClassName = nativeStreamMetadataFormatClassName; - this.extraStreamMetadataFormatNames = - extraStreamMetadataFormatNames == null ? - null : extraStreamMetadataFormatNames.clone(); + this.extraStreamMetadataFormatNames = extraStreamMetadataFormatNames == null ? null + : extraStreamMetadataFormatNames.clone(); - this.extraStreamMetadataFormatClassNames = - extraStreamMetadataFormatClassNames == null ? - null : extraStreamMetadataFormatClassNames.clone(); + this.extraStreamMetadataFormatClassNames = extraStreamMetadataFormatClassNames == null ? null + : extraStreamMetadataFormatClassNames.clone(); this.supportsStandardImageMetadataFormat = supportsStandardImageMetadataFormat; this.nativeImageMetadataFormatName = nativeImageMetadataFormatName; this.nativeImageMetadataFormatClassName = nativeImageMetadataFormatClassName; - this.extraImageMetadataFormatNames = - extraImageMetadataFormatNames == null ? - null : extraImageMetadataFormatNames.clone(); + this.extraImageMetadataFormatNames = extraImageMetadataFormatNames == null ? null + : extraImageMetadataFormatNames.clone(); - this.extraImageMetadataFormatClassNames = - extraImageMetadataFormatClassNames == null ? - null : extraImageMetadataFormatClassNames.clone(); + this.extraImageMetadataFormatClassNames = extraImageMetadataFormatClassNames == null ? null + : extraImageMetadataFormatClassNames.clone(); } /** * Instantiates a new ImageReaderWriterSpi. */ - public ImageReaderWriterSpi() {} + public ImageReaderWriterSpi() { + } /** - * Gets an array of strings representing names of the formats - * that can be used by the ImageReader - * or ImageWriter implementation associated with this service - * provider. + * Gets an array of strings representing names of the formats that can be + * used by the ImageReader or ImageWriter implementation associated with + * this service provider. * - * @return an array of supported format names. + * @return the array of supported format names. */ public String[] getFormatNames() { return names.clone(); } /** - * Gets an array of strings representing file suffixes - * associated with the formats that can be used by the - * ImageReader or ImageWriter implementation of this - * service provider. + * Gets an array of strings representing file suffixes associated with the + * formats that can be used by the ImageReader or ImageWriter implementation + * of this service provider. * - * @return an array of file suffixes. + * @return the array of file suffixes. */ public String[] getFileSuffixes() { return suffixes == null ? null : suffixes.clone(); } /** - * Gets an array of strings with the names of - * additional formats of the image metadata objects - * produced or consumed by this plug-in. + * Gets an array of strings with the names of additional formats of the + * image metadata objects produced or consumed by this plug-in. * * @return the array of extra image metadata format names. */ @@ -199,52 +235,49 @@ public abstract class ImageReaderWriterSpi extends IIOServiceProvider } /** - * Gets an array of strings with the names of - * additional formats of the stream metadata objects - * produced or consumed by this plug-in. + * Gets an array of strings with the names of additional formats of the + * stream metadata objects produced or consumed by this plug-in. * * @return the array of extra stream metadata format names. */ public String[] getExtraStreamMetadataFormatNames() { - return extraStreamMetadataFormatNames == null ? null : extraStreamMetadataFormatNames.clone(); + return extraStreamMetadataFormatNames == null ? null : extraStreamMetadataFormatNames + .clone(); } /** - * Gets an IIOMetadataFormat object for the specified image - * metadata format name. - * - * @param formatName the format name. + * Gets an IIOMetadataFormat object for the specified image metadata format + * name. * + * @param formatName + * the format name. * @return the IIOMetadataFormat, or null. */ public IIOMetadataFormat getImageMetadataFormat(String formatName) { - return IIOMetadataUtils.instantiateMetadataFormat( - formatName, supportsStandardImageMetadataFormat, - nativeImageMetadataFormatName, nativeImageMetadataFormatClassName, - extraImageMetadataFormatNames, extraImageMetadataFormatClassNames - ); + return IIOMetadataUtils.instantiateMetadataFormat(formatName, + supportsStandardImageMetadataFormat, nativeImageMetadataFormatName, + nativeImageMetadataFormatClassName, extraImageMetadataFormatNames, + extraImageMetadataFormatClassNames); } /** - * Gets an IIOMetadataFormat object for the specified stream - * metadata format name. - * - * @param formatName the format name. + * Gets an IIOMetadataFormat object for the specified stream metadata format + * name. * + * @param formatName + * the format name. * @return the IIOMetadataFormat, or null. */ public IIOMetadataFormat getStreamMetadataFormat(String formatName) { - return IIOMetadataUtils.instantiateMetadataFormat( - formatName, supportsStandardStreamMetadataFormat, - nativeStreamMetadataFormatName, nativeStreamMetadataFormatClassName, - extraStreamMetadataFormatNames, extraStreamMetadataFormatClassNames - ); + return IIOMetadataUtils.instantiateMetadataFormat(formatName, + supportsStandardStreamMetadataFormat, nativeStreamMetadataFormatName, + nativeStreamMetadataFormatClassName, extraStreamMetadataFormatNames, + extraStreamMetadataFormatClassNames); } /** - * Gets an array of strings representing the MIME types - * of the formats that are supported by the - * ImageReader or ImageWriter implementation of this + * Gets an array of strings representing the MIME types of the formats that + * are supported by the ImageReader or ImageWriter implementation of this * service provider. * * @return the array MIME types. @@ -254,32 +287,30 @@ public abstract class ImageReaderWriterSpi extends IIOServiceProvider } /** - * Gets the name of the native image metadata format for - * this reader/writer, which allows for lossless encoding - * or decoding of the image metadata with the format. + * Gets the name of the native image metadata format for this reader/writer, + * which allows for lossless encoding or decoding of the image metadata with + * the format. * - * @return the string with native image metadata format name, - * or null. + * @return the string with native image metadata format name, or null. */ public String getNativeImageMetadataFormatName() { return nativeImageMetadataFormatName; } /** - * Gets the name of the native stream metadata format for - * this reader/writer, which allows for lossless encoding - * or decoding of the stream metadata with the format. + * Gets the name of the native stream metadata format for this + * reader/writer, which allows for lossless encoding or decoding of the + * stream metadata with the format. * - * @return the string with native stream metadata format name, - * or null. + * @return the string with native stream metadata format name, or null. */ public String getNativeStreamMetadataFormatName() { return nativeStreamMetadataFormatName; } /** - * Gets the class name of the ImageReader - * or ImageWriter associated with this service provider. + * Gets the class name of the ImageReader or ImageWriter associated with + * this service provider. * * @return the class name. */ @@ -288,26 +319,24 @@ public abstract class ImageReaderWriterSpi extends IIOServiceProvider } /** - * Checks if the standard metadata format is supported - * by the getAsTree and setFromTree methods for the - * image metadata objects produced or consumed by this - * reader or writer. + * Checks if the standard metadata format is supported by the getAsTree and + * setFromTree methods for the image metadata objects produced or consumed + * by this reader or writer. * - * @return true, if standard image metadata format is - * supported, false otherwise. + * @return true, if standard image metadata format is supported, false + * otherwise. */ public boolean isStandardImageMetadataFormatSupported() { return supportsStandardImageMetadataFormat; } /** - * Checks if the standard metadata format is supported - * by the getAsTree and setFromTree methods for the - * stream metadata objects produced or consumed by this - * reader or writer. + * Checks if the standard metadata format is supported by the getAsTree and + * setFromTree methods for the stream metadata objects produced or consumed + * by this reader or writer. * - * @return true, if standard stream metadata format is - * supported, false otherwise. + * @return true, if standard stream metadata format is supported, false + * otherwise. */ public boolean isStandardStreamMetadataFormatSupported() { return supportsStandardStreamMetadataFormat; diff --git a/awt/javax/imageio/spi/ImageTranscoderSpi.java b/awt/javax/imageio/spi/ImageTranscoderSpi.java index 68c4024f5c5d5..742af19082997 100644 --- a/awt/javax/imageio/spi/ImageTranscoderSpi.java +++ b/awt/javax/imageio/spi/ImageTranscoderSpi.java @@ -18,16 +18,18 @@ * @author Rustem V. Rafikov * @version $Revision: 1.3 $ */ + package javax.imageio.spi; import javax.imageio.ImageTranscoder; /** - * The ImageTranscoderSpi class is a service provider interface (SPI) - * for ImageTranscoders. + * The ImageTranscoderSpi class is a service provider interface (SPI) for + * ImageTranscoders. + * + * @since Android 1.0 */ -public abstract class ImageTranscoderSpi extends IIOServiceProvider - implements RegisterableService { +public abstract class ImageTranscoderSpi extends IIOServiceProvider implements RegisterableService { /** * Instantiates a new ImageTranscoderSpi. @@ -36,37 +38,37 @@ public abstract class ImageTranscoderSpi extends IIOServiceProvider } /** - * Instantiates a new ImageTranscoderSpi with the specified - * vendor name and version. + * Instantiates a new ImageTranscoderSpi with the specified vendor name and + * version. * - * @param vendorName the vendor name. - * @param version the version. + * @param vendorName + * the vendor name. + * @param version + * the version. */ public ImageTranscoderSpi(String vendorName, String version) { super(vendorName, version); } /** - * Gets the class name of an ImageReaderSpi that - * produces IIOMetadata objects that can be used as - * input to this transcoder. + * Gets the class name of an ImageReaderSpi that produces IIOMetadata + * objects that can be used as input to this transcoder. * * @return the class name of an ImageReaderSpi. */ public abstract String getReaderServiceProviderName(); /** - * Gets the class name of an ImageWriterSpi that - * produces IIOMetadata objects that can be used as - * input to this transcoder. + * Gets the class name of an ImageWriterSpi that produces IIOMetadata + * objects that can be used as input to this transcoder. * * @return the class name of an ImageWriterSpi. */ public abstract String getWriterServiceProviderName(); /** - * Creates an instance of the ImageTranscoder associated - * with this service provider. + * Creates an instance of the ImageTranscoder associated with this service + * provider. * * @return the ImageTranscoder instance. */ diff --git a/awt/javax/imageio/spi/ImageWriterSpi.java b/awt/javax/imageio/spi/ImageWriterSpi.java index 979ef77ce74cf..bf25455920dc7 100644 --- a/awt/javax/imageio/spi/ImageWriterSpi.java +++ b/awt/javax/imageio/spi/ImageWriterSpi.java @@ -18,6 +18,7 @@ * @author Rustem V. Rafikov * @version $Revision: 1.3 $ */ + package javax.imageio.spi; import javax.imageio.stream.ImageInputStream; @@ -27,18 +28,28 @@ import java.awt.image.RenderedImage; import java.io.IOException; /** - * The ImageWriterSpi abstract class is a service provider - * interface (SPI) for ImageWriters. + * The ImageWriterSpi abstract class is a service provider interface (SPI) for + * ImageWriters. + * + * @since Android 1.0 */ public abstract class ImageWriterSpi extends ImageReaderWriterSpi { - /** The STANDARD_OUTPUT_TYPE contains ImageInputStream.class. */ - public static final Class[] STANDARD_OUTPUT_TYPE = new Class[] {ImageInputStream.class}; + /** + * The STANDARD_OUTPUT_TYPE contains ImageInputStream.class. + */ + public static final Class[] STANDARD_OUTPUT_TYPE = new Class[] { + ImageInputStream.class + }; - /** The output types. */ + /** + * The output types. + */ protected Class[] outputTypes; - - /** The reader spi names. */ + + /** + * The reader SPI names. + */ protected String[] readerSpiNames; /** @@ -51,50 +62,62 @@ public abstract class ImageWriterSpi extends ImageReaderWriterSpi { /** * Instantiates a new ImageWriterSpi with the specified parameters. * - * @param vendorName the vendor name. - * @param version the version. - * @param names the format names. - * @param suffixes the array of strings representing the file suffixes. - * @param MIMETypes the an array of strings representing MIME types. - * @param pluginClassName the plugin class name. - * @param outputTypes the output types. - * @param readerSpiNames the array of strings with class names of all - * associated ImageReaders. - * @param supportsStandardStreamMetadataFormat the value indicating - * if stream metadata can be described by standard metadata format. - * @param nativeStreamMetadataFormatName the native stream metadata - * format name, returned by getNativeStreamMetadataFormatName. - * @param nativeStreamMetadataFormatClassName the native stream - * metadata format class name, returned by getNativeStreamMetadataFormat. - * @param extraStreamMetadataFormatNames the extra stream metadata - * format names, returned by getExtraStreamMetadataFormatNames. - * @param extraStreamMetadataFormatClassNames the extra stream metadata - * format class names, returned by getStreamMetadataFormat. - * @param supportsStandardImageMetadataFormat the value indicating - * if image metadata can be described by standard metadata format. - * @param nativeImageMetadataFormatName the native image metadata - * format name, returned by getNativeImageMetadataFormatName. - * @param nativeImageMetadataFormatClassName the native image - * metadata format class name, returned by getNativeImageMetadataFormat. - * @param extraImageMetadataFormatNames the extra image metadata - * format names, returned by getExtraImageMetadataFormatNames. - * @param extraImageMetadataFormatClassNames the extra image metadata - * format class names, returned by getImageMetadataFormat. + * @param vendorName + * the vendor name. + * @param version + * the version. + * @param names + * the format names. + * @param suffixes + * the array of strings representing the file suffixes. + * @param MIMETypes + * the an array of strings representing MIME types. + * @param pluginClassName + * the plug-in class name. + * @param outputTypes + * the output types. + * @param readerSpiNames + * the array of strings with class names of all associated + * ImageReaders. + * @param supportsStandardStreamMetadataFormat + * the value indicating if stream metadata can be described by + * standard metadata format. + * @param nativeStreamMetadataFormatName + * the native stream metadata format name, returned by + * getNativeStreamMetadataFormatName. + * @param nativeStreamMetadataFormatClassName + * the native stream metadata format class name, returned by + * getNativeStreamMetadataFormat. + * @param extraStreamMetadataFormatNames + * the extra stream metadata format names, returned by + * getExtraStreamMetadataFormatNames. + * @param extraStreamMetadataFormatClassNames + * the extra stream metadata format class names, returned by + * getStreamMetadataFormat. + * @param supportsStandardImageMetadataFormat + * the value indicating if image metadata can be described by + * standard metadata format. + * @param nativeImageMetadataFormatName + * the native image metadata format name, returned by + * getNativeImageMetadataFormatName. + * @param nativeImageMetadataFormatClassName + * the native image metadata format class name, returned by + * getNativeImageMetadataFormat. + * @param extraImageMetadataFormatNames + * the extra image metadata format names, returned by + * getExtraImageMetadataFormatNames. + * @param extraImageMetadataFormatClassNames + * the extra image metadata format class names, returned by + * getImageMetadataFormat. */ - public ImageWriterSpi(String vendorName, String version, String[] names, - String[] suffixes, String[] MIMETypes, - String pluginClassName, - Class[] outputTypes, String[] readerSpiNames, - boolean supportsStandardStreamMetadataFormat, - String nativeStreamMetadataFormatName, - String nativeStreamMetadataFormatClassName, - String[] extraStreamMetadataFormatNames, - String[] extraStreamMetadataFormatClassNames, - boolean supportsStandardImageMetadataFormat, - String nativeImageMetadataFormatName, - String nativeImageMetadataFormatClassName, - String[] extraImageMetadataFormatNames, - String[] extraImageMetadataFormatClassNames) { + public ImageWriterSpi(String vendorName, String version, String[] names, String[] suffixes, + String[] MIMETypes, String pluginClassName, Class[] outputTypes, + String[] readerSpiNames, boolean supportsStandardStreamMetadataFormat, + String nativeStreamMetadataFormatName, String nativeStreamMetadataFormatClassName, + String[] extraStreamMetadataFormatNames, String[] extraStreamMetadataFormatClassNames, + boolean supportsStandardImageMetadataFormat, String nativeImageMetadataFormatName, + String nativeImageMetadataFormatClassName, String[] extraImageMetadataFormatNames, + String[] extraImageMetadataFormatClassNames) { super(vendorName, version, names, suffixes, MIMETypes, pluginClassName, supportsStandardStreamMetadataFormat, nativeStreamMetadataFormatName, nativeStreamMetadataFormatClassName, extraStreamMetadataFormatNames, @@ -111,8 +134,8 @@ public abstract class ImageWriterSpi extends ImageReaderWriterSpi { } /** - * Returns true if the format of the writer's output is lossless. - * The default implementation returns true. + * Returns true if the format of the writer's output is lossless. The + * default implementation returns true. * * @return true, if a format is lossless, false otherwise. */ @@ -121,8 +144,8 @@ public abstract class ImageWriterSpi extends ImageReaderWriterSpi { } /** - * Gets an array of Class objects whose types - * can be used as output for this writer. + * Gets an array of Class objects whose types can be used as output for this + * writer. * * @return the output types. */ @@ -131,77 +154,72 @@ public abstract class ImageWriterSpi extends ImageReaderWriterSpi { } /** - * Checks whether or not the ImageWriter implementation associated - * with this service provider can encode an image with - * the specified type. - * - * @param type the ImageTypeSpecifier. + * Checks whether or not the ImageWriter implementation associated with this + * service provider can encode an image with the specified type. * - * @return true, if an image with the specified type can be - * encoded, false otherwise. + * @param type + * the ImageTypeSpecifier. + * @return true, if an image with the specified type can be encoded, false + * otherwise. */ public abstract boolean canEncodeImage(ImageTypeSpecifier type); /** - * Checks whether or not the ImageWriter implementation associated - * with this service provider can encode the specified RenderedImage. + * Checks whether or not the ImageWriter implementation associated with this + * service provider can encode the specified RenderedImage. * - * @param im the RenderedImage. - * - * @return true, if RenderedImage can be encoded, - * false otherwise. + * @param im + * the RenderedImage. + * @return true, if RenderedImage can be encoded, false otherwise. */ public boolean canEncodeImage(RenderedImage im) { return canEncodeImage(ImageTypeSpecifier.createFromRenderedImage(im)); } /** - * Returns an instance of the ImageWriter implementation for - * this service provider. + * Returns an instance of the ImageWriter implementation for this service + * provider. * * @return the ImageWriter. - * - * @throws IOException Signals that an I/O exception has occurred. + * @throws IOException + * if an I/O exception has occurred. */ public ImageWriter createWriterInstance() throws IOException { return createWriterInstance(null); } /** - * Returns an instance of the ImageWriter implementation for - * this service provider. - * - * @param extension the a plugin specific extension object, or null. + * Returns an instance of the ImageWriter implementation for this service + * provider. * + * @param extension + * the a plug-in specific extension object, or null. * @return the ImageWriter. - * - * @throws IOException Signals that an I/O exception has occurred. + * @throws IOException + * if an I/O exception has occurred. */ public abstract ImageWriter createWriterInstance(Object extension) throws IOException; /** - * Checks whether or not the specified ImageWriter object - * is an instance of the ImageWriter associated with this - * service provider or not. - * - * @param writer the ImageWriter. + * Checks whether or not the specified ImageWriter object is an instance of + * the ImageWriter associated with this service provider or not. * - * @return true, if the specified ImageWriter object - * is an instance of the ImageWriter associated with this - * service provider, false otherwise. + * @param writer + * the ImageWriter. + * @return true, if the specified ImageWriter object is an instance of the + * ImageWriter associated with this service provider, false + * otherwise. */ public boolean isOwnWriter(ImageWriter writer) { throw new UnsupportedOperationException("Not supported yet"); } /** - * Gets an array of strings with names of the ImageReaderSpi - * classes that support the internal metadata representation - * used by the ImageWriter of this service provider, or null if - * there are no such ImageReaders. + * Gets an array of strings with names of the ImageReaderSpi classes that + * support the internal metadata representation used by the ImageWriter of + * this service provider, or null if there are no such ImageReaders. * - * @return an array of strings with names of the ImageWriterSpi - * classes. + * @return the array of strings with names of the ImageWriterSpi classes. */ public String[] getImageReaderSpiNames() { return readerSpiNames; diff --git a/awt/javax/imageio/spi/RegisterableService.java b/awt/javax/imageio/spi/RegisterableService.java index b50754ef6cbdc..ae2f4d39f47b4 100644 --- a/awt/javax/imageio/spi/RegisterableService.java +++ b/awt/javax/imageio/spi/RegisterableService.java @@ -18,33 +18,37 @@ * @author Rustem V. Rafikov * @version $Revision: 1.3 $ */ + package javax.imageio.spi; /** - * The RegisterableService interface provides service provider - * objects that can be registered by a ServiceRegistry, and - * notifications that registration and deregistration have been - * performed. + * The RegisterableService interface provides service provider objects that can + * be registered by a ServiceRegistry, and notifications that registration and + * deregistration have been performed. + * + * @since Android 1.0 */ public interface RegisterableService { - + /** - * This method is called when the object which implements this - * interface is registered to the specified category of the - * specified registry. + * This method is called when the object which implements this interface is + * registered to the specified category of the specified registry. * - * @param registry the ServiceRegistry to be registered. - * @param category the class representing a category. + * @param registry + * the ServiceRegistry to be registered. + * @param category + * the class representing a category. */ void onRegistration(ServiceRegistry registry, Class category); - + /** - * This method is called when the object which implements this - * interface is deregistered to the specified category of the - * specified registry. + * This method is called when the object which implements this interface is + * deregistered to the specified category of the specified registry. * - * @param registry the ServiceRegistry to be registered. - * @param category the class representing a category. + * @param registry + * the ServiceRegistry to be registered. + * @param category + * the class representing a category. */ void onDeregistration(ServiceRegistry registry, Class category); } diff --git a/awt/javax/imageio/spi/ServiceRegistry.java b/awt/javax/imageio/spi/ServiceRegistry.java index 1a18b021e4bb0..79b02a36644dd 100644 --- a/awt/javax/imageio/spi/ServiceRegistry.java +++ b/awt/javax/imageio/spi/ServiceRegistry.java @@ -18,48 +18,53 @@ * @author Rustem V. Rafikov * @version $Revision: 1.3 $ */ + package javax.imageio.spi; import java.util.*; import java.util.Map.Entry; /** - * The ServiceRegistry class provides ability to register, - * deregister, look up and obtain service provider instances (SPIs). - * A service means a set of interfaces and classes, and a service - * provider is an implementation of a service. Service providers can - * be associated with one or more categories. Each category is defined - * by a class or interface. Only a single instance of a each class is - * allowed to be registered as a category. + * The ServiceRegistry class provides ability to register, deregister, look up + * and obtain service provider instances (SPIs). A service means a set of + * interfaces and classes, and a service provider is an implementation of a + * service. Service providers can be associated with one or more categories. + * Each category is defined by a class or interface. Only a single instance of a + * each class is allowed to be registered as a category. + * + * @since Android 1.0 */ public class ServiceRegistry { - /** The categories. */ + /** + * The categories. + */ CategoriesMap categories = new CategoriesMap(this); /** * Instantiates a new ServiceRegistry with the specified categories. * - * @param categoriesIterator an Iterator of Class objects - * for defining of categories. + * @param categoriesIterator + * an Iterator of Class objects for defining of categories. */ public ServiceRegistry(Iterator> categoriesIterator) { if (null == categoriesIterator) { throw new IllegalArgumentException("categories iterator should not be NULL"); } - while(categoriesIterator.hasNext()) { - Class c = categoriesIterator.next(); + while (categoriesIterator.hasNext()) { + Class c = categoriesIterator.next(); categories.addCategory(c); } } /** - * Looks up and instantiates the available providers of this service using + * Looks up and instantiates the available providers of this service using * the specified class loader. * - * @param providerClass the Class object of the provider to be looked up. - * @param loader the class loader to be used. - * + * @param providerClass + * the Class object of the provider to be looked up. + * @param loader + * the class loader to be used. * @return the iterator of providers objects for this service. */ public static Iterator lookupProviders(Class providerClass, ClassLoader loader) { @@ -67,11 +72,11 @@ public class ServiceRegistry { } /** - * Looks up and instantiates the available providers of this service using + * Looks up and instantiates the available providers of this service using * the context class loader. * - * @param providerClass the Class object of the provider to be looked up. - * + * @param providerClass + * the Class object of the provider to be looked up. * @return the iterator of providers objects for this service. */ public static Iterator lookupProviders(Class providerClass) { @@ -79,14 +84,15 @@ public class ServiceRegistry { } /** - * Registers the specified service provider object in the - * specified categories. - * - * @param provider the specified provider to be registered. - * @param category the category. + * Registers the specified service provider object in the specified + * categories. * - * @return true if no provider of the same class is registered - * in this category, false otherwise. + * @param provider + * the specified provider to be registered. + * @param category + * the category. + * @return true, if no provider of the same class is registered in this + * category, false otherwise. */ public boolean registerServiceProvider(T provider, Class category) { return categories.addProvider(provider, category); @@ -95,7 +101,8 @@ public class ServiceRegistry { /** * Registers a list of service providers. * - * @param providers the list of service providers. + * @param providers + * the list of service providers. */ public void registerServiceProviders(Iterator providers) { for (Iterator iterator = providers; iterator.hasNext();) { @@ -104,67 +111,70 @@ public class ServiceRegistry { } /** - * Registers the specified service provider object in all - * categories. + * Registers the specified service provider object in all categories. * - * @param provider the service provider. + * @param provider + * the service provider. */ public void registerServiceProvider(Object provider) { categories.addProvider(provider, null); } /** - * Deregisters the specifies service provider from the - * specified category. + * Deregisters the specifies service provider from the specified category. * - * @param provider the service provider to be deregistered. - * @param category the specified category. - * - * @return true if the provider was already registered - * in the specified category, false otherwise. + * @param provider + * the service provider to be deregistered. + * @param category + * the specified category. + * @return true, if the provider was already registered in the specified + * category, false otherwise. */ public boolean deregisterServiceProvider(T provider, Class category) { throw new UnsupportedOperationException("Not supported yet"); } /** - * Deregisters the specified service provider from all - * categories. + * Deregisters the specified service provider from all categories. * - * @param provider the specified service provider. + * @param provider + * the specified service provider. */ public void deregisterServiceProvider(Object provider) { throw new UnsupportedOperationException("Not supported yet"); } /** - * Gets an Iterator of registered service providers - * in the specified category which satisfy the specified Filter. - * The useOrdering parameter indicates whether the iterator will - * return all of the server provider objects in a set order. - * - * @param category the specified category. - * @param filter the specified filter. - * @param useOrdering the flag indicating that providers are ordered - * in the returned Iterator. + * Gets an Iterator of registered service providers in the specified + * category which satisfy the specified Filter. The useOrdering parameter + * indicates whether the iterator will return all of the server provider + * objects in a set order. * + * @param category + * the specified category. + * @param filter + * the specified filter. + * @param useOrdering + * the flag indicating that providers are ordered in the returned + * Iterator. * @return the iterator of registered service providers. */ @SuppressWarnings("unchecked") public Iterator getServiceProviders(Class category, Filter filter, boolean useOrdering) { - return new FilteredIterator(filter, (Iterator)categories.getProviders(category, useOrdering)); + return new FilteredIterator(filter, (Iterator)categories.getProviders(category, + useOrdering)); } /** - * Gets an Iterator of all registered service providers - * in the specified category. The useOrdering parameter - * indicates whether the iterator will return all of the server - * provider objects in a set order. - * - * @param category the specified category. - * @param useOrdering the flag indicating that providers are ordered - * in the returned Iterator. + * Gets an Iterator of all registered service providers in the specified + * category. The useOrdering parameter indicates whether the iterator will + * return all of the server provider objects in a set order. * + * @param category + * the specified category. + * @param useOrdering + * the flag indicating that providers are ordered in the returned + * Iterator. * @return the Iterator of service providers. */ @SuppressWarnings("unchecked") @@ -173,11 +183,11 @@ public class ServiceRegistry { } /** - * Gets the registered service provider object that has the - * specified class type. - * - * @param providerClass the specified provider class. + * Gets the registered service provider object that has the specified class + * type. * + * @param providerClass + * the specified provider class. * @return the service provider object. */ public T getServiceProviderByClass(Class providerClass) { @@ -185,28 +195,32 @@ public class ServiceRegistry { } /** - * Sets an ordering between two service provider objects - * within the specified category. - * - * @param category the specified category. - * @param firstProvider the first provider. - * @param secondProvider the second provider. + * Sets an ordering between two service provider objects within the + * specified category. * - * @return true if a previously unset order was set. + * @param category + * the specified category. + * @param firstProvider + * the first provider. + * @param secondProvider + * the second provider. + * @return true, if a previously unset order was set. */ public boolean setOrdering(Class category, T firstProvider, T secondProvider) { throw new UnsupportedOperationException("Not supported yet"); } /** - * Unsets an ordering between two service provider objects - * within the specified category. - * - * @param category the specified category. - * @param firstProvider the first provider. - * @param secondProvider the second provider. + * Unsets an ordering between two service provider objects within the + * specified category. * - * @return true if a previously unset order was removed. + * @param category + * the specified category. + * @param firstProvider + * the first provider. + * @param secondProvider + * the second provider. + * @return true, if a previously unset order was removed. */ public boolean unsetOrdering(Class category, T firstProvider, T secondProvider) { throw new UnsupportedOperationException("Not supported yet"); @@ -215,7 +229,8 @@ public class ServiceRegistry { /** * Deregisters all providers from the specified category. * - * @param category the specified category. + * @param category + * the specified category. */ public void deregisterAll(Class category) { throw new UnsupportedOperationException("Not supported yet"); @@ -229,32 +244,31 @@ public class ServiceRegistry { } /** - * Finalizes this object. + * Finalizes this object. * - * @throws Throwable throws if an error occurs during - * finalization. + * @throws Throwable + * if an error occurs during finalization. */ @Override public void finalize() throws Throwable { - //TODO uncomment when deregisterAll is implemented - //deregisterAll(); + // TODO uncomment when deregisterAll is implemented + // deregisterAll(); } /** * Checks whether the specified provider has been already registered. * - * @param provider the provider to be checked. - * + * @param provider + * the provider to be checked. * @return true, if the specified provider has been already registered, - * false otherwise. + * false otherwise. */ public boolean contains(Object provider) { throw new UnsupportedOperationException("Not supported yet"); } /** - * Gets an iterator of Class objects representing the current - * categories. + * Gets an iterator of Class objects representing the current categories. * * @return the Iterator of Class objects. */ @@ -263,20 +277,22 @@ public class ServiceRegistry { } /** - * The ServiceRegistry.Filter interface is used by - * ServiceRegistry.getServiceProviders to filter providers according - * to the specified criterion. + * The ServiceRegistry.Filter interface is used by + * ServiceRegistry.getServiceProviders to filter providers according to the + * specified criterion. + * + * @since Android 1.0 */ public static interface Filter { - + /** - * Returns true if the specified provider satisfies the - * criterion of this Filter. + * Returns true if the specified provider satisfies the criterion of + * this Filter. * - * @param provider the provider. - * - * @return true if the specified provider satisfies the - * criterion of this Filter, false otherwise. + * @param provider + * the provider. + * @return true, if the specified provider satisfies the criterion of + * this Filter, false otherwise. */ boolean filter(Object provider); } @@ -285,30 +301,36 @@ public class ServiceRegistry { * The Class CategoriesMap. */ private static class CategoriesMap { - - /** The categories. */ + + /** + * The categories. + */ Map, ProvidersMap> categories = new HashMap, ProvidersMap>(); - /** The registry. */ + /** + * The registry. + */ ServiceRegistry registry; /** * Instantiates a new categories map. * - * @param registry the registry + * @param registry + * the registry. */ public CategoriesMap(ServiceRegistry registry) { this.registry = registry; } - //-- TODO: useOrdering + // -- TODO: useOrdering /** * Gets the providers. * - * @param category the category - * @param useOrdering the use ordering - * - * @return the providers + * @param category + * the category. + * @param useOrdering + * the use ordering. + * @return the providers. */ Iterator getProviders(Class category, boolean useOrdering) { ProvidersMap providers = categories.get(category); @@ -321,7 +343,7 @@ public class ServiceRegistry { /** * List. * - * @return the iterator< class> + * @return the iterator< class>. */ Iterator> list() { return categories.keySet().iterator(); @@ -330,7 +352,8 @@ public class ServiceRegistry { /** * Adds the category. * - * @param category the category + * @param category + * the category. */ void addCategory(Class category) { categories.put(category, new ProvidersMap()); @@ -341,10 +364,11 @@ public class ServiceRegistry { * null then the provider will be added to all categories * which the provider is assignable from. * - * @param provider provider to add - * @param category category to add provider to - * - * @return if there were such provider in some category + * @param provider + * provider to add. + * @param category + * category to add provider to. + * @return true, if there were such provider in some category. */ boolean addProvider(Object provider, Class category) { if (provider == null) { @@ -355,11 +379,11 @@ public class ServiceRegistry { if (category == null) { rt = findAndAdd(provider); } else { - rt = addToNamed(provider, category); + rt = addToNamed(provider, category); } if (provider instanceof RegisterableService) { - ((RegisterableService) provider).onRegistration(registry, category); + ((RegisterableService)provider).onRegistration(registry, category); } return rt; @@ -368,10 +392,11 @@ public class ServiceRegistry { /** * Adds the to named. * - * @param provider the provider - * @param category the category - * - * @return true, if successful + * @param provider + * the provider. + * @param category + * the category. + * @return true, if successful. */ private boolean addToNamed(Object provider, Class category) { Object obj = categories.get(category); @@ -380,15 +405,15 @@ public class ServiceRegistry { throw new IllegalArgumentException("Unknown category: " + category); } - return ((ProvidersMap) obj).addProvider(provider); + return ((ProvidersMap)obj).addProvider(provider); } /** * Find and add. * - * @param provider the provider - * - * @return true, if successful + * @param provider + * the provider. + * @return true, if successful. */ private boolean findAndAdd(Object provider) { boolean rt = false; @@ -405,17 +430,19 @@ public class ServiceRegistry { * The Class ProvidersMap. */ private static class ProvidersMap { - //-- TODO: providers ordering support + // -- TODO: providers ordering support - /** The providers. */ + /** + * The providers. + */ Map, Object> providers = new HashMap, Object>(); /** * Adds the provider. * - * @param provider the provider - * - * @return true, if successful + * @param provider + * the provider. + * @return true, if successful. */ boolean addProvider(Object provider) { return providers.put(provider.getClass(), provider) != null; @@ -424,19 +451,19 @@ public class ServiceRegistry { /** * Gets the provider classes. * - * @return the provider classes + * @return the provider classes. */ Iterator> getProviderClasses() { return providers.keySet().iterator(); } - //-- TODO ordering + // -- TODO ordering /** * Gets the providers. * - * @param userOrdering the user ordering - * - * @return the providers + * @param userOrdering + * the user ordering. + * @return the providers. */ Iterator getProviders(boolean userOrdering) { return providers.values().iterator(); @@ -448,20 +475,28 @@ public class ServiceRegistry { */ private static class FilteredIterator implements Iterator { - /** The filter. */ + /** + * The filter. + */ private Filter filter; - - /** The backend. */ + + /** + * The backend. + */ private Iterator backend; - - /** The next obj. */ + + /** + * The next obj. + */ private E nextObj; /** * Instantiates a new filtered iterator. * - * @param filter the filter - * @param backend the backend + * @param filter + * the filter. + * @param backend + * the backend. */ public FilteredIterator(Filter filter, Iterator backend) { this.filter = filter; @@ -472,7 +507,7 @@ public class ServiceRegistry { /** * Next. * - * @return the e + * @return the e. */ public E next() { if (nextObj == null) { @@ -486,7 +521,7 @@ public class ServiceRegistry { /** * Checks for next. * - * @return true, if successful + * @return true, if successful. */ public boolean hasNext() { return nextObj != null; @@ -500,7 +535,8 @@ public class ServiceRegistry { } /** - * Sets nextObj to a next provider matching the criterion given by the filter. + * Sets nextObj to a next provider matching the criterion given by the + * filter. */ private void findNext() { nextObj = null; diff --git a/awt/javax/imageio/spi/package.html b/awt/javax/imageio/spi/package.html new file mode 100644 index 0000000000000..18ceff4860eab --- /dev/null +++ b/awt/javax/imageio/spi/package.html @@ -0,0 +1,8 @@ + + +

    + This package provides several Service Provider Interface (SPI) classes for readers, writers, transcoders and streams to handle images. +

    + @since Android 1.0 + + diff --git a/awt/javax/imageio/stream/FileCacheImageInputStream.java b/awt/javax/imageio/stream/FileCacheImageInputStream.java index 47bc1894cd813..710ac6660e762 100644 --- a/awt/javax/imageio/stream/FileCacheImageInputStream.java +++ b/awt/javax/imageio/stream/FileCacheImageInputStream.java @@ -15,38 +15,43 @@ * limitations under the License. */ - package javax.imageio.stream; import java.io.*; /** - * The FileCacheImageInputStream class is an implementation of - * ImageInputStream which reads from its InputStream - * and uses a temporary file as a cache. + * The FileCacheImageInputStream class is an implementation of ImageInputStream + * which reads from its InputStream and uses a temporary file as a cache. + * + * @since Android 1.0 */ public class FileCacheImageInputStream extends ImageInputStreamImpl { - - /** The is. */ + + /** + * The is. + */ private InputStream is; - - /** The file. */ + + /** + * The file. + */ private File file; - - /** The raf. */ - private RandomAccessFile raf; + /** + * The raf. + */ + private RandomAccessFile raf; /** - * Instantiates a new FileCacheImageInputStream from - * the specified InputStream and using the specified - * File as its cache directory. - * - * @param stream the InputStream for reading. - * @param cacheDir the cache directory where the chache file - * will be created. + * Instantiates a new FileCacheImageInputStream from the specified + * InputStream and using the specified File as its cache directory. * - * @throws IOException Signals that an I/O exception has occurred. + * @param stream + * the InputStream for reading. + * @param cacheDir + * the cache directory where the cache file will be created. + * @throws IOException + * if an I/O exception has occurred. */ public FileCacheImageInputStream(InputStream stream, File cacheDir) throws IOException { if (stream == null) { @@ -55,7 +60,8 @@ public class FileCacheImageInputStream extends ImageInputStreamImpl { is = stream; if (cacheDir == null || cacheDir.isDirectory()) { - file = File.createTempFile(FileCacheImageOutputStream.IIO_TEMP_FILE_PREFIX, null, cacheDir); + file = File.createTempFile(FileCacheImageOutputStream.IIO_TEMP_FILE_PREFIX, null, + cacheDir); file.deleteOnExit(); } else { throw new IllegalArgumentException("Not a directory!"); diff --git a/awt/javax/imageio/stream/FileCacheImageOutputStream.java b/awt/javax/imageio/stream/FileCacheImageOutputStream.java index ae485854b3d84..135afab3733e8 100644 --- a/awt/javax/imageio/stream/FileCacheImageOutputStream.java +++ b/awt/javax/imageio/stream/FileCacheImageOutputStream.java @@ -15,7 +15,6 @@ * limitations under the License. */ - package javax.imageio.stream; import java.io.IOException; @@ -24,35 +23,48 @@ import java.io.OutputStream; import java.io.RandomAccessFile; /** - * The FileCacheImageOutputStream class is an implementation of - * ImageOutputStream that writes to its OutputStream - * using a temporary file as a cache. + * The FileCacheImageOutputStream class is an implementation of + * ImageOutputStream that writes to its OutputStream using a temporary file as a + * cache. + * + * @since Android 1.0 */ public class FileCacheImageOutputStream extends ImageOutputStreamImpl { - - /** The Constant IIO_TEMP_FILE_PREFIX. */ + + /** + * The Constant IIO_TEMP_FILE_PREFIX. + */ static final String IIO_TEMP_FILE_PREFIX = "iioCache"; - - /** The Constant MAX_BUFFER_LEN. */ + + /** + * The Constant MAX_BUFFER_LEN. + */ static final int MAX_BUFFER_LEN = 1048575; // 1 MB - is it not too much? - /** The os. */ + /** + * The os. + */ private OutputStream os; - - /** The file. */ + + /** + * The file. + */ private File file; - - /** The raf. */ + + /** + * The raf. + */ private RandomAccessFile raf; /** * Instantiates a FileCacheImageOutputStream. * - * @param stream the OutputStream for writing. - * @param cacheDir the cache directory where the chache file - * will be created. - * - * @throws IOException Signals that an I/O exception has occurred. + * @param stream + * the OutputStream for writing. + * @param cacheDir + * the cache directory where the cache file will be created. + * @throws IOException + * if an I/O exception has occurred. */ public FileCacheImageOutputStream(OutputStream stream, File cacheDir) throws IOException { if (stream == null) { @@ -96,7 +108,7 @@ public class FileCacheImageOutputStream extends ImageOutputStreamImpl { @Override public void write(int b) throws IOException { flushBits(); // See the flushBits method description - + raf.write(b); streamPos++; } @@ -148,7 +160,7 @@ public class FileCacheImageOutputStream extends ImageOutputStreamImpl { } else { byte buffer[] = new byte[MAX_BUFFER_LEN]; while (bytesToRead > 0) { - int count = (int) Math.min(MAX_BUFFER_LEN, bytesToRead); + int count = (int)Math.min(MAX_BUFFER_LEN, bytesToRead); raf.readFully(buffer, 0, count); os.write(buffer, 0, count); bytesToRead -= count; @@ -169,7 +181,7 @@ public class FileCacheImageOutputStream extends ImageOutputStreamImpl { } raf.seek(pos); - streamPos = raf.getFilePointer(); + streamPos = raf.getFilePointer(); bitOffset = 0; } @@ -177,7 +189,7 @@ public class FileCacheImageOutputStream extends ImageOutputStreamImpl { public long length() { try { return raf.length(); - } catch(IOException e) { + } catch (IOException e) { return -1L; } } diff --git a/awt/javax/imageio/stream/FileImageInputStream.java b/awt/javax/imageio/stream/FileImageInputStream.java index 6680ae0a9738c..b9b6002b321da 100644 --- a/awt/javax/imageio/stream/FileImageInputStream.java +++ b/awt/javax/imageio/stream/FileImageInputStream.java @@ -15,7 +15,6 @@ * limitations under the License. */ - package javax.imageio.stream; import java.io.IOException; @@ -24,24 +23,31 @@ import java.io.File; import java.io.FileNotFoundException; /** - * The FileImageInputStream class implements ImageInputStream - * and obtains its input data from a File or RandomAccessFile. + * The FileImageInputStream class implements ImageInputStream and obtains its + * input data from a File or RandomAccessFile. + * + * @since Android 1.0 */ public class FileImageInputStream extends ImageInputStreamImpl { - - /** The raf. */ + + /** + * The raf. + */ RandomAccessFile raf; /** * Instantiates a new FileImageInputStream from the specified File. * - * @param f the File of input data. - * - * @throws FileNotFoundException if the specified file - * doesn't exist. - * @throws IOException Signals that an I/O exception has occurred. + * @param f + * the File of input data. + * @throws FileNotFoundException + * if the specified file doesn't exist. + * @throws IOException + * if an I/O exception has occurred. */ - @SuppressWarnings({"DuplicateThrows"}) + @SuppressWarnings( { + "DuplicateThrows" + }) public FileImageInputStream(File f) throws FileNotFoundException, IOException { if (f == null) { throw new IllegalArgumentException("f == null!"); @@ -51,10 +57,11 @@ public class FileImageInputStream extends ImageInputStreamImpl { } /** - * Instantiates a new FileImageInputStream from the specified + * Instantiates a new FileImageInputStream from the specified * RandomAccessFile. * - * @param raf the RandomAccessFile of input data. + * @param raf + * the RandomAccessFile of input data. */ public FileImageInputStream(RandomAccessFile raf) { if (raf == null) { @@ -91,7 +98,7 @@ public class FileImageInputStream extends ImageInputStreamImpl { public long length() { try { return raf.length(); - } catch(IOException e) { + } catch (IOException e) { return -1L; } } diff --git a/awt/javax/imageio/stream/FileImageOutputStream.java b/awt/javax/imageio/stream/FileImageOutputStream.java index eaafe14e3db06..2730ba6a971d5 100644 --- a/awt/javax/imageio/stream/FileImageOutputStream.java +++ b/awt/javax/imageio/stream/FileImageOutputStream.java @@ -18,39 +18,44 @@ * @author Rustem V. Rafikov * @version $Revision: 1.3 $ */ + package javax.imageio.stream; import java.io.*; /** - * The FileImageOutputStream class implements ImageOutputStream - * and writes the output data to a File or RandomAccessFile. + * The FileImageOutputStream class implements ImageOutputStream and writes the + * output data to a File or RandomAccessFile. + * + * @since Android 1.0 */ public class FileImageOutputStream extends ImageOutputStreamImpl { - /** The file. */ + /** + * The file. + */ RandomAccessFile file; /** - * Instantiates a new FileImageOutputStream with the specified - * File. - * - * @param f the output File. + * Instantiates a new FileImageOutputStream with the specified File. * - * @throws FileNotFoundException if the file not found. - * @throws IOException Signals that an I/O exception has occurred. + * @param f + * the output File. + * @throws FileNotFoundException + * if the file not found. + * @throws IOException + * if an I/O exception has occurred. */ public FileImageOutputStream(File f) throws FileNotFoundException, IOException { - this(f != null - ? new RandomAccessFile(f, "rw") - : null); + this(f != null ? new RandomAccessFile(f, "rw") : null); } /** * Instantiates a new FileImageOutputStream with the specified * RandomAccessFile. * - * @param raf the output RandomAccessFile. + * @param raf + * the output RandomAccessFile. */ public FileImageOutputStream(RandomAccessFile raf) { if (raf == null) { @@ -102,14 +107,14 @@ public class FileImageOutputStream extends ImageOutputStreamImpl { try { checkClosed(); return file.length(); - } catch(IOException e) { + } catch (IOException e) { return super.length(); // -1L } } @Override public void seek(long pos) throws IOException { - //-- checkClosed() is performed in super.seek() + // -- checkClosed() is performed in super.seek() super.seek(pos); file.seek(pos); streamPos = file.getFilePointer(); diff --git a/awt/javax/imageio/stream/IIOByteBuffer.java b/awt/javax/imageio/stream/IIOByteBuffer.java index 961a7b3ec7c02..867d80843d831 100644 --- a/awt/javax/imageio/stream/IIOByteBuffer.java +++ b/awt/javax/imageio/stream/IIOByteBuffer.java @@ -18,35 +18,46 @@ * @author Sergey I. Salishev * @version $Revision: 1.2 $ */ + package javax.imageio.stream; -/** -* @author Sergey I. Salishev -* @version $Revision: 1.2 $ -*/ +// +// @author Sergey I. Salishev +// @version $Revision: 1.2 $ +// /** - * The IIOByteBuffer class represents a byte array with offset and - * length that is used by ImageInputStream for obtaining a sequence - * of bytes. + * The IIOByteBuffer class represents a byte array with offset and length that + * is used by ImageInputStream for obtaining a sequence of bytes. + * + * @since Android 1.0 */ public class IIOByteBuffer { - - /** The data. */ + + /** + * The data. + */ private byte[] data; - - /** The offset. */ + + /** + * The offset. + */ private int offset; - - /** The length. */ + + /** + * The length. + */ private int length; /** * Instantiates a new IIOByteBuffer. * - * @param data the byte array. - * @param offset the offset in the array. - * @param length the length of array. + * @param data + * the byte array. + * @param offset + * the offset in the array. + * @param length + * the length of array. */ public IIOByteBuffer(byte[] data, int offset, int length) { this.data = data; @@ -84,7 +95,8 @@ public class IIOByteBuffer { /** * Sets the new data array to this IIOByteBuffer object. * - * @param data the new data array. + * @param data + * the new data array. */ public void setData(byte[] data) { this.data = data; @@ -93,7 +105,8 @@ public class IIOByteBuffer { /** * Sets the length of data which will be used. * - * @param length the new length. + * @param length + * the new length. */ public void setLength(int length) { this.length = length; @@ -102,10 +115,10 @@ public class IIOByteBuffer { /** * Sets the offset in the data array of this IIOByteBuffer. * - * @param offset the new offset. + * @param offset + * the new offset. */ public void setOffset(int offset) { this.offset = offset; } } - diff --git a/awt/javax/imageio/stream/ImageInputStream.java b/awt/javax/imageio/stream/ImageInputStream.java index 771e9ff96c47b..3dec5d2966911 100644 --- a/awt/javax/imageio/stream/ImageInputStream.java +++ b/awt/javax/imageio/stream/ImageInputStream.java @@ -18,6 +18,7 @@ * @author Rustem V. Rafikov * @version $Revision: 1.2 $ */ + package javax.imageio.stream; import java.io.DataInput; @@ -25,21 +26,24 @@ import java.io.IOException; import java.nio.ByteOrder; /** - * The ImageInputStream represents input stream interface that is - * used by ImageReaders. + * The ImageInputStream represents input stream interface that is used by + * ImageReaders. + * + * @since Android 1.0 */ public interface ImageInputStream extends DataInput { /** - * Sets the specified byte order for reading of data values - * from this stream. + * Sets the specified byte order for reading of data values from this + * stream. * - * @param byteOrder the byte order. + * @param byteOrder + * the byte order. */ void setByteOrder(ByteOrder byteOrder); /** - * Gets the byte order. + * Gets the byte order. * * @return the byte order. */ @@ -48,158 +52,151 @@ public interface ImageInputStream extends DataInput { /** * Reads a byte from the stream. * - * @return the byte of the stream, or -1 for EOF indicating. - * - * @throws IOException Signals that an I/O exception has occurred. + * @return the byte of the stream, or -1 for EOF indicating. + * @throws IOException + * if an I/O exception has occurred. */ int read() throws IOException; /** - * Reads number of bytes which is equal to the specified array's length - * and stores a result to this array. - * - * @param b the byte array. + * Reads number of bytes which is equal to the specified array's length and + * stores a result to this array. * + * @param b + * the byte array. * @return the number of read bytes, or -1 indicated EOF. - * - * @throws IOException Signals that an I/O exception has occurred. + * @throws IOException + * if an I/O exception has occurred. */ int read(byte[] b) throws IOException; /** - * Reads the number of bytes specified by len parameter from - * the stream and stores a result to the specified array - * with the specified offset. - * - * @param b the byte array. - * @param off the offset. - * @param len the number of bytes to be read. + * Reads the number of bytes specified by len parameter from the stream and + * stores a result to the specified array with the specified offset. * + * @param b + * the byte array. + * @param off + * the offset. + * @param len + * the number of bytes to be read. * @return the number of read bytes, or -1 indicated EOF. - * - * @throws IOException Signals that an I/O exception has occurred. + * @throws IOException + * if an I/O exception has occurred. */ int read(byte[] b, int off, int len) throws IOException; /** - * Reads the number of bytes specified by len parameter - * from the stream, and modifies the specified IIOByteBuffer - * with the byte array, offset, and length. - * - * @param buf the IIOByteBuffer. - * @param len the number of bytes to be read. + * Reads the number of bytes specified by len parameter from the stream, and + * modifies the specified IIOByteBuffer with the byte array, offset, and + * length. * - * @throws IOException Signals that an I/O exception has occurred. + * @param buf + * the IIOByteBuffer. + * @param len + * the number of bytes to be read. + * @throws IOException + * if an I/O exception has occurred. */ void readBytes(IIOByteBuffer buf, int len) throws IOException; /** - * Reads a byte from the stream and returns a boolean true value - * if it is non zero, false if it is zero. - * - * @return a boolean value for read byte. + * Reads a byte from the stream and returns a boolean true value if it is + * non zero, false if it is zero. * - * @throws IOException Signals that an I/O exception has occurred. + * @return the boolean value for read byte. + * @throws IOException + * if an I/O exception has occurred. */ boolean readBoolean() throws IOException; /** - * Reads a byte from the stream and returns its value - * as signed byte. + * Reads a byte from the stream and returns its value as signed byte. * - * @return a signed byte value for read byte. - * - * @throws IOException Signals that an I/O exception has occurred. + * @return the signed byte value for read byte. + * @throws IOException + * if an I/O exception has occurred. */ byte readByte() throws IOException; /** - * Reads a byte from the stream and returns its value - * as int. - * - * @return a unsigned byte value for read byte as int. + * Reads a byte from the stream and returns its value as an integer. * - * @throws IOException Signals that an I/O exception has occurred. + * @return the unsigned byte value for read byte as an integer. + * @throws IOException + * if an I/O exception has occurred. */ int readUnsignedByte() throws IOException; /** - * Reads 2 bytes from the stream, and returns the result - * as a short. + * Reads 2 bytes from the stream, and returns the result as a short. * * @return the signed short value from the stream. - * - * @throws IOException Signals that an I/O exception has occurred. + * @throws IOException + * if an I/O exception has occurred. */ short readShort() throws IOException; /** - * Reads 2 bytes from the stream and returns its value - * as an unsigned short. - * - * @return a unsigned short value coded in an int. + * Reads 2 bytes from the stream and returns its value as an unsigned short. * - * @throws IOException Signals that an I/O exception has occurred. + * @return a unsigned short value coded in an integer. + * @throws IOException + * if an I/O exception has occurred. */ int readUnsignedShort() throws IOException; /** - * Reads 2 bytes from the stream and returns their - * unsigned char value. + * Reads 2 bytes from the stream and returns their unsigned char value. * * @return the unsigned char value. - * - * @throws IOException Signals that an I/O exception has occurred. + * @throws IOException + * if an I/O exception has occurred. */ char readChar() throws IOException; /** - * Reads 4 bytes from the stream, and returns the result - * as an int. + * Reads 4 bytes from the stream, and returns the result as an integer. * - * @return the signed int value from the stream. - * - * @throws IOException Signals that an I/O exception has occurred. + * @return the signed integer value from the stream. + * @throws IOException + * if an I/O exception has occurred. */ int readInt() throws IOException; /** - * Reads 4 bytes from the stream and returns its value - * as long. - * - * @return a unsigned int value as long. + * Reads 4 bytes from the stream and returns its value as long. * - * @throws IOException Signals that an I/O exception has occurred. + * @return the unsigned integer value as long. + * @throws IOException + * if an I/O exception has occurred. */ long readUnsignedInt() throws IOException; /** - * Reads 8 bytes from the stream, and returns the result - * as a long. + * Reads 8 bytes from the stream, and returns the result as a long. * * @return the long value from the stream. - * - * @throws IOException Signals that an I/O exception has occurred. + * @throws IOException + * if an I/O exception has occurred. */ long readLong() throws IOException; /** - * Reads 4 bytes from the stream, and returns the result - * as a float. + * Reads 4 bytes from the stream, and returns the result as a float. * * @return the float value from the stream. - * - * @throws IOException Signals that an I/O exception has occurred. + * @throws IOException + * if an I/O exception has occurred. */ float readFloat() throws IOException; /** - * Reads 8 bytes from the stream, and returns the result - * as a double. + * Reads 8 bytes from the stream, and returns the result as a double. * * @return the double value from the stream. - * - * @throws IOException Signals that an I/O exception has occurred. + * @throws IOException + * if an I/O exception has occurred. */ double readDouble() throws IOException; @@ -207,120 +204,134 @@ public interface ImageInputStream extends DataInput { * Reads a line from the stream. * * @return the string contained the line from the stream. - * - * @throws IOException Signals that an I/O exception has occurred. + * @throws IOException + * if an I/O exception has occurred. */ String readLine() throws IOException; /** - * Reads bytes from the stream in a string that has been encoded - * in a modified UTF-8 format. + * Reads bytes from the stream in a string that has been encoded in a + * modified UTF-8 format. * * @return the string read from stream and modified UTF-8 format. - * - * @throws IOException Signals that an I/O exception has occurred. + * @throws IOException + * if an I/O exception has occurred. */ String readUTF() throws IOException; /** - * Reads the specified number of bytes from the stream, - * and stores the result into the specified array starting at - * the specified index offset. + * Reads the specified number of bytes from the stream, and stores the + * result into the specified array starting at the specified index offset. * - * @param b the byte array. - * @param off the offset. - * @param len the number of bytes to be read. - * - * @throws IOException Signals that an I/O exception has occurred. + * @param b + * the byte array. + * @param off + * the offset. + * @param len + * the number of bytes to be read. + * @throws IOException + * if an I/O exception has occurred. */ void readFully(byte[] b, int off, int len) throws IOException; /** - * Reads number of bytes from the stream which is equal to - * the specified array's length, and stores them into - * this array. - * - * @param b the byte array. + * Reads number of bytes from the stream which is equal to the specified + * array's length, and stores them into this array. * - * @throws IOException Signals that an I/O exception has occurred. + * @param b + * the byte array. + * @throws IOException + * if an I/O exception has occurred. */ void readFully(byte[] b) throws IOException; /** - * Reads the specified number of shorts from the stream, - * and stores the result into the specified array starting at - * the specified index offset. - * - * @param s the short array. - * @param off the offset. - * @param len the number of shorts to be read. + * Reads the specified number of shorts from the stream, and stores the + * result into the specified array starting at the specified index offset. * - * @throws IOException Signals that an I/O exception has occurred. + * @param s + * the short array. + * @param off + * the offset. + * @param len + * the number of shorts to be read. + * @throws IOException + * if an I/O exception has occurred. */ void readFully(short[] s, int off, int len) throws IOException; /** - * Reads the specified number of chars from the stream, - * and stores the result into the specified array starting at - * the specified index offset. + * Reads the specified number of chars from the stream, and stores the + * result into the specified array starting at the specified index offset. * - * @param c the char array. - * @param off the offset. - * @param len the number of chars to be read. - * - * @throws IOException Signals that an I/O exception has occurred. + * @param c + * the char array. + * @param off + * the offset. + * @param len + * the number of chars to be read. + * @throws IOException + * if an I/O exception has occurred. */ void readFully(char[] c, int off, int len) throws IOException; /** - * Reads the specified number of ints from the stream, - * and stores the result into the specified array starting at - * the specified index offset. - * - * @param i the int array. - * @param off the offset. - * @param len the number of ints to be read. + * Reads the specified number of integer from the stream, and stores the + * result into the specified array starting at the specified index offset. * - * @throws IOException Signals that an I/O exception has occurred. + * @param i + * the integer array. + * @param off + * the offset. + * @param len + * the number of integer to be read. + * @throws IOException + * if an I/O exception has occurred. */ void readFully(int[] i, int off, int len) throws IOException; /** - * Reads the specified number of longs from the stream, - * and stores the result into the specified array starting at - * the specified index offset. + * Reads the specified number of longs from the stream, and stores the + * result into the specified array starting at the specified index offset. * - * @param l the long array. - * @param off the offset. - * @param len the number of longs to be read. - * - * @throws IOException Signals that an I/O exception has occurred. + * @param l + * the long array. + * @param off + * the offset. + * @param len + * the number of longs to be read. + * @throws IOException + * if an I/O exception has occurred. */ void readFully(long[] l, int off, int len) throws IOException; /** - * Reads the specified number of floats from the stream, - * and stores the result into the specified array starting at - * the specified index offset. - * - * @param f the float array. - * @param off the offset. - * @param len the number of floats to be read. + * Reads the specified number of floats from the stream, and stores the + * result into the specified array starting at the specified index offset. * - * @throws IOException Signals that an I/O exception has occurred. + * @param f + * the float array. + * @param off + * the offset. + * @param len + * the number of floats to be read. + * @throws IOException + * if an I/O exception has occurred. */ void readFully(float[] f, int off, int len) throws IOException; /** - * Reads the specified number of doubles from the stream, - * and stores the result into the specified array starting at - * the specified index offset. - * - * @param d the double array. - * @param off the offset. - * @param len the number of doubles to be read. + * Reads the specified number of doubles from the stream, and stores the + * result into the specified array starting at the specified index offset. * - * @throws IOException Signals that an I/O exception has occurred. + * @param d + * the double array. + * @param off + * the offset. + * @param len + * the number of doubles to be read. + * @throws IOException + * if an I/O exception has occurred. */ void readFully(double[] d, int off, int len) throws IOException; @@ -328,8 +339,8 @@ public interface ImageInputStream extends DataInput { * Gets the stream position. * * @return the stream position. - * - * @throws IOException Signals that an I/O exception has occurred. + * @throws IOException + * if an I/O exception has occurred. */ long getStreamPosition() throws IOException; @@ -337,17 +348,18 @@ public interface ImageInputStream extends DataInput { * Gets the bit offset. * * @return the bit offset. - * - * @throws IOException Signals that an I/O exception has occurred. + * @throws IOException + * if an I/O exception has occurred. */ int getBitOffset() throws IOException; /** - * Sets the bit offset to an integer between 0 and 7. + * Sets the bit offset to an integer between 0 and 7. * - * @param bitOffset the bit offset. - * - * @throws IOException Signals that an I/O exception has occurred. + * @param bitOffset + * the bit offset. + * @throws IOException + * if an I/O exception has occurred. */ void setBitOffset(int bitOffset) throws IOException; @@ -355,90 +367,94 @@ public interface ImageInputStream extends DataInput { * Reads a bit from the stream and returns the value 0 or 1. * * @return the value of single bit: 0 or 1. - * - * @throws IOException Signals that an I/O exception has occurred. + * @throws IOException + * if an I/O exception has occurred. */ int readBit() throws IOException; /** * Read the specified number of bits and returns their values as long. * - * @param numBits the number of bits to be read. - * + * @param numBits + * the number of bits to be read. * @return the bit string as a long. - * - * @throws IOException Signals that an I/O exception has occurred. + * @throws IOException + * if an I/O exception has occurred. */ long readBits(int numBits) throws IOException; /** - * Returns the length of the stream. - * - * @return the length of the stream, or -1 if unknown. + * Returns the length of the stream. * - * @throws IOException Signals that an I/O exception has occurred. + * @return the length of the stream, or -1 if unknown. + * @throws IOException + * if an I/O exception has occurred. */ long length() throws IOException; /** - * Skipes the specified number of bytes by moving stream position. - * - * @param n the number of bytes. + * Skips the specified number of bytes by moving stream position. * + * @param n + * the number of bytes. * @return the actual skipped number of bytes. - * - * @throws IOException Signals that an I/O exception has occurred. + * @throws IOException + * if an I/O exception has occurred. */ int skipBytes(int n) throws IOException; /** - * Skipes the specified number of bytes by moving stream position. - * - * @param n the number of bytes. + * Skips the specified number of bytes by moving stream position. * + * @param n + * the number of bytes. * @return the actual skipped number of bytes. - * - * @throws IOException Signals that an I/O exception has occurred. + * @throws IOException + * if an I/O exception has occurred. */ long skipBytes(long n) throws IOException; /** - * Sets the current stream position to the specified location. + * Sets the current stream position to the specified location. * - * @param pos a file pointer position. - * - * @throws IOException Signals that an I/O exception has occurred. + * @param pos + * a file pointer position. + * @throws IOException + * if an I/O exception has occurred. */ void seek(long pos) throws IOException; /** - * Marks a position in the stream to be returned to by a subsequent - * call to reset. + * Marks a position in the stream to be returned to by a subsequent call to + * reset. */ void mark(); /** * Returns the file pointer to its previous position. * - * @throws IOException Signals that an I/O exception has occurred. + * @throws IOException + * if an I/O exception has occurred. */ void reset() throws IOException; /** - * Flushes the initial position in this stream prior to the - * specified stream position. - * - * @param pos the position. + * Flushes the initial position in this stream prior to the specified stream + * position. * - * @throws IOException Signals that an I/O exception has occurred. + * @param pos + * the position. + * @throws IOException + * if an I/O exception has occurred. */ void flushBefore(long pos) throws IOException; /** - * Flushes the initial position in this stream prior to the - * current stream position. + * Flushes the initial position in this stream prior to the current stream + * position. * - * @throws IOException Signals that an I/O exception has occurred. + * @throws IOException + * if an I/O exception has occurred. */ void flush() throws IOException; @@ -450,36 +466,37 @@ public interface ImageInputStream extends DataInput { long getFlushedPosition(); /** - * Returns true if this ImageInputStream caches data in order - * to allow seeking backwards. + * Returns true if this ImageInputStream caches data in order to allow + * seeking backwards. * - * @return true if this ImageInputStream caches data in order - * to allow seeking backwards, false otherwise. + * @return true, if this ImageInputStream caches data in order to allow + * seeking backwards, false otherwise. */ boolean isCached(); /** - * Returns true if this ImageInputStream caches data in order - * to allow seeking backwards, and keeps it in memory. + * Returns true if this ImageInputStream caches data in order to allow + * seeking backwards, and keeps it in memory. * - * @return true if this ImageInputStream caches data in order - * to allow seeking backwards, and keeps it in memory. + * @return true, if this ImageInputStream caches data in order to allow + * seeking backwards, and keeps it in memory. */ boolean isCachedMemory(); /** - * Returns true if this ImageInputStream caches data in order - * to allow seeking backwards, and keeps it in a temporary file. + * Returns true if this ImageInputStream caches data in order to allow + * seeking backwards, and keeps it in a temporary file. * - * @return true if this ImageInputStream caches data in order - * to allow seeking backwards, and keeps it in a temporary file. + * @return true, if this ImageInputStream caches data in order to allow + * seeking backwards, and keeps it in a temporary file. */ boolean isCachedFile(); /** * Closes this stream. * - * @throws IOException Signals that an I/O exception has occurred. + * @throws IOException + * if an I/O exception has occurred. */ void close() throws IOException; } diff --git a/awt/javax/imageio/stream/ImageInputStreamImpl.java b/awt/javax/imageio/stream/ImageInputStreamImpl.java index 83ac13a9c986d..d79da41859aa0 100644 --- a/awt/javax/imageio/stream/ImageInputStreamImpl.java +++ b/awt/javax/imageio/stream/ImageInputStreamImpl.java @@ -18,6 +18,7 @@ * @author Rustem V. Rafikov * @version $Revision: 1.3 $ */ + package javax.imageio.stream; import java.io.EOFException; @@ -25,38 +26,54 @@ import java.io.IOException; import java.nio.ByteOrder; /** - * The ImageInputStreamImpl abstract class implements - * the ImageInputStream interface. + * The ImageInputStreamImpl abstract class implements the ImageInputStream + * interface. + * + * @since Android 1.0 */ public abstract class ImageInputStreamImpl implements ImageInputStream { - /** The byte order. */ + /** + * The byte order. + */ protected ByteOrder byteOrder = ByteOrder.BIG_ENDIAN; - /** The stream position. */ + /** + * The stream position. + */ protected long streamPos = 0; - - /** The flushed position. */ + + /** + * The flushed position. + */ protected long flushedPos = 0; - - /** The bit offset. */ + + /** + * The bit offset. + */ protected int bitOffset = 0; - /** The closed. */ + /** + * The closed. + */ private boolean closed = false; - /** The position stack. */ + /** + * The position stack. + */ private final PositionStack posStack = new PositionStack(); /** * Instantiates a new ImageInputStreamImpl. */ - public ImageInputStreamImpl() {} + public ImageInputStreamImpl() { + } /** * Check if the stream is closed and if true, throws an IOException. * - * @throws IOException Signals that the stream is closed. + * @throws IOException + * if the stream is closed. */ protected final void checkClosed() throws IOException { if (closed) { @@ -106,7 +123,7 @@ public abstract class ImageInputStreamImpl implements ImageInputStream { if (b < 0) { throw new EOFException("EOF reached"); } - return (byte) b; + return (byte)b; } public int readUnsignedByte() throws IOException { @@ -125,58 +142,57 @@ public abstract class ImageInputStreamImpl implements ImageInputStream { throw new EOFException("EOF reached"); } - return byteOrder == ByteOrder.BIG_ENDIAN ? - (short) ((b1 << 8) | (b2 & 0xff)) : - (short) ((b2 << 8) | (b1 & 0xff)); + return byteOrder == ByteOrder.BIG_ENDIAN ? (short)((b1 << 8) | (b2 & 0xff)) + : (short)((b2 << 8) | (b1 & 0xff)); } public int readUnsignedShort() throws IOException { - //-- TODO implement + // -- TODO implement throw new UnsupportedOperationException("Not implemented yet"); } public char readChar() throws IOException { - //-- TODO implement + // -- TODO implement throw new UnsupportedOperationException("Not implemented yet"); } public int readInt() throws IOException { - //-- TODO implement + // -- TODO implement throw new UnsupportedOperationException("Not implemented yet"); } public long readUnsignedInt() throws IOException { - //-- TODO implement + // -- TODO implement throw new UnsupportedOperationException("Not implemented yet"); } public long readLong() throws IOException { - //-- TODO implement + // -- TODO implement throw new UnsupportedOperationException("Not implemented yet"); } public float readFloat() throws IOException { - //-- TODO implement + // -- TODO implement throw new UnsupportedOperationException("Not implemented yet"); } public double readDouble() throws IOException { - //-- TODO implement + // -- TODO implement throw new UnsupportedOperationException("Not implemented yet"); } public String readLine() throws IOException { - //-- TODO implement + // -- TODO implement throw new UnsupportedOperationException("Not implemented yet"); } public String readUTF() throws IOException { - //-- TODO implement + // -- TODO implement throw new UnsupportedOperationException("Not implemented yet"); } public void readFully(byte[] b, int off, int len) throws IOException { - //-- TODO implement + // -- TODO implement throw new UnsupportedOperationException("Not implemented yet"); } @@ -185,32 +201,32 @@ public abstract class ImageInputStreamImpl implements ImageInputStream { } public void readFully(short[] s, int off, int len) throws IOException { - //-- TODO implement + // -- TODO implement throw new UnsupportedOperationException("Not implemented yet"); } public void readFully(char[] c, int off, int len) throws IOException { - //-- TODO implement + // -- TODO implement throw new UnsupportedOperationException("Not implemented yet"); } public void readFully(int[] i, int off, int len) throws IOException { - //-- TODO implement + // -- TODO implement throw new UnsupportedOperationException("Not implemented yet"); } public void readFully(long[] l, int off, int len) throws IOException { - //-- TODO implement + // -- TODO implement throw new UnsupportedOperationException("Not implemented yet"); } public void readFully(float[] f, int off, int len) throws IOException { - //-- TODO implement + // -- TODO implement throw new UnsupportedOperationException("Not implemented yet"); } public void readFully(double[] d, int off, int len) throws IOException { - //-- TODO implement + // -- TODO implement throw new UnsupportedOperationException("Not implemented yet"); } @@ -230,12 +246,12 @@ public abstract class ImageInputStreamImpl implements ImageInputStream { } public int readBit() throws IOException { - //-- TODO implement + // -- TODO implement throw new UnsupportedOperationException("Not implemented yet"); } public long readBits(int numBits) throws IOException { - //-- TODO implement + // -- TODO implement throw new UnsupportedOperationException("Not implemented yet"); } @@ -244,12 +260,12 @@ public abstract class ImageInputStreamImpl implements ImageInputStream { } public int skipBytes(int n) throws IOException { - //-- TODO implement + // -- TODO implement throw new UnsupportedOperationException("Not implemented yet"); } public long skipBytes(long n) throws IOException { - //-- TODO implement + // -- TODO implement throw new UnsupportedOperationException("Not implemented yet"); } @@ -272,7 +288,7 @@ public abstract class ImageInputStreamImpl implements ImageInputStream { } public void reset() throws IOException { - //-- TODO bit pos + // -- TODO bit pos if (!posStack.isEmpty()) { long p = posStack.pop(); if (p < flushedPos) { @@ -290,7 +306,7 @@ public abstract class ImageInputStreamImpl implements ImageInputStream { throw new IndexOutOfBoundsException("Trying to flush within already flushed portion"); } flushedPos = pos; - //-- TODO implement + // -- TODO implement } public void flush() throws IOException { @@ -302,15 +318,15 @@ public abstract class ImageInputStreamImpl implements ImageInputStream { } public boolean isCached() { - return false; //def + return false; // def } public boolean isCachedMemory() { - return false; //def + return false; // def } public boolean isCachedFile() { - return false; //def + return false; // def } public void close() throws IOException { @@ -322,7 +338,8 @@ public abstract class ImageInputStreamImpl implements ImageInputStream { /** * Finalizes this object. * - * @throws Throwable if an error occurs. + * @throws Throwable + * if an error occurs. */ @Override protected void finalize() throws Throwable { @@ -339,25 +356,31 @@ public abstract class ImageInputStreamImpl implements ImageInputStream { * The Class PositionStack. */ private static class PositionStack { - - /** The Constant SIZE. */ + + /** + * The Constant SIZE. + */ private static final int SIZE = 10; - /** The values. */ + /** + * The values. + */ private long[] values = new long[SIZE]; - - /** The pos. */ - private int pos = 0; + /** + * The pos. + */ + private int pos = 0; /** * Push. * - * @param v the v + * @param v + * the v. */ void push(long v) { if (pos >= values.length) { - ensure(pos+1); + ensure(pos + 1); } values[pos++] = v; } @@ -365,7 +388,7 @@ public abstract class ImageInputStreamImpl implements ImageInputStream { /** * Pop. * - * @return the long + * @return the long. */ long pop() { return values[--pos]; @@ -374,7 +397,7 @@ public abstract class ImageInputStreamImpl implements ImageInputStream { /** * Checks if is empty. * - * @return true, if is empty + * @return true, if is empty. */ boolean isEmpty() { return pos == 0; @@ -383,7 +406,8 @@ public abstract class ImageInputStreamImpl implements ImageInputStream { /** * Ensure. * - * @param size the size + * @param size + * the size. */ private void ensure(int size) { long[] arr = new long[Math.max(2 * values.length, size)]; diff --git a/awt/javax/imageio/stream/ImageOutputStream.java b/awt/javax/imageio/stream/ImageOutputStream.java index e59b69da5234f..28ec93277a44e 100644 --- a/awt/javax/imageio/stream/ImageOutputStream.java +++ b/awt/javax/imageio/stream/ImageOutputStream.java @@ -18,252 +18,289 @@ * @author Rustem V. Rafikov * @version $Revision: 1.2 $ */ + package javax.imageio.stream; import java.io.DataOutput; import java.io.IOException; /** - * The ImageOutputStream represents output stream interface that is - * used by ImageWriters. + * The ImageOutputStream represents output stream interface that is used by + * ImageWriters. + * + * @since Android 1.0 */ public interface ImageOutputStream extends DataOutput, ImageInputStream { /** - * Writes a single byte to the stream at the current position. - * - * @param b the int value, of which the 8 lowest bits - * will be written. + * Writes a single byte to the stream at the current position. * - * @throws IOException Signals that an I/O exception has occurred. + * @param b + * the integer value, of which the 8 lowest bits will be written. + * @throws IOException + * if an I/O exception has occurred. */ void write(int b) throws IOException; /** * Writes the bytes array to the stream. * - * @param b the byte array to be written. - * - * @throws IOException Signals that an I/O exception has occurred. + * @param b + * the byte array to be written. + * @throws IOException + * if an I/O exception has occurred. */ void write(byte[] b) throws IOException; /** - * Writes a number of bytes from the specified byte array - * beggining from the specified offset. - * - * @param b the byte array. - * @param off the offset. - * @param len the number of bytes to be written. - * - * @throws IOException Signals that an I/O exception has occurred. + * Writes a number of bytes from the specified byte array beginning from the + * specified offset. + * + * @param b + * the byte array. + * @param off + * the offset. + * @param len + * the number of bytes to be written. + * @throws IOException + * if an I/O exception has occurred. */ void write(byte[] b, int off, int len) throws IOException; /** - * Writes the specified boolean value to the stream, 1 if it is true, - * 0 if it is false. - * - * @param b the boolean value to be written. + * Writes the specified boolean value to the stream, 1 if it is true, 0 if + * it is false. * - * @throws IOException Signals that an I/O exception has occurred. + * @param b + * the boolean value to be written. + * @throws IOException + * if an I/O exception has occurred. */ void writeBoolean(boolean b) throws IOException; /** - * Writes the 8 lowest bits of the specified int value to the stream. + * Writes the 8 lowest bits of the specified integer value to the stream. * - * @param b the specified int value. - * - * @throws IOException Signals that an I/O exception has occurred. + * @param b + * the specified integer value. + * @throws IOException + * if an I/O exception has occurred. */ void writeByte(int b) throws IOException; /** - * Writes a short value to the output stream. - * - * @param v the short value to be written. + * Writes a short value to the output stream. * - * @throws IOException Signals that an I/O exception has occurred. + * @param v + * the short value to be written. + * @throws IOException + * if an I/O exception has occurred. */ void writeShort(int v) throws IOException; /** - * Writes the 16 lowest bits of the specified int value to the stream. + * Writes the 16 lowest bits of the specified integer value to the stream. * - * @param v the specified int value. - * - * @throws IOException Signals that an I/O exception has occurred. + * @param v + * the specified integer value. + * @throws IOException + * if an I/O exception has occurred. */ void writeChar(int v) throws IOException; /** - * Writes an integer value to the output stream. - * - * @param v the integer value to be written. + * Writes an integer value to the output stream. * - * @throws IOException Signals that an I/O exception has occurred. + * @param v + * the integer value to be written. + * @throws IOException + * if an I/O exception has occurred. */ void writeInt(int v) throws IOException; /** * Write long. * - * @param v the long value - * - * @throws IOException Signals that an I/O exception has occurred. + * @param v + * the long value. + * @throws IOException + * if an I/O exception has occurred. */ void writeLong(long v) throws IOException; /** - * Writes a float value to the output stream. - * - * @param v the float which contains value to be written. + * Writes a float value to the output stream. * - * @throws IOException Signals that an I/O exception has occurred. + * @param v + * the float which contains value to be written. + * @throws IOException + * if an I/O exception has occurred. */ void writeFloat(float v) throws IOException; /** - * Writes a double value to the output stream. + * Writes a double value to the output stream. * - * @param v the double which contains value to be written. - * - * @throws IOException Signals that an I/O exception has occurred. + * @param v + * the double which contains value to be written. + * @throws IOException + * if an I/O exception has occurred. */ void writeDouble(double v) throws IOException; /** * Writes the specified string to the stream. * - * @param s the string to be written. - * - * @throws IOException Signals that an I/O exception has occurred. + * @param s + * the string to be written. + * @throws IOException + * if an I/O exception has occurred. */ void writeBytes(String s) throws IOException; /** * Writes the specified String to the output stream. * - * @param s the String to be written. - * - * @throws IOException Signals that an I/O exception has occurred. + * @param s + * the String to be written. + * @throws IOException + * if an I/O exception has occurred. */ void writeChars(String s) throws IOException; /** - * Writes 2 bytes to the output stream in - * the modified UTF-8 representation of every character of - * the specified string. - * - * @param s the specified string to be written. + * Writes 2 bytes to the output stream in the modified UTF-8 representation + * of every character of the specified string. * - * @throws IOException Signals that an I/O exception has occurred. + * @param s + * the specified string to be written. + * @throws IOException + * if an I/O exception has occurred. */ void writeUTF(String s) throws IOException; /** - * Flushes the initial position in this stream prior to the - * specified stream position. + * Flushes the initial position in this stream prior to the specified stream + * position. * - * @param pos the position. - * - * @throws IOException Signals that an I/O exception has occurred. + * @param pos + * the position. + * @throws IOException + * if an I/O exception has occurred. */ void flushBefore(long pos) throws IOException; - /** - * Writes a len number of short values from the specified array - * to the stream. - * - * @param s the shorts array to be written. - * @param off the offset in the char array. - * @param len the length of chars to be written. - * - * @throws IOException Signals that an I/O exception has occurred. + * Writes a len number of short values from the specified array to the + * stream. + * + * @param s + * the shorts array to be written. + * @param off + * the offset in the char array. + * @param len + * the length of chars to be written. + * @throws IOException + * if an I/O exception has occurred. */ void writeShorts(short[] s, int off, int len) throws IOException; /** * Writes a len number of chars to the stream. * - * @param c the char array to be written. - * @param off the offset in the char array. - * @param len the length of chars to be written. - * - * @throws IOException Signals that an I/O exception has occurred. + * @param c + * the char array to be written. + * @param off + * the offset in the char array. + * @param len + * the length of chars to be written. + * @throws IOException + * if an I/O exception has occurred. */ void writeChars(char[] c, int off, int len) throws IOException; /** - * Writes a len number of int values from the specified array - * to the stream. - * - * @param i the int array to be written. - * @param off the offset in the char array. - * @param len the length of chars to be written. - * - * @throws IOException Signals that an I/O exception has occurred. + * Writes a len number of integer values from the specified array to the + * stream. + * + * @param i + * the integer array to be written. + * @param off + * the offset in the char array. + * @param len + * the length of chars to be written. + * @throws IOException + * if an I/O exception has occurred. */ void writeInts(int[] i, int off, int len) throws IOException; /** - * Writes a len number of long values from the specified array - * to the stream. - * - * @param l the long array to be written. - * @param off the offset in the char array. - * @param len the length of chars to be written. - * - * @throws IOException Signals that an I/O exception has occurred. + * Writes a len number of long values from the specified array to the + * stream. + * + * @param l + * the long array to be written. + * @param off + * the offset in the char array. + * @param len + * the length of chars to be written. + * @throws IOException + * if an I/O exception has occurred. */ void writeLongs(long[] l, int off, int len) throws IOException; /** - * Writes a len number of float values from the specified array - * to the stream. - * - * @param f the float array to be written. - * @param off the offset in the char array. - * @param len the length of chars to be written. - * - * @throws IOException Signals that an I/O exception has occurred. + * Writes a len number of float values from the specified array to the + * stream. + * + * @param f + * the float array to be written. + * @param off + * the offset in the char array. + * @param len + * the length of chars to be written. + * @throws IOException + * if an I/O exception has occurred. */ void writeFloats(float[] f, int off, int len) throws IOException; /** - * Writes a len number of double values from the specified array - * to the stream. - * - * @param d the double array to be written. - * @param off the offset in the char array. - * @param len the length of chars to be written. - * - * @throws IOException Signals that an I/O exception has occurred. + * Writes a len number of double values from the specified array to the + * stream. + * + * @param d + * the double array to be written. + * @param off + * the offset in the char array. + * @param len + * the length of chars to be written. + * @throws IOException + * if an I/O exception has occurred. */ void writeDoubles(double[] d, int off, int len) throws IOException; /** * Writes a single bit at the current position. * - * @param bit the an int whose least significant bit is to be - * written to the stream. - * - * @throws IOException Signals that an I/O exception has occurred. + * @param bit + * the integer whose least significant bit is to be written to + * the stream. + * @throws IOException + * if an I/O exception has occurred. */ void writeBit(int bit) throws IOException; /** - * Writes a sequence of bits beggining from the current position. - * - * @param bits a long value containing the bits to be written, - * starting with the bit in position numBits - 1 down to the - * least significant bit. - * @param numBits the number of significant bit , - * it can be between 0 and 64. - * - * @throws IOException Signals that an I/O exception has occurred. + * Writes a sequence of bits beginning from the current position. + * + * @param bits + * the long value containing the bits to be written, starting + * with the bit in position numBits - 1 down to the least + * significant bit. + * @param numBits + * the number of significant bit, it can be between 0 and 64. + * @throws IOException + * if an I/O exception has occurred. */ void writeBits(long bits, int numBits) throws IOException; diff --git a/awt/javax/imageio/stream/ImageOutputStreamImpl.java b/awt/javax/imageio/stream/ImageOutputStreamImpl.java index c3d80fa7bee61..0fef78f1d1a1f 100644 --- a/awt/javax/imageio/stream/ImageOutputStreamImpl.java +++ b/awt/javax/imageio/stream/ImageOutputStreamImpl.java @@ -18,6 +18,7 @@ * @author Rustem V. Rafikov * @version $Revision: 1.3 $ */ + package javax.imageio.stream; import java.io.IOException; @@ -29,16 +30,19 @@ import java.nio.ByteOrder; */ /** - * The ImageOutputStreamImpl abstract class implements - * the ImageOutputStream interface. + * The ImageOutputStreamImpl abstract class implements the ImageOutputStream + * interface. + * + * @since Android 1.0 */ -public abstract class ImageOutputStreamImpl extends ImageInputStreamImpl - implements ImageOutputStream { +public abstract class ImageOutputStreamImpl extends ImageInputStreamImpl implements + ImageOutputStream { /** * Instantiates a new ImageOutputStreamImpl. */ - public ImageOutputStreamImpl() {} + public ImageOutputStreamImpl() { + } public abstract void write(int b) throws IOException; @@ -62,7 +66,7 @@ public abstract class ImageOutputStreamImpl extends ImageInputStreamImpl } else { } - //-- TODO implement + // -- TODO implement throw new UnsupportedOperationException("Not implemented yet"); } @@ -76,7 +80,7 @@ public abstract class ImageOutputStreamImpl extends ImageInputStreamImpl } else { } - //-- TODO implement + // -- TODO implement throw new UnsupportedOperationException("Not implemented yet"); } @@ -86,7 +90,7 @@ public abstract class ImageOutputStreamImpl extends ImageInputStreamImpl } else { } - //-- TODO implement + // -- TODO implement throw new UnsupportedOperationException("Not implemented yet"); } @@ -108,62 +112,63 @@ public abstract class ImageOutputStreamImpl extends ImageInputStreamImpl } public void writeUTF(String s) throws IOException { - //-- TODO implement + // -- TODO implement throw new UnsupportedOperationException("Not implemented yet"); } public void writeShorts(short[] s, int off, int len) throws IOException { - //-- TODO implement + // -- TODO implement throw new UnsupportedOperationException("Not implemented yet"); } public void writeChars(char[] c, int off, int len) throws IOException { - //-- TODO implement + // -- TODO implement throw new UnsupportedOperationException("Not implemented yet"); } public void writeInts(int[] i, int off, int len) throws IOException { - //-- TODO implement + // -- TODO implement throw new UnsupportedOperationException("Not implemented yet"); } public void writeLongs(long[] l, int off, int len) throws IOException { - //-- TODO implement + // -- TODO implement throw new UnsupportedOperationException("Not implemented yet"); } public void writeFloats(float[] f, int off, int len) throws IOException { - //-- TODO implement + // -- TODO implement throw new UnsupportedOperationException("Not implemented yet"); } public void writeDoubles(double[] d, int off, int len) throws IOException { - //-- TODO implement + // -- TODO implement throw new UnsupportedOperationException("Not implemented yet"); } public void writeBit(int bit) throws IOException { - //-- TODO implement + // -- TODO implement throw new UnsupportedOperationException("Not implemented yet"); } public void writeBits(long bits, int numBits) throws IOException { - //-- TODO implement + // -- TODO implement throw new UnsupportedOperationException("Not implemented yet"); } /** - * Flushes the bits. This method should be called in the write - * methods by subclasses. + * Flushes the bits. This method should be called in the write methods by + * subclasses. * - * @throws IOException Signals that an I/O exception has occurred. + * @throws IOException + * if an I/O exception has occurred. */ protected final void flushBits() throws IOException { if (bitOffset == 0) { return; } - - //-- TODO implement + + // -- TODO implement throw new UnsupportedOperationException("Not implemented yet"); } } diff --git a/awt/javax/imageio/stream/MemoryCacheImageInputStream.java b/awt/javax/imageio/stream/MemoryCacheImageInputStream.java index a3d470b01cd38..d7fc79139cec3 100644 --- a/awt/javax/imageio/stream/MemoryCacheImageInputStream.java +++ b/awt/javax/imageio/stream/MemoryCacheImageInputStream.java @@ -15,7 +15,6 @@ * limitations under the License. */ - package javax.imageio.stream; import org.apache.harmony.x.imageio.stream.RandomAccessMemoryCache; @@ -24,22 +23,29 @@ import java.io.IOException; import java.io.InputStream; /** - * The MemoryCacheImageInputStream class implements ImageInputStream - * using a memory buffer for caching the data. + * The MemoryCacheImageInputStream class implements ImageInputStream using a + * memory buffer for caching the data. + * + * @since Android 1.0 */ -public class MemoryCacheImageInputStream extends ImageInputStreamImpl { - - /** The is. */ +public class MemoryCacheImageInputStream extends ImageInputStreamImpl { + + /** + * The is. + */ private InputStream is; - - /** The ramc. */ + + /** + * The ramc. + */ private RandomAccessMemoryCache ramc = new RandomAccessMemoryCache(); /** - * Instantiates a new MemoryCacheImageInputStream - * which reads from the specified InputStream. + * Instantiates a new MemoryCacheImageInputStream which reads from the + * specified InputStream. * - * @param stream the InputStream to be read. + * @param stream + * the InputStream to be read. */ public MemoryCacheImageInputStream(InputStream stream) { if (stream == null) { diff --git a/awt/javax/imageio/stream/MemoryCacheImageOutputStream.java b/awt/javax/imageio/stream/MemoryCacheImageOutputStream.java index 96ded433ae13c..1df40a34227fa 100644 --- a/awt/javax/imageio/stream/MemoryCacheImageOutputStream.java +++ b/awt/javax/imageio/stream/MemoryCacheImageOutputStream.java @@ -15,7 +15,6 @@ * limitations under the License. */ - package javax.imageio.stream; import org.apache.harmony.x.imageio.stream.RandomAccessMemoryCache; @@ -23,24 +22,30 @@ import org.apache.harmony.x.imageio.stream.RandomAccessMemoryCache; import java.io.OutputStream; import java.io.IOException; - /** - * The MemoryCacheImageOutputStream class implements ImageOutputStream - * using a memory buffer for caching the data. + * The MemoryCacheImageOutputStream class implements ImageOutputStream using a + * memory buffer for caching the data. + * + * @since Android 1.0 */ public class MemoryCacheImageOutputStream extends ImageOutputStreamImpl { - - /** The os. */ + + /** + * The os. + */ OutputStream os; - - /** The ramc. */ + + /** + * The ramc. + */ RandomAccessMemoryCache ramc = new RandomAccessMemoryCache(); /** - * Instantiates a new MemoryCacheImageOutputStream - * which writes to the specified OutputStream. + * Instantiates a new MemoryCacheImageOutputStream which writes to the + * specified OutputStream. * - * @param stream the OutputStream. + * @param stream + * the OutputStream. */ public MemoryCacheImageOutputStream(OutputStream stream) { if (stream == null) { @@ -125,6 +130,6 @@ public class MemoryCacheImageOutputStream extends ImageOutputStreamImpl { ramc.getData(os, nBytes, flushedPosition); ramc.freeBefore(newFlushedPosition); - os.flush(); + os.flush(); } } diff --git a/awt/javax/imageio/stream/package.html b/awt/javax/imageio/stream/package.html new file mode 100644 index 0000000000000..6cf53c3c0646f --- /dev/null +++ b/awt/javax/imageio/stream/package.html @@ -0,0 +1,8 @@ + + +

    + This package contains classes and interfaces for handling images with low-level I/O operations. +

    + @since Android 1.0 + + diff --git a/awt/org/apache/harmony/awt/internal/nls/Messages.java b/awt/org/apache/harmony/awt/internal/nls/Messages.java index 96762c98e90d9..c340358db6157 100644 --- a/awt/org/apache/harmony/awt/internal/nls/Messages.java +++ b/awt/org/apache/harmony/awt/internal/nls/Messages.java @@ -71,7 +71,9 @@ public class Messages { * @return String the message for that key in the system message bundle. */ static public String getString(String msg) { + // BEGIN android-changed return MsgHelp.getString(msg); + // END android-changed } /** @@ -138,6 +140,12 @@ public class Messages { * @return String the message for that key in the system message bundle. */ static public String getString(String msg, Object[] args) { + // BEGIN android-changed return MsgHelp.getString(msg, args); + // END android-changed } + + // BEGIN android-note + // Duplicate code was dropped in favor of using MsgHelp. + // END android-note } diff --git a/awt/org/apache/harmony/beans/internal/nls/Messages.java b/awt/org/apache/harmony/beans/internal/nls/Messages.java index 727c75751b43b..51e8168fa1069 100644 --- a/awt/org/apache/harmony/beans/internal/nls/Messages.java +++ b/awt/org/apache/harmony/beans/internal/nls/Messages.java @@ -30,8 +30,17 @@ import java.util.Locale; import java.util.MissingResourceException; import java.util.ResourceBundle; -import org.apache.harmony.kernel.vm.VM; -import org.apache.harmony.luni.util.MsgHelp; +// BEGIN android-deleted +/* + * For Android, this module is a separate library and not part of the + * boot classpath, so its resources won't be found on the boot classpath + * as is assumed by MsgHelp.getString(). We instead use a local MsgHelp + * which bottoms out in a call to the useful part of its lower-level + * namesake. + */ +//import org.apache.harmony.kernel.vm.VM; +//import org.apache.harmony.luni.util.MsgHelp; +// END android-deleted /** * This class retrieves strings from a resource bundle and returns them, @@ -49,8 +58,10 @@ import org.apache.harmony.luni.util.MsgHelp; */ public class Messages { - private static final String sResource = - "org.apache.harmony.beans.internal.nls.messages"; //$NON-NLS-1$ + // BEGIN android-deleted + // private static final String sResource = + // "org.apache.harmony.beans.internal.nls.messages"; //$NON-NLS-1$ + // END android-deleted /** * Retrieves a message which has no arguments. @@ -60,7 +71,9 @@ public class Messages { * @return String the message for that key in the system message bundle. */ static public String getString(String msg) { - return MsgHelp.getString(sResource, msg); + // BEGIN android-changed + return MsgHelp.getString(msg); + // END android-changed } /** @@ -127,6 +140,12 @@ public class Messages { * @return String the message for that key in the system message bundle. */ static public String getString(String msg, Object[] args) { - return MsgHelp.getString(sResource, msg, args); + // BEGIN android-changed + return MsgHelp.getString(msg, args); + // END android-changed } + + // BEGIN android-note + // Duplicate code was dropped in favor of using MsgHelp. + // END android-note } diff --git a/awt/org/apache/harmony/beans/internal/nls/MsgHelp.java b/awt/org/apache/harmony/beans/internal/nls/MsgHelp.java new file mode 100644 index 0000000000000..68faabfa34cca --- /dev/null +++ b/awt/org/apache/harmony/beans/internal/nls/MsgHelp.java @@ -0,0 +1,86 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* + * This implementation is based on the class of the same name in + * org.apache.harmony.luni.util. + */ + +package org.apache.harmony.beans.internal.nls; + +import java.io.IOException; +import java.io.InputStream; +import java.util.logging.Logger; +import java.util.Locale; +import java.util.PropertyResourceBundle; +import java.util.ResourceBundle; +import java.util.MissingResourceException; + +/** + * This class contains helper methods for loading resource bundles and + * formatting external message strings. + */ +public final class MsgHelp { + /** name of the resource for this class */ + private static final String RESOURCE_NAME = + "/org/apache/harmony/beans/internal/nls/messages.properties"; + + /** the resource bundle for this class */ + private static final ResourceBundle THE_BUNDLE; + + static { + ResourceBundle rb = null; + + try { + InputStream in = MsgHelp.class.getResourceAsStream( + RESOURCE_NAME); + rb = new PropertyResourceBundle(in); + } catch (IOException ex) { + Logger.global.warning("Couldn't read resource bundle: " + + ex); + } catch (RuntimeException ex) { + // Shouldn't happen, but deal at least somewhat gracefully. + Logger.global.warning("Couldn't find resource bundle: " + + ex); + } + + THE_BUNDLE = rb; + } + + public static String getString(String msg) { + if (THE_BUNDLE == null) { + return msg; + } + try { + return THE_BUNDLE.getString(msg); + } catch (MissingResourceException e) { + return "Missing message: " + msg; + } + } + + static public String getString(String msg, Object[] args) { + String format = msg; + if (THE_BUNDLE != null) { + try { + format = THE_BUNDLE.getString(msg); + } catch (MissingResourceException e) { + } + } + + return org.apache.harmony.luni.util.MsgHelp.format(format, args); + } +} diff --git a/awt/org/apache/harmony/beans/internal/nls/messages.properties b/awt/resources/org/apache/harmony/beans/internals/nls/messages.properties similarity index 100% rename from awt/org/apache/harmony/beans/internal/nls/messages.properties rename to awt/resources/org/apache/harmony/beans/internals/nls/messages.properties diff --git a/build/jarjar-rules.txt b/build/jarjar-rules.txt new file mode 100644 index 0000000000000..5fdb022251b3b --- /dev/null +++ b/build/jarjar-rules.txt @@ -0,0 +1,2 @@ +rule org.apache.commons com.android.internal.apache.commons + diff --git a/camera/libcameraservice/Android.mk b/camera/libcameraservice/Android.mk index 4e7d6d23e9162..2dfe659a2e042 100644 --- a/camera/libcameraservice/Android.mk +++ b/camera/libcameraservice/Android.mk @@ -4,12 +4,13 @@ LOCAL_PATH:= $(call my-dir) # Set USE_CAMERA_STUB for non-emulator and non-simulator builds, if you want # the camera service to use the fake camera. For emulator or simulator builds, # we always use the fake camera. -# -ifeq ($(BOARD_CAMERA_LIBRARIES),) -USE_CAMERA_STUB:=true -else + +ifeq ($(USE_CAMERA_STUB),) USE_CAMERA_STUB:=false +ifneq ($(filter sooner generic sim,$(TARGET_DEVICE)),) +USE_CAMERA_STUB:=true endif #libcamerastub +endif ifeq ($(USE_CAMERA_STUB),true) # @@ -51,7 +52,7 @@ ifeq ($(USE_CAMERA_STUB), true) LOCAL_STATIC_LIBRARIES += libcamerastub LOCAL_CFLAGS += -include CameraHardwareStub.h else -LOCAL_SHARED_LIBRARIES += $(BOARD_CAMERA_LIBRARIES) +LOCAL_SHARED_LIBRARIES += libcamera endif include $(BUILD_SHARED_LIBRARY) diff --git a/camera/libcameraservice/CameraService.cpp b/camera/libcameraservice/CameraService.cpp index 5784c4b12b9a5..800ffa48a1949 100644 --- a/camera/libcameraservice/CameraService.cpp +++ b/camera/libcameraservice/CameraService.cpp @@ -1,6 +1,7 @@ /* ** -** Copyright 2008, The Android Open Source Project +** Copyright (C) 2008, The Android Open Source Project +** Copyright (C) 2008 HTC Inc. ** ** Licensed under the Apache License, Version 2.0 (the "License"); ** you may not use this file except in compliance with the License. @@ -15,7 +16,7 @@ ** limitations under the License. */ - +//#define LOG_NDEBUG 0 #define LOG_TAG "CameraService" #include @@ -155,10 +156,22 @@ CameraService::Client::Client(const sp& cameraService, { LOGD("Client E constructor"); mHardware = openCameraHardware(); - mHasFrameCallback = false; + + // Callback is disabled by default + mFrameCallbackFlag = FRAME_CALLBACK_FLAG_NOOP; LOGD("Client X constructor"); } +status_t CameraService::Client::connect(const sp& client) +{ + // remvoe old client + LOGD("connect (new client)"); + Mutex::Autolock _l(mLock); + mCameraClient = client; + mFrameCallbackFlag = FRAME_CALLBACK_FLAG_NOOP; + return NO_ERROR; +} + #if HAVE_ANDROID_OS static void *unregister_surface(void *arg) { @@ -170,7 +183,7 @@ static void *unregister_surface(void *arg) #endif CameraService::Client::~Client() -{ +{ // spin down hardware LOGD("Client E destructor"); if (mSurface != 0) { @@ -179,7 +192,7 @@ CameraService::Client::~Client() // We unregister the buffers in a different thread because binder does // not let us make sychronous transactions in a binder destructor (that // is, upon our reaching a refcount of zero.) - pthread_create(&thr, NULL, + pthread_create(&thr, NULL, unregister_surface, mSurface.get()); pthread_join(thr, NULL); @@ -227,12 +240,12 @@ status_t CameraService::Client::setPreviewDisplay(const sp& surface) return NO_ERROR; } -// tell the service whether to callback with each preview frame -void CameraService::Client::setHasFrameCallback(bool installed) +// set the frame callback flag to affect how the received frames from +// preview are handled. +void CameraService::Client::setFrameCallbackFlag(int frame_callback_flag) { Mutex::Autolock lock(mLock); - mHasFrameCallback = installed; - // If installed is false, mPreviewBuffer will be released in stopPreview(). + mFrameCallbackFlag = frame_callback_flag; } // start preview mode, must call setPreviewDisplay first @@ -250,24 +263,24 @@ status_t CameraService::Client::startPreview() LOGE("mHardware is NULL, returning."); return INVALID_OPERATION; } - + if (mSurface == 0) { LOGE("setPreviewDisplay must be called before startPreview!"); return INVALID_OPERATION; } - + // XXX: This needs to be improved. remove all hardcoded stuff - + int w, h; CameraParameters params(mHardware->getParameters()); params.getPreviewSize(&w, &h); - + mSurface->unregisterBuffers(); #if DEBUG_DUMP_PREVIEW_FRAME_TO_FILE debug_frame_cnt = 0; #endif - + status_t ret = mHardware->startPreview(previewCallback, mCameraService.get()); if (ret == NO_ERROR) { @@ -277,7 +290,7 @@ status_t CameraService::Client::startPreview() } else LOGE("mHardware->startPreview() failed with status %d\n", ret); - + return ret; } @@ -295,7 +308,7 @@ void CameraService::Client::stopPreview() mHardware->stopPreview(); LOGD("stopPreview(), hardware stopped OK"); - + if (mSurface != 0) { mSurface->unregisterBuffers(); } @@ -361,6 +374,7 @@ static void dump_to_file(const char *fname, // preview callback - frame buffer update void CameraService::Client::previewCallback(const sp& mem, void* user) { + LOGV("previewCallback()"); sp client = getClientFromCookie(user); if (client == 0) { return; @@ -395,7 +409,7 @@ void CameraService::Client::previewCallback(const sp& mem, void* user) client->postFrame(mem); #if DEBUG_CLIENT_REFERENCES - //**** if the client's refcount is 1, then we are about to destroy it here, + //**** if the client's refcount is 1, then we are about to destroy it here, // which is bad--print all refcounts. if (client->getStrongCount() == 1) { LOGE("++++++++++++++++ (PREVIEW) THIS WILL CAUSE A LOCKUP!"); @@ -431,7 +445,7 @@ status_t CameraService::Client::takePicture() LOGE("mHardware is NULL, returning."); return INVALID_OPERATION; } - + if (mSurface != NULL) mSurface->unregisterBuffers(); @@ -495,7 +509,7 @@ void CameraService::Client::yuvPictureCallback(const sp& mem, client->postRaw(mem); #if DEBUG_CLIENT_REFERENCES - //**** if the client's refcount is 1, then we are about to destroy it here, + //**** if the client's refcount is 1, then we are about to destroy it here, // which is bad--print all refcounts. if (client->getStrongCount() == 1) { LOGE("++++++++++++++++ (RAW) THIS WILL CAUSE A LOCKUP!"); @@ -532,7 +546,7 @@ void CameraService::Client::jpegPictureCallback(const sp& mem, void *us client->postJpeg(mem); #if DEBUG_CLIENT_REFERENCES - //**** if the client's refcount is 1, then we are about to destroy it here, + //**** if the client's refcount is 1, then we are about to destroy it here, // which is bad--print all refcounts. if (client->getStrongCount() == 1) { LOGE("++++++++++++++++ (JPEG) THIS WILL CAUSE A LOCKUP!"); @@ -615,37 +629,74 @@ void CameraService::Client::postJpeg(const sp& mem) mCameraClient->jpegCallback(mem); } +void CameraService::Client::copyFrameAndPostCopiedFrame(sp heap, size_t offset, size_t size) +{ + LOGV("copyFrameAndPostCopiedFrame"); + // It is necessary to copy out of pmem before sending this to + // the callback. For efficiency, reuse the same MemoryHeapBase + // provided it's big enough. Don't allocate the memory or + // perform the copy if there's no callback. + if (mPreviewBuffer == 0) { + mPreviewBuffer = new MemoryHeapBase(size, 0, NULL); + } else if (size > mPreviewBuffer->virtualSize()) { + mPreviewBuffer.clear(); + mPreviewBuffer = new MemoryHeapBase(size, 0, NULL); + if (mPreviewBuffer == 0) { + LOGE("failed to allocate space for preview buffer"); + return; + } + } + memcpy(mPreviewBuffer->base(), + (uint8_t *)heap->base() + offset, size); + + sp frame = new MemoryBase(mPreviewBuffer, 0, size); + if (frame == 0) { + LOGE("failed to allocate space for frame callback"); + return; + } + mCameraClient->frameCallback(frame); +} + void CameraService::Client::postFrame(const sp& mem) { + LOGV("postFrame"); + if (mem == 0) { + LOGW("mem is a null pointer"); + return; + } + ssize_t offset; size_t size; sp heap = mem->getMemory(&offset, &size); - - sp frame; - { Mutex::Autolock surfaceLock(mSurfaceLock); - if (mSurface != NULL) + if (mSurface != NULL) { mSurface->postBuffer(offset); - } - - // It is necessary to copy out of pmem before sending this to the callback. - // For efficiency, reuse the same MemoryHeapBase provided it's big enough. - // Don't allocate the memory or perform the copy if there's no callback. - if (mHasFrameCallback) { - if (mPreviewBuffer == 0) { - mPreviewBuffer = new MemoryHeapBase(size, 0, NULL); - } else if (size > mPreviewBuffer->virtualSize()) { - mPreviewBuffer.clear(); - mPreviewBuffer = new MemoryHeapBase(size, 0, NULL); } - memcpy(mPreviewBuffer->base(), (uint8_t *)heap->base() + offset, size); - frame = new MemoryBase(mPreviewBuffer, 0, size); } - - // Do not hold the client lock while calling back. - if (frame != 0) { - mCameraClient->frameCallback(frame); + + // Is the callback enabled or not? + if (!(mFrameCallbackFlag & FRAME_CALLBACK_FLAG_ENABLE_MASK)) { + // If the enable bit is off, the copy-out and one-shot bits are ignored + LOGV("frame callback is diabled"); + return; + } + + // Is the received frame copied out or not? + if (mFrameCallbackFlag & FRAME_CALLBACK_FLAG_COPY_OUT_MASK) { + LOGV("frame is copied out"); + copyFrameAndPostCopiedFrame(heap, offset, size); + } else { + LOGV("frame is directly sent out without copying"); + mCameraClient->frameCallback(mem); + } + + // Is this is one-shot only? + if (mFrameCallbackFlag & FRAME_CALLBACK_FLAG_ONE_SHOT_MASK) { + LOGV("One-shot only, thus clear the bits and disable frame callback"); + mFrameCallbackFlag &= ~(FRAME_CALLBACK_FLAG_ONE_SHOT_MASK | + FRAME_CALLBACK_FLAG_COPY_OUT_MASK | + FRAME_CALLBACK_FLAG_ENABLE_MASK); } } @@ -711,7 +762,7 @@ status_t CameraService::onTransact( } status_t err = BnCameraService::onTransact(code, data, reply, flags); - + LOGD("+++ onTransact err %d code %d", err, code); if (err == UNKNOWN_TRANSACTION || err == PERMISSION_DENIED) { diff --git a/camera/libcameraservice/CameraService.h b/camera/libcameraservice/CameraService.h index 683c51b9f6832..b225aa9f34497 100644 --- a/camera/libcameraservice/CameraService.h +++ b/camera/libcameraservice/CameraService.h @@ -1,6 +1,7 @@ /* ** -** Copyright 2008, The Android Open Source Project +** Copyright (C) 2008, The Android Open Source Project +** Copyright (C) 2008 HTC Inc. ** ** Licensed under the Apache License, Version 2.0 (the "License"); ** you may not use this file except in compliance with the License. @@ -20,6 +21,8 @@ #include #include +#include + class android::MemoryHeapBase; namespace android { @@ -32,7 +35,7 @@ namespace android { // When enabled, this feature allows you to send an event to the CameraService // so that you can cause all references to the heap object gWeakHeap, defined // below, to be printed. You will also need to set DEBUG_REFS=1 and -// DEBUG_REFS_ENABLED_BY_DEFAULT=0 in libutils/RefBase.cpp. You just have to +// DEBUG_REFS_ENABLED_BY_DEFAULT=0 in libutils/RefBase.cpp. You just have to // set gWeakHeap to the appropriate heap you want to track. #define DEBUG_HEAP_LEAKS 0 @@ -67,11 +70,15 @@ private: public: virtual void disconnect(); + // connect new client with existing camera remote + virtual status_t connect(const sp& client); + // pass the buffered ISurface to the camera service virtual status_t setPreviewDisplay(const sp& surface); - - // tell the service whether to callback with each preview frame - virtual void setHasFrameCallback(bool installed); + + // set the frame callback flag to affect how the received frames from + // preview are handled. + virtual void setFrameCallbackFlag(int frame_callback_flag); // start preview mode, must call setPreviewDisplay first virtual status_t startPreview(); @@ -112,6 +119,7 @@ private: void postRaw(const sp& mem); void postJpeg(const sp& mem); void postFrame(const sp& mem); + void copyFrameAndPostCopiedFrame(sp heap, size_t offset, size_t size); void postError(status_t error); void postAutoFocus(bool focused); @@ -119,20 +127,20 @@ private: mutable Mutex mLock; // mSurfaceLock synchronizes access to mSurface between // setPreviewSurface() and postFrame(). Note that among - // the public methods, all accesses to mSurface are + // the public methods, all accesses to mSurface are // syncrhonized by mLock. However, postFrame() is called - // by the CameraHardwareInterface callback, and needs to + // by the CameraHardwareInterface callback, and needs to // access mSurface. It cannot hold mLock, however, because // stopPreview() may be holding that lock while attempting // top stop preview, and stopPreview itself will block waiting - // for a callback from CameraHardwareInterface. If this + // for a callback from CameraHardwareInterface. If this // happens, it will cause a deadlock. mutable Mutex mSurfaceLock; mutable Condition mReady; sp mCameraService; sp mSurface; sp mPreviewBuffer; - bool mHasFrameCallback; + int mFrameCallbackFlag; // these are immutable once the object is created, // they don't need to be protected by a lock diff --git a/cmds/pm/src/com/android/commands/pm/Pm.java b/cmds/pm/src/com/android/commands/pm/Pm.java index b79ee26e9ea2f..09a140b021920 100644 --- a/cmds/pm/src/com/android/commands/pm/Pm.java +++ b/cmds/pm/src/com/android/commands/pm/Pm.java @@ -16,14 +16,15 @@ package com.android.commands.pm; +import android.content.ComponentName; import android.content.pm.ApplicationInfo; import android.content.pm.IPackageDeleteObserver; import android.content.pm.IPackageInstallObserver; import android.content.pm.IPackageManager; +import android.content.pm.InstrumentationInfo; import android.content.pm.PackageInfo; import android.content.pm.PackageItemInfo; import android.content.pm.PackageManager; -import android.content.pm.PackageParser; import android.content.pm.PermissionGroupInfo; import android.content.pm.PermissionInfo; import android.content.res.AssetManager; @@ -33,8 +34,9 @@ import android.os.RemoteException; import android.os.ServiceManager; import java.io.File; -import java.lang.ref.WeakReference; import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; import java.util.List; import java.util.WeakHashMap; @@ -48,6 +50,9 @@ public final class Pm { private int mNextArg; private String mCurArgData; + private static final String PM_NOT_RUNNING_ERR = + "Error: Could not access the Package Manager. Is the system running?"; + public static void main(String[] args) { new Pm().run(args); } @@ -61,8 +66,7 @@ public final class Pm { mPm = IPackageManager.Stub.asInterface(ServiceManager.getService("package")); if (mPm == null) { - System.err.println("Error Type 1: Could not access the Package Manager!"); - showUsage(); + System.err.println(PM_NOT_RUNNING_ERR); return; } @@ -114,6 +118,11 @@ public final class Pm { /** * Execute the list sub-command. + * + * pm list [package | packages] + * pm list permission-groups + * pm list permissions + * pm list instrumentation */ private void runList() { String type = nextArg(); @@ -128,6 +137,8 @@ public final class Pm { runListPermissionGroups(); } else if ("permissions".equals(type)) { runListPermissions(); + } else if ("instrumentation".equals(type)) { + runListInstrumentation(); } else { System.err.println("Error: unknown list type '" + type + "'"); showUsage(); @@ -173,6 +184,67 @@ public final class Pm { System.out.println(info.packageName); } } catch (RemoteException e) { + System.err.println(e.toString()); + System.err.println(PM_NOT_RUNNING_ERR); + } + } + + /** + * Lists all of the installed instrumentation, or all for a given package + * + * pm list instrumentation [package] [-f] + */ + private void runListInstrumentation() { + int flags = 0; // flags != 0 is only used to request meta-data + boolean showPackage = false; + String targetPackage = null; + + try { + String opt; + while ((opt=nextArg()) != null) { + if (opt.equals("-f")) { + showPackage = true; + } else if (opt.charAt(0) != '-') { + targetPackage = opt; + } else { + System.err.println("Error: Unknown option: " + opt); + showUsage(); + return; + } + } + } catch (RuntimeException ex) { + System.err.println("Error: " + ex.toString()); + showUsage(); + return; + } + + try { + List list = mPm.queryInstrumentation(targetPackage, flags); + + // Sort by target package + Collections.sort(list, new Comparator() { + public int compare(InstrumentationInfo o1, InstrumentationInfo o2) { + return o1.targetPackage.compareTo(o2.targetPackage); + } + }); + + int count = (list != null) ? list.size() : 0; + for (int p = 0; p < count; p++) { + InstrumentationInfo ii = list.get(p); + System.out.print("instrumentation:"); + if (showPackage) { + System.out.print(ii.sourceDir); + System.out.print("="); + } + ComponentName cn = new ComponentName(ii.packageName, ii.name); + System.out.print(cn.flattenToShortString()); + System.out.print(" (target="); + System.out.print(ii.targetPackage); + System.out.println(")"); + } + } catch (RemoteException e) { + System.err.println(e.toString()); + System.err.println(PM_NOT_RUNNING_ERR); } } @@ -190,6 +262,8 @@ public final class Pm { System.out.println(pgi.name); } } catch (RemoteException e) { + System.err.println(e.toString()); + System.err.println(PM_NOT_RUNNING_ERR); } } @@ -274,6 +348,8 @@ public final class Pm { -10000, 10000); } } catch (RemoteException e) { + System.err.println(e.toString()); + System.err.println(PM_NOT_RUNNING_ERR); } } @@ -472,6 +548,9 @@ public final class Pm { case PackageManager.INSTALL_PARSE_FAILED_MANIFEST_EMPTY: s = "INSTALL_PARSE_FAILED_MANIFEST_EMPTY"; break; + case PackageManager.INSTALL_FAILED_OLDER_SDK: + s = "INSTALL_FAILED_OLDER_SDK"; + break; default: s = Integer.toString(result); break; @@ -523,6 +602,8 @@ public final class Pm { } } } catch (RemoteException e) { + System.err.println(e.toString()); + System.err.println(PM_NOT_RUNNING_ERR); } } @@ -575,6 +656,8 @@ public final class Pm { } } } catch (RemoteException e) { + System.err.println(e.toString()); + System.err.println(PM_NOT_RUNNING_ERR); } return obs.result; } @@ -591,6 +674,8 @@ public final class Pm { System.out.println(info.applicationInfo.sourceDir); } } catch (RemoteException e) { + System.err.println(e.toString()); + System.err.println(PM_NOT_RUNNING_ERR); } } @@ -606,7 +691,8 @@ public final class Pm { mResourceCache.put(pii.packageName, res); return res; } catch (RemoteException e) { - System.err.println("Package manager gone!"); + System.err.println(e.toString()); + System.err.println(PM_NOT_RUNNING_ERR); return null; } } @@ -662,6 +748,7 @@ public final class Pm { System.err.println(" pm list packages [-f]"); System.err.println(" pm list permission-groups"); System.err.println(" pm list permissions [-g] [-f] [-d] [-u] [GROUP]"); + System.err.println(" pm list instrumentation [-f] [TARGET-PACKAGE]"); System.err.println(" pm path PACKAGE"); System.err.println(" pm install [-l] [-r] PATH"); System.err.println(" pm uninstall [-k] PACKAGE"); @@ -680,6 +767,10 @@ public final class Pm { System.err.println("the -d option to only list dangerous permissions. Use"); System.err.println("the -u option to list only the permissions users will see."); System.err.println(""); + System.err.println("The list instrumentation command prints all instrumentations,"); + System.err.println("or only those that target a specified package. Use the -f option"); + System.err.println("to see their associated file."); + System.err.println(""); System.err.println("The path command prints the path to the .apk of a package."); System.err.println(""); System.err.println("The install command installs a package to the system. Use"); diff --git a/cmds/svc/src/com/android/commands/svc/DataCommand.java b/cmds/svc/src/com/android/commands/svc/DataCommand.java new file mode 100644 index 0000000000000..72cb86d69914c --- /dev/null +++ b/cmds/svc/src/com/android/commands/svc/DataCommand.java @@ -0,0 +1,81 @@ +/* + * Copyright (C) 2008 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.commands.svc; + +import android.os.ServiceManager; +import android.os.RemoteException; +import android.net.IConnectivityManager; +import android.net.ConnectivityManager; +import android.content.Context; +import com.android.internal.telephony.ITelephony; + +public class DataCommand extends Svc.Command { + public DataCommand() { + super("data"); + } + + public String shortHelp() { + return "Control mobile data connectivity"; + } + + public String longHelp() { + return shortHelp() + "\n" + + "\n" + + "usage: svc data [enable|disable]\n" + + " Turn mobile data on or off.\n\n" + + " svc data prefer\n" + + " Set mobile as the preferred data network\n"; + } + + public void run(String[] args) { + boolean validCommand = false; + if (args.length >= 2) { + boolean flag = false; + if ("enable".equals(args[1])) { + flag = true; + validCommand = true; + } else if ("disable".equals(args[1])) { + flag = false; + validCommand = true; + } else if ("prefer".equals(args[1])) { + IConnectivityManager connMgr = + IConnectivityManager.Stub.asInterface(ServiceManager.getService(Context.CONNECTIVITY_SERVICE)); + try { + connMgr.setNetworkPreference(ConnectivityManager.TYPE_MOBILE); + } catch (RemoteException e) { + System.err.println("Failed to set preferred network: " + e); + } + return; + } + if (validCommand) { + ITelephony phoneMgr + = ITelephony.Stub.asInterface(ServiceManager.getService(Context.TELEPHONY_SERVICE)); + try { + if (flag) { + phoneMgr.enableDataConnectivity(); + } else + phoneMgr.disableDataConnectivity(); + } + catch (RemoteException e) { + System.err.println("Mobile data operation failed: " + e); + } + return; + } + } + System.err.println(longHelp()); + } +} \ No newline at end of file diff --git a/cmds/svc/src/com/android/commands/svc/PowerCommand.java b/cmds/svc/src/com/android/commands/svc/PowerCommand.java index 990837f1794b9..2b54f549f3894 100644 --- a/cmds/svc/src/com/android/commands/svc/PowerCommand.java +++ b/cmds/svc/src/com/android/commands/svc/PowerCommand.java @@ -19,6 +19,8 @@ package com.android.commands.svc; import android.os.IPowerManager; import android.os.ServiceManager; import android.os.RemoteException; +import android.os.BatteryManager; +import android.content.Context; public class PowerCommand extends Svc.Command { public PowerCommand() { @@ -32,7 +34,7 @@ public class PowerCommand extends Svc.Command { public String longHelp() { return shortHelp() + "\n" + "\n" - + "usage: svc power stayon [true|false]\n" + + "usage: svc power stayon [true|false|usb|ac]\n" + " Set the 'keep awake while plugged in' setting.\n"; } @@ -40,18 +42,23 @@ public class PowerCommand extends Svc.Command { fail: { if (args.length >= 2) { if ("stayon".equals(args[1]) && args.length == 3) { - boolean val; + int val; if ("true".equals(args[2])) { - val = true; + val = BatteryManager.BATTERY_PLUGGED_AC | + BatteryManager.BATTERY_PLUGGED_USB; } else if ("false".equals(args[2])) { - val = false; + val = 0; + } else if ("usb".equals(args[2])) { + val = BatteryManager.BATTERY_PLUGGED_USB; + } else if ("ac".equals(args[2])) { + val = BatteryManager.BATTERY_PLUGGED_AC; } else { break fail; } IPowerManager pm - = IPowerManager.Stub.asInterface(ServiceManager.getService("power")); + = IPowerManager.Stub.asInterface(ServiceManager.getService(Context.POWER_SERVICE)); try { pm.setStayOnSetting(val); } diff --git a/cmds/svc/src/com/android/commands/svc/Svc.java b/cmds/svc/src/com/android/commands/svc/Svc.java index ae397a0cf158c..1cd4c0db0ebcc 100644 --- a/cmds/svc/src/com/android/commands/svc/Svc.java +++ b/cmds/svc/src/com/android/commands/svc/Svc.java @@ -16,20 +16,6 @@ package com.android.commands.svc; -import android.app.ActivityManagerNative; -import android.app.IActivityManager; -import android.app.IInstrumentationWatcher; -import android.content.ComponentName; -import android.content.Intent; -import android.net.Uri; -import android.os.RemoteException; -import android.os.Bundle; -import android.os.ServiceManager; -import android.view.IWindowManager; - -import java.util.Iterator; -import java.util.Set; - public class Svc { public static abstract class Command { @@ -49,13 +35,6 @@ public class Svc { } public static void main(String[] args) { - if (true) { - for (String a: args) { - System.err.print(a + " "); - } - System.err.println(); - } - if (args.length >= 1) { Command c = lookupCommand(args[0]); if (c != null) { @@ -66,7 +45,7 @@ public class Svc { COMMAND_HELP.run(args); } - private static final Command lookupCommand(String name) { + private static Command lookupCommand(String name) { final int N = COMMANDS.length; for (int i=0; i= 2) { + boolean flag = false; + if ("enable".equals(args[1])) { + flag = true; + validCommand = true; + } else if ("disable".equals(args[1])) { + flag = false; + validCommand = true; + } else if ("prefer".equals(args[1])) { + IConnectivityManager connMgr = + IConnectivityManager.Stub.asInterface(ServiceManager.getService(Context.CONNECTIVITY_SERVICE)); + try { + connMgr.setNetworkPreference(ConnectivityManager.TYPE_WIFI); + } catch (RemoteException e) { + System.err.println("Failed to set preferred network: " + e); + } + return; + } + if (validCommand) { + IWifiManager wifiMgr + = IWifiManager.Stub.asInterface(ServiceManager.getService(Context.WIFI_SERVICE)); + try { + wifiMgr.setWifiEnabled(flag); + } + catch (RemoteException e) { + System.err.println("Wi-Fi operation failed: " + e); + } + return; + } + } + System.err.println(longHelp()); + } +} \ No newline at end of file diff --git a/core/java/android/accounts/AccountMonitor.java b/core/java/android/accounts/AccountMonitor.java index 9bcc1e78f675a..f21385eadeb70 100644 --- a/core/java/android/accounts/AccountMonitor.java +++ b/core/java/android/accounts/AccountMonitor.java @@ -42,31 +42,42 @@ public class AccountMonitor extends BroadcastReceiver implements ServiceConnecti private final Context mContext; private final AccountMonitorListener mListener; private boolean mClosed = false; + private int pending = 0; // This thread runs in the background and runs the code to update accounts // in the listener. private class AccountUpdater extends Thread { private IBinder mService; - + public AccountUpdater(IBinder service) { mService = service; } - + @Override public void run() { Process.setThreadPriority(Process.THREAD_PRIORITY_BACKGROUND); IAccountsService accountsService = IAccountsService.Stub.asInterface(mService); - String[] accounts; - try { - accounts = accountsService.getAccounts(); - } catch (RemoteException e) { - // if the service was killed then the system will restart it and when it does we - // will get another onServiceConnected, at which point we will do a notify. - Log.w("AccountMonitor", "Remote exception when getting accounts", e); - return; - } + String[] accounts = null; + do { + try { + accounts = accountsService.getAccounts(); + } catch (RemoteException e) { + // if the service was killed then the system will restart it and when it does we + // will get another onServiceConnected, at which point we will do a notify. + Log.w("AccountMonitor", "Remote exception when getting accounts", e); + return; + } + + synchronized (AccountMonitor.this) { + --pending; + if (pending == 0) { + break; + } + } + } while (true); + mContext.unbindService(AccountMonitor.this); - + try { mListener.onAccountsUpdated(accounts); } catch (SQLException e) { @@ -76,7 +87,7 @@ public class AccountMonitor extends BroadcastReceiver implements ServiceConnecti } } } - + /** * Initializes the AccountMonitor and initiates a bind to the * AccountsService to get the initial account list. For 1.0, @@ -93,7 +104,7 @@ public class AccountMonitor extends BroadcastReceiver implements ServiceConnecti mContext = context; mListener = listener; - // Register an intent receiver to monitor account changes + // Register a broadcast receiver to monitor account changes IntentFilter intentFilter = new IntentFilter(); intentFilter.addAction(AccountsServiceConstants.LOGIN_ACCOUNTS_CHANGED_ACTION); intentFilter.addAction(Intent.ACTION_DEVICE_STORAGE_OK); // To recover from disk-full. @@ -116,14 +127,27 @@ public class AccountMonitor extends BroadcastReceiver implements ServiceConnecti public void onServiceDisconnected(ComponentName className) { } - private void notifyListener() { - // initiate the bind - if (!mContext.bindService(AccountsServiceConstants.SERVICE_INTENT, this, - Context.BIND_AUTO_CREATE)) { - // This is normal if GLS isn't part of this build. - Log.w("AccountMonitor", - "Couldn't connect to the accounts service (Missing service?)"); + private synchronized void notifyListener() { + if (pending == 0) { + // initiate the bind + if (!mContext.bindService(AccountsServiceConstants.SERVICE_INTENT, + this, Context.BIND_AUTO_CREATE)) { + // This is normal if GLS isn't part of this build. + Log.w("AccountMonitor", + "Couldn't connect to " + + AccountsServiceConstants.SERVICE_INTENT + + " (Missing service?)"); + } + } else { + // already bound. bindService will not trigger another + // call to onServiceConnected, so instead we make sure + // that the existing background thread will call + // getAccounts() after this function returns, by + // incrementing pending. + // + // Yes, this else clause contains only a comment. } + ++pending; } /** diff --git a/core/java/android/app/Activity.java b/core/java/android/app/Activity.java index fa310a5cf14ae..eafb0488490fd 100644 --- a/core/java/android/app/Activity.java +++ b/core/java/android/app/Activity.java @@ -62,6 +62,7 @@ import android.widget.AdapterView; import com.android.internal.policy.PolicyManager; import java.util.ArrayList; +import java.util.HashMap; /** * An activity is a single, focused thing that the user can do. Almost all @@ -613,7 +614,8 @@ public class Activity extends ContextThemeWrapper private ComponentName mComponent; /*package*/ ActivityInfo mActivityInfo; /*package*/ ActivityThread mMainThread; - private Object mLastNonConfigurationInstance; + /*package*/ Object mLastNonConfigurationInstance; + /*package*/ HashMap mLastNonConfigurationChildInstances; Activity mParent; boolean mCalled; private boolean mResumed; @@ -1379,6 +1381,38 @@ public class Activity extends ContextThemeWrapper return null; } + /** + * Retrieve the non-configuration instance data that was previously + * returned by {@link #onRetainNonConfigurationChildInstances()}. This will + * be available from the initial {@link #onCreate} and + * {@link #onStart} calls to the new instance, allowing you to extract + * any useful dynamic state from the previous instance. + * + *

    Note that the data you retrieve here should only be used + * as an optimization for handling configuration changes. You should always + * be able to handle getting a null pointer back, and an activity must + * still be able to restore itself to its previous state (through the + * normal {@link #onSaveInstanceState(Bundle)} mechanism) even if this + * function returns null. + * + * @return Returns the object previously returned by + * {@link #onRetainNonConfigurationChildInstances()} + */ + HashMap getLastNonConfigurationChildInstances() { + return mLastNonConfigurationChildInstances; + } + + /** + * This method is similar to {@link #onRetainNonConfigurationInstance()} except that + * it should return either a mapping from child activity id strings to arbitrary objects, + * or null. This method is intended to be used by Activity framework subclasses that control a + * set of child activities, such as ActivityGroup. The same guarantees and restrictions apply + * as for {@link #onRetainNonConfigurationInstance()}. The default implementation returns null. + */ + HashMap onRetainNonConfigurationChildInstances() { + return null; + } + public void onLowMemory() { mCalled = true; } @@ -1837,12 +1871,49 @@ public class Activity extends ContextThemeWrapper * Called when the current {@link Window} of the activity gains or loses * focus. This is the best indicator of whether this activity is visible * to the user. + * + *

    Note that this provides information what global focus state, which + * is managed independently of activity lifecycles. As such, while focus + * changes will generally have some relation to lifecycle changes (an + * activity that is stopped will not generally get window focus), you + * should not rely on any particular order between the callbacks here and + * those in the other lifecycle methods such as {@link #onResume}. + * + *

    As a general rule, however, a resumed activity will have window + * focus... unless it has displayed other dialogs or popups that take + * input focus, in which case the activity itself will not have focus + * when the other windows have it. Likewise, the system may display + * system-level windows (such as the status bar notification panel or + * a system alert) which will temporarily take window input focus without + * pausing the foreground activity. * * @param hasFocus Whether the window of this activity has focus. + * + * @see #hasWindowFocus() + * @see #onResume */ public void onWindowFocusChanged(boolean hasFocus) { } + /** + * Returns true if this activity's main window currently has window focus. + * Note that this is not the same as the view itself having focus. + * + * @return True if this activity's main window currently has window focus. + * + * @see #onWindowAttributesChanged(android.view.WindowManager.LayoutParams) + */ + public boolean hasWindowFocus() { + Window w = getWindow(); + if (w != null) { + View d = w.getDecorView(); + if (d != null) { + return d.hasWindowFocus(); + } + } + return false; + } + /** * Called to process key events. You can override this to intercept all * key events before they are dispatched to the window. Be sure to call @@ -2159,6 +2230,15 @@ public class Activity extends ContextThemeWrapper view.showContextMenu(); } + /** + * Programmatically closes the most recently opened context menu, if showing. + * + * @hide pending API council + */ + public void closeContextMenu() { + mWindow.closePanel(Window.FEATURE_CONTEXT_MENU); + } + /** * This hook is called whenever an item in a context menu is selected. The * default implementation simply returns false to have the normal processing @@ -2910,6 +2990,7 @@ public class Activity extends ContextThemeWrapper * @param flags May be {@link PendingIntent#FLAG_ONE_SHOT PendingIntent.FLAG_ONE_SHOT}, * {@link PendingIntent#FLAG_NO_CREATE PendingIntent.FLAG_NO_CREATE}, * {@link PendingIntent#FLAG_CANCEL_CURRENT PendingIntent.FLAG_CANCEL_CURRENT}, + * {@link PendingIntent#FLAG_UPDATE_CURRENT PendingIntent.FLAG_UPDATE_CURRENT}, * or any of the flags as supported by * {@link Intent#fillIn Intent.fillIn()} to control which unspecified parts * of the intent that can be supplied when the actual send happens. @@ -3285,10 +3366,21 @@ public class Activity extends ContextThemeWrapper Application application, Intent intent, ActivityInfo info, CharSequence title, Activity parent, String id, Object lastNonConfigurationInstance, Configuration config) { + attach(context, aThread, instr, token, application, intent, info, title, parent, id, + lastNonConfigurationInstance, null, config); + } + + final void attach(Context context, ActivityThread aThread, Instrumentation instr, IBinder token, + Application application, Intent intent, ActivityInfo info, CharSequence title, + Activity parent, String id, Object lastNonConfigurationInstance, + HashMap lastNonConfigurationChildInstances, Configuration config) { attachBaseContext(context); mWindow = PolicyManager.makeNewWindow(this); mWindow.setCallback(this); + if (info.softInputMode != WindowManager.LayoutParams.SOFT_INPUT_STATE_UNSPECIFIED) { + mWindow.setSoftInputMode(info.softInputMode); + } mUiThread = Thread.currentThread(); mMainThread = aThread; @@ -3302,6 +3394,7 @@ public class Activity extends ContextThemeWrapper mParent = parent; mEmbeddedID = id; mLastNonConfigurationInstance = lastNonConfigurationInstance; + mLastNonConfigurationChildInstances = lastNonConfigurationChildInstances; mWindow.setWindowManager(null, mToken, mComponent.flattenToString()); if (mParent != null) { @@ -3375,6 +3468,10 @@ public class Activity extends ContextThemeWrapper } } + final void performPause() { + onPause(); + } + final void performStop() { if (!mStopped) { if (mWindow != null) { diff --git a/core/java/android/app/ActivityGroup.java b/core/java/android/app/ActivityGroup.java index 96bb47582de05..f1216f95e7dfb 100644 --- a/core/java/android/app/ActivityGroup.java +++ b/core/java/android/app/ActivityGroup.java @@ -16,14 +16,19 @@ package android.app; +import java.util.HashMap; + import android.content.Intent; import android.os.Bundle; +import android.util.Log; /** * A screen that contains and runs multiple embedded activities. */ public class ActivityGroup extends Activity { + private static final String TAG = "ActivityGroup"; private static final String STATES_KEY = "android:states"; + static final String PARENT_NON_CONFIG_INSTANCE_KEY = "android:parent_non_config_instance"; /** * This field should be made private, so it is hidden from the SDK. @@ -80,6 +85,17 @@ public class ActivityGroup extends Activity { mLocalActivityManager.dispatchDestroy(isFinishing()); } + /** + * Returns a HashMap mapping from child activity ids to the return values + * from calls to their onRetainNonConfigurationInstance methods. + * + * {@hide} + */ + @Override + public HashMap onRetainNonConfigurationChildInstances() { + return mLocalActivityManager.dispatchRetainNonConfigurationInstance(); + } + public Activity getCurrentActivity() { return mLocalActivityManager.getCurrentActivity(); } diff --git a/core/java/android/app/ActivityManager.java b/core/java/android/app/ActivityManager.java index 6eb1102949768..f9b92218c56a9 100644 --- a/core/java/android/app/ActivityManager.java +++ b/core/java/android/app/ActivityManager.java @@ -29,7 +29,6 @@ import android.os.Parcelable; import android.os.Parcelable.Creator; import android.text.TextUtils; import android.util.Log; - import java.util.List; /** @@ -601,4 +600,75 @@ public class ActivityManager { return null; } } + + /** + * Information you can retrieve about a running process. + */ + public static class RunningAppProcessInfo implements Parcelable { + /** + * The name of the process that this object is associated with + */ + public String processName; + + /** + * The pid of this process; 0 if none + */ + public int pid; + + public String pkgList[]; + + public RunningAppProcessInfo() { + } + + public RunningAppProcessInfo(String pProcessName, int pPid, String pArr[]) { + processName = pProcessName; + pid = pPid; + pkgList = pArr; + } + + public int describeContents() { + return 0; + } + + public void writeToParcel(Parcel dest, int flags) { + dest.writeString(processName); + dest.writeInt(pid); + dest.writeStringArray(pkgList); + } + + public void readFromParcel(Parcel source) { + processName = source.readString(); + pid = source.readInt(); + pkgList = source.readStringArray(); + } + + public static final Creator CREATOR = + new Creator() { + public RunningAppProcessInfo createFromParcel(Parcel source) { + return new RunningAppProcessInfo(source); + } + public RunningAppProcessInfo[] newArray(int size) { + return new RunningAppProcessInfo[size]; + } + }; + + private RunningAppProcessInfo(Parcel source) { + readFromParcel(source); + } + } + + /** + * Returns a list of application processes that are running on the device. + * + * @return Returns a list of RunningAppProcessInfo records, or null if there are no + * running processes (it will not return an empty list). This list ordering is not + * specified. + */ + public List getRunningAppProcesses() { + try { + return ActivityManagerNative.getDefault().getRunningAppProcesses(); + } catch (RemoteException e) { + return null; + } + } } diff --git a/core/java/android/app/ActivityManagerNative.java b/core/java/android/app/ActivityManagerNative.java index e6f1b05f870d0..ae9f3bf15029c 100644 --- a/core/java/android/app/ActivityManagerNative.java +++ b/core/java/android/app/ActivityManagerNative.java @@ -387,6 +387,14 @@ public abstract class ActivityManagerNative extends Binder implements IActivityM reply.writeTypedList(list); return true; } + + case GET_RUNNING_APP_PROCESSES_TRANSACTION: { + data.enforceInterface(IActivityManager.descriptor); + List list = getRunningAppProcesses(); + reply.writeNoException(); + reply.writeTypedList(list); + return true; + } case MOVE_TASK_TO_FRONT_TRANSACTION: { data.enforceInterface(IActivityManager.descriptor); @@ -1314,6 +1322,19 @@ class ActivityManagerProxy implements IActivityManager reply.recycle(); return list; } + public List getRunningAppProcesses() + throws RemoteException { + Parcel data = Parcel.obtain(); + Parcel reply = Parcel.obtain(); + data.writeInterfaceToken(IActivityManager.descriptor); + mRemote.transact(GET_RUNNING_APP_PROCESSES_TRANSACTION, data, reply, 0); + reply.readException(); + ArrayList list + = reply.createTypedArrayList(ActivityManager.RunningAppProcessInfo.CREATOR); + data.recycle(); + reply.recycle(); + return list; + } public void moveTaskToFront(int task) throws RemoteException { Parcel data = Parcel.obtain(); diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java index d03a76f0ab00c..3d448a6201abc 100644 --- a/core/java/android/app/ActivityThread.java +++ b/core/java/android/app/ActivityThread.java @@ -220,7 +220,8 @@ public final class ActivityThread { mApplicationInfo = aInfo; mPackageName = aInfo.packageName; mAppDir = aInfo.sourceDir; - mResDir = aInfo.publicSourceDir; + mResDir = aInfo.uid == Process.myUid() ? aInfo.sourceDir + : aInfo.publicSourceDir; mSharedLibraries = aInfo.sharedLibraryFiles; mDataDir = aInfo.dataDir; mDataDirFile = mDataDir != null ? new File(mDataDir) : null; @@ -1057,6 +1058,7 @@ public final class ActivityThread { Activity parent; String embeddedID; Object lastNonConfigurationInstance; + HashMap lastNonConfigurationChildInstances; boolean paused; boolean stopped; boolean hideForNow; @@ -1966,6 +1968,12 @@ public final class ActivityThread { public final Activity startActivityNow(Activity parent, String id, Intent intent, ActivityInfo activityInfo, IBinder token, Bundle state) { + return startActivityNow(parent, id, intent, activityInfo, token, state, null); + } + + public final Activity startActivityNow(Activity parent, String id, + Intent intent, ActivityInfo activityInfo, IBinder token, Bundle state, + Object lastNonConfigurationInstance) { ActivityRecord r = new ActivityRecord(); r.token = token; r.intent = intent; @@ -1973,6 +1981,7 @@ public final class ActivityThread { r.parent = parent; r.embeddedID = id; r.activityInfo = activityInfo; + r.lastNonConfigurationInstance = lastNonConfigurationInstance; if (localLOGV) { ComponentName compname = intent.getComponent(); String name; @@ -2090,9 +2099,11 @@ public final class ActivityThread { Configuration config = new Configuration(mConfiguration); activity.attach(appContext, this, getInstrumentation(), r.token, app, r.intent, r.activityInfo, title, r.parent, r.embeddedID, - r.lastNonConfigurationInstance, config); + r.lastNonConfigurationInstance, r.lastNonConfigurationChildInstances, + config); r.lastNonConfigurationInstance = null; + r.lastNonConfigurationChildInstances = null; activity.mStartedActivity = false; int theme = r.activityInfo.getThemeResource(); if (theme != 0) { @@ -2948,6 +2959,17 @@ public final class ActivityThread { + ": " + e.toString(), e); } } + try { + r.lastNonConfigurationChildInstances + = r.activity.onRetainNonConfigurationChildInstances(); + } catch (Exception e) { + if (!mInstrumentation.onException(r.activity, e)) { + throw new RuntimeException( + "Unable to retain child activities " + + r.intent.getComponent().toShortString() + + ": " + e.toString(), e); + } + } } try { @@ -3225,11 +3247,7 @@ public final class ActivityThread { Locale.setDefault(config.locale); } - if (mSystemContext != null) { - mSystemContext.getResources().updateConfiguration(config, null); - //Log.i(TAG, "Updated system resources " + mSystemContext.getResources() - // + ": " + mSystemContext.getResources().getConfiguration()); - } + Resources.updateSystemConfiguration(config, null); ApplicationContext.ApplicationPackageManager.configurationChanged(); //Log.i(TAG, "Configuration changed in " + currentPackageName()); diff --git a/core/java/android/app/AlarmManager.java b/core/java/android/app/AlarmManager.java index 35c6ac1f891ed..b4c0e314cfb62 100644 --- a/core/java/android/app/AlarmManager.java +++ b/core/java/android/app/AlarmManager.java @@ -71,17 +71,13 @@ public class AlarmManager */ public static final int ELAPSED_REALTIME = 3; - private static IAlarmManager mService; + private final IAlarmManager mService; - static { - mService = IAlarmManager.Stub.asInterface( - ServiceManager.getService(Context.ALARM_SERVICE)); - } - /** * package private on purpose */ - AlarmManager() { + AlarmManager(IAlarmManager service) { + mService = service; } /** @@ -97,7 +93,7 @@ public class AlarmManager * this one. * *

    - * The alarm is an intent broadcast that goes to an intent receiver that + * The alarm is an intent broadcast that goes to a broadcast receiver that * you registered with {@link android.content.Context#registerReceiver} * or through the <receiver> tag in an AndroidManifest.xml file. * @@ -188,6 +184,72 @@ public class AlarmManager } } + /** + * Available inexact recurrence intervals recognized by + * {@link #setInexactRepeating(int, long, long, PendingIntent)} + */ + public static final long INTERVAL_FIFTEEN_MINUTES = 15 * 60 * 1000; + public static final long INTERVAL_HALF_HOUR = 2*INTERVAL_FIFTEEN_MINUTES; + public static final long INTERVAL_HOUR = 2*INTERVAL_HALF_HOUR; + public static final long INTERVAL_HALF_DAY = 12*INTERVAL_HOUR; + public static final long INTERVAL_DAY = 2*INTERVAL_HALF_DAY; + + /** + * Schedule a repeating alarm that has inexact trigger time requirements; + * for example, an alarm that repeats every hour, but not necessarily at + * the top of every hour. These alarms are more power-efficient than + * the strict recurrences supplied by {@link #setRepeating}, since the + * system can adjust alarms' phase to cause them to fire simultaneously, + * avoiding waking the device from sleep more than necessary. + * + *

    Your alarm's first trigger will not be before the requested time, + * but it might not occur for almost a full interval after that time. In + * addition, while the overall period of the repeating alarm will be as + * requested, the time between any two successive firings of the alarm + * may vary. If your application demands very low jitter, use + * {@link #setRepeating} instead. + * + * @param type One of ELAPSED_REALTIME, ELAPSED_REALTIME_WAKEUP}, RTC or + * RTC_WAKEUP. + * @param triggerAtTime Time the alarm should first go off, using the + * appropriate clock (depending on the alarm type). This + * is inexact: the alarm will not fire before this time, + * but there may be a delay of almost an entire alarm + * interval before the first invocation of the alarm. + * @param interval Interval between subsequent repeats of the alarm. If + * this is one of INTERVAL_FIFTEEN_MINUTES, INTERVAL_HALF_HOUR, + * INTERVAL_HOUR, INTERVAL_HALF_DAY, or INTERVAL_DAY then the + * alarm will be phase-aligned with other alarms to reduce + * the number of wakeups. Otherwise, the alarm will be set + * as though the application had called {@link #setRepeating}. + * @param operation Action to perform when the alarm goes off; + * typically comes from {@link PendingIntent#getBroadcast + * IntentSender.getBroadcast()}. + * + * @see android.os.Handler + * @see #set + * @see #cancel + * @see android.content.Context#sendBroadcast + * @see android.content.Context#registerReceiver + * @see android.content.Intent#filterEquals + * @see #ELAPSED_REALTIME + * @see #ELAPSED_REALTIME_WAKEUP + * @see #RTC + * @see #RTC_WAKEUP + * @see #INTERVAL_FIFTEEN_MINUTES + * @see #INTERVAL_HALF_HOUR + * @see #INTERVAL_HOUR + * @see #INTERVAL_HALF_DAY + * @see #INTERVAL_DAY + */ + public void setInexactRepeating(int type, long triggerAtTime, long interval, + PendingIntent operation) { + try { + mService.setInexactRepeating(type, triggerAtTime, interval, operation); + } catch (RemoteException ex) { + } + } + /** * Remove any alarms with a matching {@link Intent}. * Any alarm, of any type, whose Intent matches this one (as defined by diff --git a/core/java/android/app/AlertDialog.java b/core/java/android/app/AlertDialog.java index cc80ba404f303..a6981a5c95999 100644 --- a/core/java/android/app/AlertDialog.java +++ b/core/java/android/app/AlertDialog.java @@ -25,6 +25,7 @@ import android.os.Message; import android.view.KeyEvent; import android.view.View; import android.widget.AdapterView; +import android.widget.Button; import android.widget.ListAdapter; import android.widget.ListView; @@ -59,6 +60,29 @@ public class AlertDialog extends Dialog implements DialogInterface { setOnCancelListener(cancelListener); mAlert = new AlertController(context, this, getWindow()); } + + /** + * Gets one of the buttons used in the dialog. + *

    + * If a button does not exist in the dialog, null will be returned. + * + * @param whichButton The identifier of the button that should be returned. + * For example, this can be + * {@link DialogInterface#BUTTON_POSITIVE}. + * @return The button from the dialog, or null if a button does not exist. + */ + public Button getButton(int whichButton) { + return mAlert.getButton(whichButton); + } + + /** + * Gets the list view used in the dialog. + * + * @return The {@link ListView} from the dialog. + */ + public ListView getListView() { + return mAlert.getListView(); + } @Override public void setTitle(CharSequence title) { @@ -83,44 +107,115 @@ public class AlertDialog extends Dialog implements DialogInterface { public void setView(View view) { mAlert.setView(view); } + + /** + * Set the view to display in that dialog, specifying the spacing to appear around that + * view. + * + * @param view The view to show in the content area of the dialog + * @param viewSpacingLeft Extra space to appear to the left of {@code view} + * @param viewSpacingTop Extra space to appear above {@code view} + * @param viewSpacingRight Extra space to appear to the right of {@code view} + * @param viewSpacingBottom Extra space to appear below {@code view} + */ + public void setView(View view, int viewSpacingLeft, int viewSpacingTop, int viewSpacingRight, + int viewSpacingBottom) { + mAlert.setView(view, viewSpacingLeft, viewSpacingTop, viewSpacingRight, viewSpacingBottom); + } - public void setButton(CharSequence text, Message msg) { - mAlert.setButton(text, msg); + /** + * Set a message to be sent when a button is pressed. + * + * @param whichButton Which button to set the message for, can be one of + * {@link DialogInterface#BUTTON_POSITIVE}, + * {@link DialogInterface#BUTTON_NEGATIVE}, or + * {@link DialogInterface#BUTTON_NEUTRAL} + * @param text The text to display in positive button. + * @param msg The {@link Message} to be sent when clicked. + */ + public void setButton(int whichButton, CharSequence text, Message msg) { + mAlert.setButton(whichButton, text, null, msg); + } + + /** + * Set a listener to be invoked when the positive button of the dialog is pressed. + * + * @param whichButton Which button to set the listener on, can be one of + * {@link DialogInterface#BUTTON_POSITIVE}, + * {@link DialogInterface#BUTTON_NEGATIVE}, or + * {@link DialogInterface#BUTTON_NEUTRAL} + * @param text The text to display in positive button. + * @param listener The {@link DialogInterface.OnClickListener} to use. + */ + public void setButton(int whichButton, CharSequence text, OnClickListener listener) { + mAlert.setButton(whichButton, text, listener, null); } + /** + * @deprecated Use {@link #setButton(int, CharSequence, Message)} with + * {@link DialogInterface#BUTTON_POSITIVE}. + */ + @Deprecated + public void setButton(CharSequence text, Message msg) { + setButton(BUTTON_POSITIVE, text, msg); + } + + /** + * @deprecated Use {@link #setButton(int, CharSequence, Message)} with + * {@link DialogInterface#BUTTON_NEGATIVE}. + */ + @Deprecated public void setButton2(CharSequence text, Message msg) { - mAlert.setButton2(text, msg); + setButton(BUTTON_NEGATIVE, text, msg); } + /** + * @deprecated Use {@link #setButton(int, CharSequence, Message)} with + * {@link DialogInterface#BUTTON_NEUTRAL}. + */ + @Deprecated public void setButton3(CharSequence text, Message msg) { - mAlert.setButton3(text, msg); + setButton(BUTTON_NEUTRAL, text, msg); } /** * Set a listener to be invoked when button 1 of the dialog is pressed. + * * @param text The text to display in button 1. * @param listener The {@link DialogInterface.OnClickListener} to use. + * @deprecated Use + * {@link #setButton(int, CharSequence, android.content.DialogInterface.OnClickListener)} + * with {@link DialogInterface#BUTTON_POSITIVE} */ + @Deprecated public void setButton(CharSequence text, final OnClickListener listener) { - mAlert.setButton(text, listener); + setButton(BUTTON_POSITIVE, text, listener); } /** * Set a listener to be invoked when button 2 of the dialog is pressed. * @param text The text to display in button 2. * @param listener The {@link DialogInterface.OnClickListener} to use. + * @deprecated Use + * {@link #setButton(int, CharSequence, android.content.DialogInterface.OnClickListener)} + * with {@link DialogInterface#BUTTON_NEGATIVE} */ + @Deprecated public void setButton2(CharSequence text, final OnClickListener listener) { - mAlert.setButton2(text, listener); + setButton(BUTTON_NEGATIVE, text, listener); } /** * Set a listener to be invoked when button 3 of the dialog is pressed. * @param text The text to display in button 3. * @param listener The {@link DialogInterface.OnClickListener} to use. + * @deprecated Use + * {@link #setButton(int, CharSequence, android.content.DialogInterface.OnClickListener)} + * with {@link DialogInterface#BUTTON_POSITIVE} */ + @Deprecated public void setButton3(CharSequence text, final OnClickListener listener) { - mAlert.setButton3(text, listener); + setButton(BUTTON_NEUTRAL, text, listener); } /** @@ -170,6 +265,8 @@ public class AlertDialog extends Dialog implements DialogInterface { /** * Set the title using the given resource id. + * + * @return This Builder object to allow for chaining of calls to set methods */ public Builder setTitle(int titleId) { P.mTitle = P.mContext.getText(titleId); @@ -178,6 +275,8 @@ public class AlertDialog extends Dialog implements DialogInterface { /** * Set the title displayed in the {@link Dialog}. + * + * @return This Builder object to allow for chaining of calls to set methods */ public Builder setTitle(CharSequence title) { P.mTitle = title; @@ -192,6 +291,8 @@ public class AlertDialog extends Dialog implements DialogInterface { * via the other methods. * * @param customTitleView The custom view to use as the title. + * + * @return This Builder object to allow for chaining of calls to set methods */ public Builder setCustomTitle(View customTitleView) { P.mCustomTitleView = customTitleView; @@ -200,6 +301,8 @@ public class AlertDialog extends Dialog implements DialogInterface { /** * Set the message to display using the given resource id. + * + * @return This Builder object to allow for chaining of calls to set methods */ public Builder setMessage(int messageId) { P.mMessage = P.mContext.getText(messageId); @@ -208,6 +311,8 @@ public class AlertDialog extends Dialog implements DialogInterface { /** * Set the message to display. + * + * @return This Builder object to allow for chaining of calls to set methods */ public Builder setMessage(CharSequence message) { P.mMessage = message; @@ -216,6 +321,8 @@ public class AlertDialog extends Dialog implements DialogInterface { /** * Set the resource id of the {@link Drawable} to be used in the title. + * + * @return This Builder object to allow for chaining of calls to set methods */ public Builder setIcon(int iconId) { P.mIconId = iconId; @@ -224,6 +331,8 @@ public class AlertDialog extends Dialog implements DialogInterface { /** * Set the {@link Drawable} to be used in the title. + * + * @return This Builder object to allow for chaining of calls to set methods */ public Builder setIcon(Drawable icon) { P.mIcon = icon; @@ -234,6 +343,8 @@ public class AlertDialog extends Dialog implements DialogInterface { * Set a listener to be invoked when the positive button of the dialog is pressed. * @param textId The resource id of the text to display in the positive button * @param listener The {@link DialogInterface.OnClickListener} to use. + * + * @return This Builder object to allow for chaining of calls to set methods */ public Builder setPositiveButton(int textId, final OnClickListener listener) { P.mPositiveButtonText = P.mContext.getText(textId); @@ -245,6 +356,8 @@ public class AlertDialog extends Dialog implements DialogInterface { * Set a listener to be invoked when the positive button of the dialog is pressed. * @param text The text to display in the positive button * @param listener The {@link DialogInterface.OnClickListener} to use. + * + * @return This Builder object to allow for chaining of calls to set methods */ public Builder setPositiveButton(CharSequence text, final OnClickListener listener) { P.mPositiveButtonText = text; @@ -256,6 +369,8 @@ public class AlertDialog extends Dialog implements DialogInterface { * Set a listener to be invoked when the negative button of the dialog is pressed. * @param textId The resource id of the text to display in the negative button * @param listener The {@link DialogInterface.OnClickListener} to use. + * + * @return This Builder object to allow for chaining of calls to set methods */ public Builder setNegativeButton(int textId, final OnClickListener listener) { P.mNegativeButtonText = P.mContext.getText(textId); @@ -267,6 +382,8 @@ public class AlertDialog extends Dialog implements DialogInterface { * Set a listener to be invoked when the negative button of the dialog is pressed. * @param text The text to display in the negative button * @param listener The {@link DialogInterface.OnClickListener} to use. + * + * @return This Builder object to allow for chaining of calls to set methods */ public Builder setNegativeButton(CharSequence text, final OnClickListener listener) { P.mNegativeButtonText = text; @@ -278,6 +395,8 @@ public class AlertDialog extends Dialog implements DialogInterface { * Set a listener to be invoked when the neutral button of the dialog is pressed. * @param textId The resource id of the text to display in the neutral button * @param listener The {@link DialogInterface.OnClickListener} to use. + * + * @return This Builder object to allow for chaining of calls to set methods */ public Builder setNeutralButton(int textId, final OnClickListener listener) { P.mNeutralButtonText = P.mContext.getText(textId); @@ -289,6 +408,8 @@ public class AlertDialog extends Dialog implements DialogInterface { * Set a listener to be invoked when the neutral button of the dialog is pressed. * @param text The text to display in the neutral button * @param listener The {@link DialogInterface.OnClickListener} to use. + * + * @return This Builder object to allow for chaining of calls to set methods */ public Builder setNeutralButton(CharSequence text, final OnClickListener listener) { P.mNeutralButtonText = text; @@ -298,6 +419,8 @@ public class AlertDialog extends Dialog implements DialogInterface { /** * Sets whether the dialog is cancelable or not default is true. + * + * @return This Builder object to allow for chaining of calls to set methods */ public Builder setCancelable(boolean cancelable) { P.mCancelable = cancelable; @@ -307,6 +430,8 @@ public class AlertDialog extends Dialog implements DialogInterface { /** * Sets the callback that will be called if the dialog is canceled. * @see #setCancelable(boolean) + * + * @return This Builder object to allow for chaining of calls to set methods */ public Builder setOnCancelListener(OnCancelListener onCancelListener) { P.mOnCancelListener = onCancelListener; @@ -315,6 +440,8 @@ public class AlertDialog extends Dialog implements DialogInterface { /** * Sets the callback that will be called if a key is dispatched to the dialog. + * + * @return This Builder object to allow for chaining of calls to set methods */ public Builder setOnKeyListener(OnKeyListener onKeyListener) { P.mOnKeyListener = onKeyListener; @@ -324,6 +451,8 @@ public class AlertDialog extends Dialog implements DialogInterface { /** * Set a list of items to be displayed in the dialog as the content, you will be notified of the * selected item via the supplied listener. This should be an array type i.e. R.array.foo + * + * @return This Builder object to allow for chaining of calls to set methods */ public Builder setItems(int itemsId, final OnClickListener listener) { P.mItems = P.mContext.getResources().getTextArray(itemsId); @@ -334,6 +463,8 @@ public class AlertDialog extends Dialog implements DialogInterface { /** * Set a list of items to be displayed in the dialog as the content, you will be notified of the * selected item via the supplied listener. + * + * @return This Builder object to allow for chaining of calls to set methods */ public Builder setItems(CharSequence[] items, final OnClickListener listener) { P.mItems = items; @@ -348,6 +479,8 @@ public class AlertDialog extends Dialog implements DialogInterface { * * @param adapter The {@link ListAdapter} to supply the list of items * @param listener The listener that will be called when an item is clicked. + * + * @return This Builder object to allow for chaining of calls to set methods */ public Builder setAdapter(final ListAdapter adapter, final OnClickListener listener) { P.mAdapter = adapter; @@ -364,6 +497,8 @@ public class AlertDialog extends Dialog implements DialogInterface { * @param listener The listener that will be called when an item is clicked. * @param labelColumn The column name on the cursor containing the string to display * in the label. + * + * @return This Builder object to allow for chaining of calls to set methods */ public Builder setCursor(final Cursor cursor, final OnClickListener listener, String labelColumn) { @@ -388,6 +523,8 @@ public class AlertDialog extends Dialog implements DialogInterface { * @param listener notified when an item on the list is clicked. The dialog will not be * dismissed when an item is clicked. It will only be dismissed if clicked on a * button, if no buttons are supplied it's up to the user to dismiss the dialog. + * + * @return This Builder object to allow for chaining of calls to set methods */ public Builder setMultiChoiceItems(int itemsId, boolean[] checkedItems, final OnMultiChoiceClickListener listener) { @@ -412,6 +549,8 @@ public class AlertDialog extends Dialog implements DialogInterface { * @param listener notified when an item on the list is clicked. The dialog will not be * dismissed when an item is clicked. It will only be dismissed if clicked on a * button, if no buttons are supplied it's up to the user to dismiss the dialog. + * + * @return This Builder object to allow for chaining of calls to set methods */ public Builder setMultiChoiceItems(CharSequence[] items, boolean[] checkedItems, final OnMultiChoiceClickListener listener) { @@ -438,6 +577,8 @@ public class AlertDialog extends Dialog implements DialogInterface { * @param listener notified when an item on the list is clicked. The dialog will not be * dismissed when an item is clicked. It will only be dismissed if clicked on a * button, if no buttons are supplied it's up to the user to dismiss the dialog. + * + * @return This Builder object to allow for chaining of calls to set methods */ public Builder setMultiChoiceItems(Cursor cursor, String isCheckedColumn, String labelColumn, final OnMultiChoiceClickListener listener) { @@ -461,6 +602,8 @@ public class AlertDialog extends Dialog implements DialogInterface { * @param listener notified when an item on the list is clicked. The dialog will not be * dismissed when an item is clicked. It will only be dismissed if clicked on a * button, if no buttons are supplied it's up to the user to dismiss the dialog. + * + * @return This Builder object to allow for chaining of calls to set methods */ public Builder setSingleChoiceItems(int itemsId, int checkedItem, final OnClickListener listener) { @@ -484,6 +627,8 @@ public class AlertDialog extends Dialog implements DialogInterface { * @param listener notified when an item on the list is clicked. The dialog will not be * dismissed when an item is clicked. It will only be dismissed if clicked on a * button, if no buttons are supplied it's up to the user to dismiss the dialog. + * + * @return This Builder object to allow for chaining of calls to set methods */ public Builder setSingleChoiceItems(Cursor cursor, int checkedItem, String labelColumn, final OnClickListener listener) { @@ -506,6 +651,8 @@ public class AlertDialog extends Dialog implements DialogInterface { * @param listener notified when an item on the list is clicked. The dialog will not be * dismissed when an item is clicked. It will only be dismissed if clicked on a * button, if no buttons are supplied it's up to the user to dismiss the dialog. + * + * @return This Builder object to allow for chaining of calls to set methods */ public Builder setSingleChoiceItems(CharSequence[] items, int checkedItem, final OnClickListener listener) { P.mItems = items; @@ -526,6 +673,8 @@ public class AlertDialog extends Dialog implements DialogInterface { * @param listener notified when an item on the list is clicked. The dialog will not be * dismissed when an item is clicked. It will only be dismissed if clicked on a * button, if no buttons are supplied it's up to the user to dismiss the dialog. + * + * @return This Builder object to allow for chaining of calls to set methods */ public Builder setSingleChoiceItems(ListAdapter adapter, int checkedItem, final OnClickListener listener) { P.mAdapter = adapter; @@ -540,6 +689,8 @@ public class AlertDialog extends Dialog implements DialogInterface { * * @param listener The listener to be invoked. * @see AdapterView#setOnItemSelectedListener(android.widget.AdapterView.OnItemSelectedListener) + * + * @return This Builder object to allow for chaining of calls to set methods */ public Builder setOnItemSelectedListener(final AdapterView.OnItemSelectedListener listener) { P.mOnItemSelectedListener = listener; @@ -549,9 +700,44 @@ public class AlertDialog extends Dialog implements DialogInterface { /** * Set a custom view to be the contents of the Dialog. If the supplied view is an instance * of a {@link ListView} the light background will be used. + * + * @param view The view to use as the contents of the Dialog. + * + * @return This Builder object to allow for chaining of calls to set methods */ public Builder setView(View view) { P.mView = view; + P.mViewSpacingSpecified = false; + return this; + } + + /** + * Set a custom view to be the contents of the Dialog, specifying the + * spacing to appear around that view. If the supplied view is an + * instance of a {@link ListView} the light background will be used. + * + * @param view The view to use as the contents of the Dialog. + * @param viewSpacingLeft Spacing between the left edge of the view and + * the dialog frame + * @param viewSpacingTop Spacing between the top edge of the view and + * the dialog frame + * @param viewSpacingRight Spacing between the right edge of the view + * and the dialog frame + * @param viewSpacingBottom Spacing between the bottom edge of the view + * and the dialog frame + * @return This Builder object to allow for chaining of calls to set + * methods + * + * @hide pending API review + */ + public Builder setView(View view, int viewSpacingLeft, int viewSpacingTop, + int viewSpacingRight, int viewSpacingBottom) { + P.mView = view; + P.mViewSpacingSpecified = true; + P.mViewSpacingLeft = viewSpacingLeft; + P.mViewSpacingTop = viewSpacingTop; + P.mViewSpacingRight = viewSpacingRight; + P.mViewSpacingBottom = viewSpacingBottom; return this; } @@ -560,7 +746,8 @@ public class AlertDialog extends Dialog implements DialogInterface { * contents is. * * @param useInverseBackground Whether to use the inverse background - * @return This Builder object to allow for chaining of sets. + * + * @return This Builder object to allow for chaining of calls to set methods */ public Builder setInverseBackgroundForced(boolean useInverseBackground) { P.mForceInverseBackground = useInverseBackground; diff --git a/core/java/android/app/ApplicationContext.java b/core/java/android/app/ApplicationContext.java index 342ffcf962e5f..0e41ae6f2faf3 100644 --- a/core/java/android/app/ApplicationContext.java +++ b/core/java/android/app/ApplicationContext.java @@ -87,6 +87,7 @@ import android.util.Log; import android.view.ContextThemeWrapper; import android.view.LayoutInflater; import android.view.WindowManagerImpl; +import android.view.inputmethod.InputMethodManager; import com.android.internal.policy.PolicyManager; @@ -104,6 +105,8 @@ import java.util.List; import java.util.Map; import java.util.Map.Entry; +import org.xmlpull.v1.XmlPullParserException; + class ReceiverRestrictedContext extends ContextWrapper { ReceiverRestrictedContext(Context base) { super(base); @@ -139,12 +142,12 @@ class ReceiverRestrictedContext extends ContextWrapper { * Common implementation of Context API, which Activity and other application * classes inherit. */ -@SuppressWarnings({"EmptyCatchBlock"}) class ApplicationContext extends Context { private final static String TAG = "ApplicationContext"; private final static boolean DEBUG_ICONS = false; private static final Object sSync = new Object(); + private static AlarmManager sAlarmManager; private static PowerManager sPowerManager; private static ConnectivityManager sConnectivityManager; private static WifiManager sWifiManager; @@ -288,12 +291,15 @@ class ApplicationContext extends Context { } throw new RuntimeException("Not supported in system context"); } + + private static File makeBackupFile(File prefsFile) { + return new File(prefsFile.getPath() + ".bak"); + } @Override public SharedPreferences getSharedPreferences(String name, int mode) { - File f; - f = makeFilename(getPreferencesDir(), name + ".xml"); SharedPreferencesImpl sp; + File f = makeFilename(getPreferencesDir(), name + ".xml"); synchronized (sSharedPrefs) { sp = sSharedPrefs.get(f); if (sp != null && !sp.hasFileChanged()) { @@ -301,15 +307,27 @@ class ApplicationContext extends Context { return sp; } } + + FileInputStream str = null; + File backup = makeBackupFile(f); + if (backup.exists()) { + f.delete(); + backup.renameTo(f); + } Map map = null; - try { - FileInputStream str = new FileInputStream(f); - map = XmlUtils.readMapXml(str); - str.close(); - } catch (org.xmlpull.v1.XmlPullParserException e) { - } catch (java.io.FileNotFoundException e) { - } catch (java.io.IOException e) { + if (f.exists()) { + try { + str = new FileInputStream(f); + map = XmlUtils.readMapXml(str); + str.close(); + } catch (org.xmlpull.v1.XmlPullParserException e) { + Log.w(TAG, "getSharedPreferences", e); + } catch (FileNotFoundException e) { + Log.w(TAG, "getSharedPreferences", e); + } catch (IOException e) { + Log.w(TAG, "getSharedPreferences", e); + } } synchronized (sSharedPrefs) { @@ -350,7 +368,7 @@ class ApplicationContext extends Context { File f = makeFilename(getFilesDir(), name); try { FileOutputStream fos = new FileOutputStream(f, append); - setFilePermissionsFromMode(f.toString(), mode, 0); + setFilePermissionsFromMode(f.getPath(), mode, 0); return fos; } catch (FileNotFoundException e) { } @@ -358,11 +376,11 @@ class ApplicationContext extends Context { File parent = f.getParentFile(); parent.mkdir(); FileUtils.setPermissions( - parent.toString(), + parent.getPath(), FileUtils.S_IRWXU|FileUtils.S_IRWXG|FileUtils.S_IXOTH, -1, -1); FileOutputStream fos = new FileOutputStream(f, append); - setFilePermissionsFromMode(f.toString(), mode, 0); + setFilePermissionsFromMode(f.getPath(), mode, 0); return fos; } @@ -378,6 +396,16 @@ class ApplicationContext extends Context { if (mFilesDir == null) { mFilesDir = new File(getDataDirFile(), "files"); } + if (!mFilesDir.exists()) { + if(!mFilesDir.mkdirs()) { + Log.w(TAG, "Unable to create files directory"); + return null; + } + FileUtils.setPermissions( + mFilesDir.getPath(), + FileUtils.S_IRWXU|FileUtils.S_IRWXG|FileUtils.S_IXOTH, + -1, -1); + } return mFilesDir; } } @@ -394,7 +422,7 @@ class ApplicationContext extends Context { return null; } FileUtils.setPermissions( - mCacheDir.toString(), + mCacheDir.getPath(), FileUtils.S_IRWXU|FileUtils.S_IRWXG|FileUtils.S_IXOTH, -1, -1); } @@ -418,14 +446,14 @@ class ApplicationContext extends Context { public SQLiteDatabase openOrCreateDatabase(String name, int mode, CursorFactory factory) { File dir = getDatabasesDir(); if (!dir.isDirectory() && dir.mkdir()) { - FileUtils.setPermissions(dir.toString(), + FileUtils.setPermissions(dir.getPath(), FileUtils.S_IRWXU|FileUtils.S_IRWXG|FileUtils.S_IXOTH, -1, -1); } File f = makeFilename(dir, name); SQLiteDatabase db = SQLiteDatabase.openOrCreateDatabase(f, factory); - setFilePermissionsFromMode(f.toString(), mode, 0); + setFilePermissionsFromMode(f.getPath(), mode, 0); return db; } @@ -844,7 +872,7 @@ class ApplicationContext extends Context { } else if (ACTIVITY_SERVICE.equals(name)) { return getActivityManager(); } else if (ALARM_SERVICE.equals(name)) { - return new AlarmManager(); + return getAlarmManager(); } else if (POWER_SERVICE.equals(name)) { return getPowerManager(); } else if (CONNECTIVITY_SERVICE.equals(name)) { @@ -878,6 +906,8 @@ class ApplicationContext extends Context { return getTelephonyManager(); } else if (CLIPBOARD_SERVICE.equals(name)) { return getClipboardManager(); + } else if (INPUT_METHOD_SERVICE.equals(name)) { + return InputMethodManager.getInstance(this); } return null; @@ -893,6 +923,17 @@ class ApplicationContext extends Context { return mActivityManager; } + private AlarmManager getAlarmManager() { + synchronized (sSync) { + if (sAlarmManager == null) { + IBinder b = ServiceManager.getService(ALARM_SERVICE); + IAlarmManager service = IAlarmManager.Stub.asInterface(b); + sAlarmManager = new AlarmManager(service); + } + } + return sAlarmManager; + } + private PowerManager getPowerManager() { synchronized (sSync) { if (sPowerManager == null) { @@ -1299,7 +1340,7 @@ class ApplicationContext extends Context { File file = makeFilename(getDataDirFile(), name); if (!file.exists()) { file.mkdir(); - setFilePermissionsFromMode(file.toString(), mode, + setFilePermissionsFromMode(file.getPath(), mode, FileUtils.S_IRWXU|FileUtils.S_IRWXG|FileUtils.S_IXOTH); } return file; @@ -1636,6 +1677,20 @@ class ApplicationContext extends Context { throw new RuntimeException("Package manager has died", e); } } + + @Override + public int getUidForSharedUser(String sharedUserName) + throws NameNotFoundException { + try { + int uid = mPM.getUidForSharedUser(sharedUserName); + if(uid != -1) { + return uid; + } + } catch (RemoteException e) { + throw new RuntimeException("Package manager has died", e); + } + throw new NameNotFoundException("No shared userid for user:"+sharedUserName); + } @Override public List getInstalledPackages(int flags) { @@ -1899,7 +1954,9 @@ class ApplicationContext extends Context { if (app.packageName.equals("system")) { return mContext.mMainThread.getSystemContext().getResources(); } - Resources r = mContext.mMainThread.getTopLevelResources(app.publicSourceDir); + Resources r = mContext.mMainThread.getTopLevelResources( + app.uid == Process.myUid() ? app.sourceDir + : app.publicSourceDir); if (r != null) { return r; } @@ -2341,6 +2398,7 @@ class ApplicationContext extends Context { private static final class SharedPreferencesImpl implements SharedPreferences { private final File mFile; + private final File mBackupFile; private final int mMode; private Map mMap; private final FileStatus mFileStatus = new FileStatus(); @@ -2351,6 +2409,7 @@ class ApplicationContext extends Context { SharedPreferencesImpl( File file, int mode, Map initialContents) { mFile = file; + mBackupFile = makeBackupFile(file); mMode = mode; mMap = initialContents != null ? initialContents : new HashMap(); if (FileUtils.getFileStatus(file.getPath(), mFileStatus)) { @@ -2544,30 +2603,68 @@ class ApplicationContext extends Context { public Editor edit() { return new EditorImpl(); } + + private FileOutputStream createFileOutputStream(File file) { + FileOutputStream str = null; + try { + str = new FileOutputStream(file); + } catch (FileNotFoundException e) { + File parent = file.getParentFile(); + if (!parent.mkdir()) { + Log.e(TAG, "Couldn't create directory for SharedPreferences file " + file); + return null; + } + FileUtils.setPermissions( + parent.getPath(), + FileUtils.S_IRWXU|FileUtils.S_IRWXG|FileUtils.S_IXOTH, + -1, -1); + try { + str = new FileOutputStream(file); + } catch (FileNotFoundException e2) { + Log.e(TAG, "Couldn't create SharedPreferences file " + file, e2); + } + } + return str; + } private boolean writeFileLocked() { + // Rename the current file so it may be used as a backup during the next read + if (mFile.exists()) { + if (!mFile.renameTo(mBackupFile)) { + Log.e(TAG, "Couldn't rename file " + mFile + " to backup file " + mBackupFile); + } + } + + // Attempt to write the file, delete the backup and return true as atomically as + // possible. If any exception occurs, delete the new file; next time we will restore + // from the backup. try { - FileOutputStream str; - try { - str = new FileOutputStream(mFile); - } catch (Exception e) { - File parent = mFile.getParentFile(); - parent.mkdir(); - FileUtils.setPermissions( - parent.toString(), - FileUtils.S_IRWXU|FileUtils.S_IRWXG|FileUtils.S_IXOTH, - -1, -1); - str = new FileOutputStream(mFile); + FileOutputStream str = createFileOutputStream(mFile); + if (str == null) { + return false; } XmlUtils.writeMapXml(mMap, str); str.close(); - setFilePermissionsFromMode(mFile.toString(), mMode, 0); + setFilePermissionsFromMode(mFile.getPath(), mMode, 0); if (FileUtils.getFileStatus(mFile.getPath(), mFileStatus)) { mTimestamp = mFileStatus.mtime; } - } catch (org.xmlpull.v1.XmlPullParserException e) { - } catch (java.io.FileNotFoundException e) { - } catch (java.io.IOException e) { + + // Writing was successful, delete the backup file + if (!mBackupFile.delete()) { + Log.e(TAG, "Couldn't delete new backup file " + mBackupFile); + } + return true; + } catch (XmlPullParserException e) { + Log.w(TAG, "writeFileLocked: Got exception:", e); + } catch (IOException e) { + Log.w(TAG, "writeFileLocked: Got exception:", e); + } + // Clean up an unsuccessfully written file + if (mFile.exists()) { + if (!mFile.delete()) { + Log.e(TAG, "Couldn't clean up partially-written file " + mFile); + } } return false; } diff --git a/core/java/android/app/DatePickerDialog.java b/core/java/android/app/DatePickerDialog.java index 7450559dcd88c..ee5e0d5b577ca 100644 --- a/core/java/android/app/DatePickerDialog.java +++ b/core/java/android/app/DatePickerDialog.java @@ -20,8 +20,8 @@ import android.content.Context; import android.content.DialogInterface; import android.content.DialogInterface.OnClickListener; import android.os.Bundle; -import android.pim.DateFormat; import android.text.TextUtils.TruncateAt; +import android.text.format.DateFormat; import android.view.LayoutInflater; import android.view.View; import android.widget.DatePicker; @@ -107,7 +107,7 @@ public class DatePickerDialog extends AlertDialog implements OnClickListener, DateFormatSymbols symbols = new DateFormatSymbols(); mWeekDays = symbols.getShortWeekdays(); - mDateFormat = DateFormat.getLongDateFormat(context); + mDateFormat = DateFormat.getMediumDateFormat(context); mCalendar = Calendar.getInstance(); updateTitle(mInitialYear, mInitialMonth, mInitialDay); diff --git a/core/java/android/app/IActivityManager.java b/core/java/android/app/IActivityManager.java index 2de21ed825570..353500e923459 100644 --- a/core/java/android/app/IActivityManager.java +++ b/core/java/android/app/IActivityManager.java @@ -213,6 +213,9 @@ public interface IActivityManager extends IInterface { * SIGUSR1 is delivered. All others are ignored. */ public void signalPersistentProcesses(int signal) throws RemoteException; + // Retrieve running application processes in the system + public List getRunningAppProcesses() + throws RemoteException; /** Information you can retrieve about a particular application. */ public static class ContentProviderHolder implements Parcelable { @@ -350,4 +353,5 @@ public interface IActivityManager extends IInterface { int KILL_PIDS_FOR_MEMORY_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+79; int GET_SERVICES_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+80; int REPORT_PSS_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+81; + int GET_RUNNING_APP_PROCESSES_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+82; } diff --git a/core/java/android/app/IAlarmManager.aidl b/core/java/android/app/IAlarmManager.aidl index c7f20b9bda7e4..cb42236f413c0 100755 --- a/core/java/android/app/IAlarmManager.aidl +++ b/core/java/android/app/IAlarmManager.aidl @@ -26,6 +26,7 @@ import android.app.PendingIntent; interface IAlarmManager { void set(int type, long triggerAtTime, in PendingIntent operation); void setRepeating(int type, long triggerAtTime, long interval, in PendingIntent operation); + void setInexactRepeating(int type, long triggerAtTime, long interval, in PendingIntent operation); void setTimeZone(String zone); void remove(in PendingIntent operation); } diff --git a/core/java/android/app/Instrumentation.java b/core/java/android/app/Instrumentation.java index f80c947efe2e4..17618ff26fd4a 100644 --- a/core/java/android/app/Instrumentation.java +++ b/core/java/android/app/Instrumentation.java @@ -40,6 +40,7 @@ import android.view.KeyEvent; import android.view.MotionEvent; import android.view.ViewConfiguration; import android.view.Window; +import android.view.inputmethod.InputMethodManager; import java.io.File; import java.util.ArrayList; @@ -1262,7 +1263,7 @@ public class Instrumentation { * @param activity The activity being paused. */ public void callActivityOnPause(Activity activity) { - activity.onPause(); + activity.performPause(); } /* @@ -1392,8 +1393,8 @@ public class Instrumentation { * if there was no Activity found to run the given Intent. * * @param who The Context from which the activity is being started. - * @param whoThread The main thread of the Context from which the activity - * is being started. + * @param contextThread The main thread of the Context from which the activity + * is being started. * @param token Internal token identifying to the system who is starting * the activity; may be null. * @param target Which activity is perform the start (and thus receiving @@ -1416,8 +1417,9 @@ public class Instrumentation { * {@hide} */ public ActivityResult execStartActivity( - Context who, IApplicationThread whoThread, IBinder token, Activity target, + Context who, IBinder contextThread, IBinder token, Activity target, Intent intent, int requestCode) { + IApplicationThread whoThread = (IApplicationThread) contextThread; if (mActivityMonitors != null) { synchronized (mSync) { final int N = mActivityMonitors.size(); diff --git a/core/java/android/app/LocalActivityManager.java b/core/java/android/app/LocalActivityManager.java index 12e70e31b3e2b..a24fcae26639c 100644 --- a/core/java/android/app/LocalActivityManager.java +++ b/core/java/android/app/LocalActivityManager.java @@ -22,9 +22,6 @@ import android.os.Binder; import android.os.Bundle; import android.util.Config; import android.util.Log; -import android.view.View; -import android.view.ViewGroup; -import android.view.ViewParent; import android.view.Window; import java.util.ArrayList; @@ -114,13 +111,21 @@ public class LocalActivityManager { } if (r.curState == INITIALIZING) { + // Get the lastNonConfigurationInstance for the activity + HashMap lastNonConfigurationInstances = + mParent.getLastNonConfigurationChildInstances(); + Object instance = null; + if (lastNonConfigurationInstances != null) { + instance = lastNonConfigurationInstances.get(r.id); + } + // We need to have always created the activity. if (localLOGV) Log.v(TAG, r.id + ": starting " + r.intent); if (r.activityInfo == null) { r.activityInfo = mActivityThread.resolveActivityInfo(r.intent); } r.activity = mActivityThread.startActivityNow( - mParent, r.id, r.intent, r.activityInfo, r, r.instanceState); + mParent, r.id, r.intent, r.activityInfo, r, r.instanceState, instance); if (r.activity == null) { return; } @@ -288,7 +293,6 @@ public class LocalActivityManager { // It's a brand new world. mActivities.put(id, r); mActivityArray.add(r); - } else if (r.activityInfo != null) { // If the new activity is the same as the current one, then // we may be able to reuse it. @@ -568,6 +572,32 @@ public class LocalActivityManager { moveToState(r, CREATED); } } + + /** + * Call onRetainNonConfigurationInstance on each child activity and store the + * results in a HashMap by id. Only construct the HashMap if there is a non-null + * object to store. Note that this does not support nested ActivityGroups. + * + * {@hide} + */ + public HashMap dispatchRetainNonConfigurationInstance() { + HashMap instanceMap = null; + + final int N = mActivityArray.size(); + for (int i=0; i(); + } + instanceMap.put(r.id, instance); + } + } + } + return instanceMap; + } /** * Remove all activities from this LocalActivityManager, performing an diff --git a/core/java/android/app/Notification.java b/core/java/android/app/Notification.java index cc5638589df38..ea67cdbd47438 100644 --- a/core/java/android/app/Notification.java +++ b/core/java/android/app/Notification.java @@ -25,9 +25,9 @@ import android.media.AudioManager; import android.net.Uri; import android.os.Parcel; import android.os.Parcelable; -import android.pim.DateFormat; -import android.pim.DateUtils; import android.text.TextUtils; +import android.text.format.DateFormat; +import android.text.format.DateUtils; import android.widget.RemoteViews; /** diff --git a/core/java/android/app/PendingIntent.java b/core/java/android/app/PendingIntent.java index ba8490379a2c2..b59e9dc435499 100644 --- a/core/java/android/app/PendingIntent.java +++ b/core/java/android/app/PendingIntent.java @@ -73,9 +73,22 @@ public final class PendingIntent implements Parcelable { * {@link #getService}: if the described PendingIntent already exists, * the current one is canceled before generating a new one. You can use * this to retrieve a new PendingIntent when you are only changing the - * extra data in the Intent. + * extra data in the Intent; by canceling the previous pending intent, + * this ensures that only entities given the new data will be able to + * launch it. If this assurance is not an issue, consider + * {@link #FLAG_UPDATE_CURRENT}. */ public static final int FLAG_CANCEL_CURRENT = 1<<28; + /** + * Flag for use with {@link #getActivity}, {@link #getBroadcast}, and + * {@link #getService}: if the described PendingIntent already exists, + * then keep it but its replace its extra data with what is in this new + * Intent. This can be used if you are creating intents where only the + * extras change, and don't care that any entities that received your + * previous PendingIntent will be able to launch it with your new + * extras even if they are not explicitly given to it. + */ + public static final int FLAG_UPDATE_CURRENT = 1<<27; /** * Exception thrown when trying to send through a PendingIntent that @@ -161,7 +174,8 @@ public final class PendingIntent implements Parcelable { * not used). * @param intent Intent of the activity to be launched. * @param flags May be {@link #FLAG_ONE_SHOT}, {@link #FLAG_NO_CREATE}, - * {@link #FLAG_CANCEL_CURRENT}, or any of the flags as supported by + * {@link #FLAG_CANCEL_CURRENT}, {@link #FLAG_UPDATE_CURRENT}, + * or any of the flags as supported by * {@link Intent#fillIn Intent.fillIn()} to control which unspecified parts * of the intent that can be supplied when the actual send happens. * @@ -195,7 +209,8 @@ public final class PendingIntent implements Parcelable { * not used). * @param intent The Intent to be broadcast. * @param flags May be {@link #FLAG_ONE_SHOT}, {@link #FLAG_NO_CREATE}, - * {@link #FLAG_CANCEL_CURRENT}, or any of the flags as supported by + * {@link #FLAG_CANCEL_CURRENT}, {@link #FLAG_UPDATE_CURRENT}, + * or any of the flags as supported by * {@link Intent#fillIn Intent.fillIn()} to control which unspecified parts * of the intent that can be supplied when the actual send happens. * @@ -230,7 +245,8 @@ public final class PendingIntent implements Parcelable { * not used). * @param intent An Intent describing the service to be started. * @param flags May be {@link #FLAG_ONE_SHOT}, {@link #FLAG_NO_CREATE}, - * {@link #FLAG_CANCEL_CURRENT}, or any of the flags as supported by + * {@link #FLAG_CANCEL_CURRENT}, {@link #FLAG_UPDATE_CURRENT}, + * or any of the flags as supported by * {@link Intent#fillIn Intent.fillIn()} to control which unspecified parts * of the intent that can be supplied when the actual send happens. * diff --git a/core/java/android/app/ProgressDialog.java b/core/java/android/app/ProgressDialog.java index 8b60cfab699dc..c87e3982b7bad 100644 --- a/core/java/android/app/ProgressDialog.java +++ b/core/java/android/app/ProgressDialog.java @@ -262,7 +262,7 @@ public class ProgressDialog extends AlertDialog { } public void setIndeterminate(boolean indeterminate) { - if (mHasStarted && (isIndeterminate() != indeterminate)) { + if (mProgress != null) { mProgress.setIndeterminate(indeterminate); } else { mIndeterminate = indeterminate; diff --git a/core/java/android/app/SearchDialog.java b/core/java/android/app/SearchDialog.java index 5f3f9eff0f643..2ce2db996b89d 100644 --- a/core/java/android/app/SearchDialog.java +++ b/core/java/android/app/SearchDialog.java @@ -16,11 +16,14 @@ package android.app; +import android.content.ActivityNotFoundException; import android.content.BroadcastReceiver; import android.content.ComponentName; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; +import android.content.pm.PackageManager; +import android.content.pm.ResolveInfo; import android.content.res.Configuration; import android.content.res.Resources; import android.content.res.Resources.NotFoundException; @@ -48,10 +51,12 @@ import android.view.WindowManager; import android.view.View.OnFocusChangeListener; import android.view.animation.Animation; import android.view.animation.AnimationUtils; +import android.view.inputmethod.InputMethodManager; +import android.view.inputmethod.EditorInfo; import android.widget.AdapterView; -import android.widget.Button; import android.widget.CursorAdapter; import android.widget.EditText; +import android.widget.ImageButton; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.ListAdapter; @@ -62,6 +67,7 @@ import android.widget.WrapperListAdapter; import android.widget.AdapterView.OnItemClickListener; import android.widget.AdapterView.OnItemSelectedListener; +import java.util.List; import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.atomic.AtomicLong; @@ -100,7 +106,7 @@ public class SearchDialog extends Dialog { private TextView mBadgeLabel; private LinearLayout mSearchEditLayout; private EditText mSearchTextField; - private Button mGoButton; + private ImageButton mGoButton; private ListView mSuggestionsList; private ViewTreeObserver mViewTreeObserver = null; @@ -130,14 +136,14 @@ public class SearchDialog extends Dialog { private String mSuggestionAction = null; private Uri mSuggestionData = null; private String mSuggestionQuery = null; - + /** * Constructor - fires it up and makes it look like the search UI. * * @param context Application Context we can use for system acess */ public SearchDialog(Context context) { - super(context, com.android.internal.R.style.Theme_Translucent); + super(context, com.android.internal.R.style.Theme_SearchBar); } /** @@ -149,21 +155,15 @@ public class SearchDialog extends Dialog { super.onCreate(savedInstanceState); Window theWindow = getWindow(); - theWindow.requestFeature(Window.FEATURE_NO_TITLE); - theWindow.setFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND, - WindowManager.LayoutParams.FLAG_DIM_BEHIND); theWindow.setGravity(Gravity.TOP|Gravity.FILL_HORIZONTAL); setContentView(com.android.internal.R.layout.search_bar); - // Note: theWindow.setBackgroundDrawable(null) does not work here - you get blackness - theWindow.setBackgroundDrawableResource(android.R.color.transparent); - theWindow.setLayout(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); WindowManager.LayoutParams lp = theWindow.getAttributes(); - lp.dimAmount = 0.5f; lp.setTitle("Search Dialog"); + lp.softInputMode = WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE; theWindow.setAttributes(lp); // get the view elements for local access @@ -171,14 +171,14 @@ public class SearchDialog extends Dialog { mBadgeLabel = (TextView) findViewById(com.android.internal.R.id.search_badge); mSearchEditLayout = (LinearLayout)findViewById(com.android.internal.R.id.search_edit_frame); mSearchTextField = (EditText) findViewById(com.android.internal.R.id.search_src_text); - mGoButton = (Button) findViewById(com.android.internal.R.id.search_go_btn); + mGoButton = (ImageButton) findViewById(com.android.internal.R.id.search_go_btn); mSuggestionsList = (ListView) findViewById(com.android.internal.R.id.search_suggest_list); // attach listeners mSearchTextField.addTextChangedListener(mTextWatcher); mSearchTextField.setOnKeyListener(mTextKeyListener); mGoButton.setOnClickListener(mGoButtonClickListener); - mGoButton.setOnKeyListener(mGoButtonKeyListener); + mGoButton.setOnKeyListener(mButtonsKeyListener); mSuggestionsList.setOnItemClickListener(mSuggestionsListItemClickListener); mSuggestionsList.setOnKeyListener(mSuggestionsKeyListener); mSuggestionsList.setOnFocusChangeListener(mSuggestFocusListener); @@ -241,6 +241,7 @@ public class SearchDialog extends Dialog { if (mSuggestionsList != null) { mSuggestionsList.setVisibility(View.GONE); // prevent any flicker if was visible } + super.show(); setupSearchableInfo(); @@ -266,6 +267,17 @@ public class SearchDialog extends Dialog { initialQuery = ""; // This forces the preload to happen, triggering suggestions } mSearchTextField.setText(initialQuery); + + // If it is not for global search, that means the search dialog is + // launched to input a web address. + if (!globalSearch) { + mSearchTextField.setRawInputType(EditorInfo.TYPE_CLASS_TEXT + | EditorInfo.TYPE_TEXT_VARIATION_URI); + } else { + mSearchTextField.setRawInputType(EditorInfo.TYPE_CLASS_TEXT + | EditorInfo.TYPE_TEXT_VARIATION_NORMAL); + } + if (selectInitialQuery) { mSearchTextField.selectAll(); } else { @@ -424,7 +436,6 @@ public class SearchDialog extends Dialog { public void onConfigurationChanged(Configuration newConfig) { if (isShowing()) { // Redraw (resources may have changed) - updateSearchButton(); updateSearchBadge(); updateQueryHint(); } @@ -439,7 +450,6 @@ public class SearchDialog extends Dialog { mActivityContext = mSearchable.getActivityContext(getContext()); mProviderContext = mSearchable.getProviderContext(getContext(), mActivityContext); - updateSearchButton(); updateSearchBadge(); updateQueryHint(); } @@ -458,18 +468,6 @@ public class SearchDialog extends Dialog { cancel(); } - /** - * Update the text in the search button - */ - private void updateSearchButton() { - int textId = mSearchable.getSearchButtonText(); - if (textId == 0) { - textId = com.android.internal.R.string.search_go; - } - String goText = mActivityContext.getResources().getString(textId); - mGoButton.setText(goText); - } - /** * Setup the search "Badge" if request by mode flags. */ @@ -1031,9 +1029,10 @@ public class SearchDialog extends Dialog { } /** - * React to typing in the GO button by refocusing to EditText. Continue typing the query. + * React to typing in the GO search button by refocusing to EditText. + * Continue typing the query. */ - View.OnKeyListener mGoButtonKeyListener = new View.OnKeyListener() { + View.OnKeyListener mButtonsKeyListener = new View.OnKeyListener() { public boolean onKey(View v, int keyCode, KeyEvent event) { // also guard against possible race conditions (late arrival after dismiss) if (mSearchable != null) { @@ -1054,7 +1053,7 @@ public class SearchDialog extends Dialog { } } }; - + /** * React to the user typing "enter" or other hardwired keys while typing in the search box. * This handles these special keys while the edit box has focus. diff --git a/core/java/android/app/SearchManager.java b/core/java/android/app/SearchManager.java index 01babc45bd437..5f25b90601677 100644 --- a/core/java/android/app/SearchManager.java +++ b/core/java/android/app/SearchManager.java @@ -48,6 +48,7 @@ import android.view.KeyEvent; *

  • Action Keys *
  • Searchability Metadata *
  • Passing Search Context + *
  • Protecting User Privacy * * * @@ -578,7 +579,7 @@ import android.view.KeyEvent; * file. Each element defines one of the keycodes you are interested in, * defines the conditions under which they are sent, and provides details * on how to communicate the action key event back to your searchable activity.
  • - *
  • In your intent receiver, if you wish, you can check for action keys by checking the + *
  • In your broadcast receiver, if you wish, you can check for action keys by checking the * extras field of the {@link android.content.Intent Intent}.
  • * * @@ -974,6 +975,36 @@ import android.view.KeyEvent; * appData.get...(); * appData.get...(); * } + * + * + *

    Protecting User Privacy

    + * + *

    Many users consider their activities on the phone, including searches, to be private + * information. Applications that implement search should take steps to protect users' privacy + * wherever possible. This section covers two areas of concern, but you should consider your search + * design carefully and take any additional steps necessary. + * + *

    Don't send personal information to servers, and if you do, don't log it. + * "Personal information" is information that can personally identify your users, such as name, + * email address or billing information, or other data which can be reasonably linked to such + * information. If your application implements search with the assistance of a server, try to + * avoid sending personal information with your searches. For example, if you are searching for + * businesses near a zip code, you don't need to send the user ID as well - just send the zip code + * to the server. If you do need to send personal information, you should take steps to avoid + * logging it. If you must log it, you should protect that data very carefully, and erase it as + * soon as possible. + * + *

    Provide the user with a way to clear their search history. The Search Manager helps + * your application provide context-specific suggestions. Sometimes these suggestions are based + * on previous searches, or other actions taken by the user in an earlier session. A user may not + * wish for previous searches to be revealed to other users, for instance if they share their phone + * with a friend. If your application provides suggestions that can reveal previous activities, + * you should implement a "Clear History" menu, preference, or button. If you are using + * {@link android.provider.SearchRecentSuggestions}, you can simply call its + * {@link android.provider.SearchRecentSuggestions#clearHistory() clearHistory()} method from + * your "Clear History" UI. If you are implementing your own form of recent suggestions, you'll + * need to provide a similar a "clear history" API in your provider, and call it from your + * "Clear History" UI. */ public class SearchManager implements DialogInterface.OnDismissListener, DialogInterface.OnCancelListener @@ -1008,6 +1039,16 @@ public class SearchManager * activity that launched the search. */ public final static String APP_DATA = "app_data"; + + /** + * Intent app_data bundle key: Use this key with the bundle from + * {@link android.content.Intent#getBundleExtra + * content.Intent.getBundleExtra(APP_DATA)} to obtain the source identifier + * set by the activity that launched the search. + * + * @hide + */ + public final static String SOURCE = "source"; /** * Intent extra data key: Use this key with Intent.ACTION_SEARCH and diff --git a/core/java/android/app/Service.java b/core/java/android/app/Service.java index 28b06153a56f5..6c08e750c7d7a 100644 --- a/core/java/android/app/Service.java +++ b/core/java/android/app/Service.java @@ -163,7 +163,6 @@ public abstract class Service extends ContextWrapper implements ComponentCallbac /** * Called by the system when the service is first created. Do not call this method directly. - * If you override this method, be sure to call super.onCreate(). */ public void onCreate() { } @@ -172,7 +171,6 @@ public abstract class Service extends ContextWrapper implements ComponentCallbac * Called by the system every time a client explicitly starts the service by calling * {@link android.content.Context#startService}, providing the arguments it supplied and a * unique integer token representing the start request. Do not call this method directly. - * If you override this method, be sure to call super.onStart(). * * @param intent The Intent supplied to {@link android.content.Context#startService}, * as given. @@ -189,7 +187,6 @@ public abstract class Service extends ContextWrapper implements ComponentCallbac * service should clean up an resources it holds (threads, registered * receivers, etc) at this point. Upon return, there will be no more calls * in to this Service object and it is effectively dead. Do not call this method directly. - * If you override this method, be sure to call super.onDestroy(). */ public void onDestroy() { } @@ -375,4 +372,3 @@ public abstract class Service extends ContextWrapper implements ComponentCallbac private Application mApplication = null; private IActivityManager mActivityManager = null; } - diff --git a/core/java/android/app/TimePickerDialog.java b/core/java/android/app/TimePickerDialog.java index 107532e79bbf0..002b01f69eec3 100644 --- a/core/java/android/app/TimePickerDialog.java +++ b/core/java/android/app/TimePickerDialog.java @@ -20,7 +20,7 @@ import android.content.Context; import android.content.DialogInterface; import android.content.DialogInterface.OnClickListener; import android.os.Bundle; -import android.pim.DateFormat; +import android.text.format.DateFormat; import android.view.LayoutInflater; import android.view.View; import android.widget.TimePicker; diff --git a/core/java/android/bluetooth/BluetoothA2dp.java b/core/java/android/bluetooth/BluetoothA2dp.java new file mode 100644 index 0000000000000..d6ea889e8c912 --- /dev/null +++ b/core/java/android/bluetooth/BluetoothA2dp.java @@ -0,0 +1,181 @@ +/* + * Copyright (C) 2008 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.bluetooth; + +import android.annotation.SdkConstant; +import android.annotation.SdkConstant.SdkConstantType; +import android.server.BluetoothA2dpService; +import android.content.Context; +import android.os.ServiceManager; +import android.os.RemoteException; +import android.os.IBinder; +import android.util.Log; + +import java.util.List; + +/** + * Public API for controlling the Bluetooth A2DP Profile Service. + * + * BluetoothA2dp is a proxy object for controlling the Bluetooth A2DP + * Service via IPC. + * + * Creating a BluetoothA2dp object will initiate a binding with the + * BluetoothHeadset service. Users of this object should call close() when they + * are finished, so that this proxy object can unbind from the service. + * + * Currently the BluetoothA2dp service runs in the system server and this + * proxy object will be immediately bound to the service on construction. + * However this may change in future releases, and error codes such as + * BluetoothError.ERROR_IPC_NOT_READY will be returned from this API when the + * proxy object is not yet attached. + * + * Currently this class provides methods to connect to A2DP audio sinks. + * + * @hide + */ +public class BluetoothA2dp { + private static final String TAG = "BluetoothA2dp"; + + /** int extra for SINK_STATE_CHANGED_ACTION */ + public static final String SINK_STATE = + "android.bluetooth.a2dp.intent.SINK_STATE"; + /** int extra for SINK_STATE_CHANGED_ACTION */ + public static final String SINK_PREVIOUS_STATE = + "android.bluetooth.a2dp.intent.SINK_PREVIOUS_STATE"; + + /** Indicates the state of an A2DP audio sink has changed. + * This intent will always contain SINK_STATE, SINK_PREVIOUS_STATE and + * BluetoothIntent.ADDRESS extras. + */ + @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) + public static final String SINK_STATE_CHANGED_ACTION = + "android.bluetooth.a2dp.intent.action.SINK_STATE_CHANGED"; + + public static final int STATE_DISCONNECTED = 0; + public static final int STATE_CONNECTING = 1; + public static final int STATE_CONNECTED = 2; + public static final int STATE_DISCONNECTING = 3; + /** Playing implies connected */ + public static final int STATE_PLAYING = 4; + + private final IBluetoothA2dp mService; + private final Context mContext; + + /** + * Create a BluetoothA2dp proxy object for interacting with the local + * Bluetooth A2DP service. + * @param c Context + */ + public BluetoothA2dp(Context c) { + mContext = c; + IBinder b = ServiceManager.getService(BluetoothA2dpService.BLUETOOTH_A2DP_SERVICE); + if (b == null) { + throw new RuntimeException("Bluetooth A2DP service not available!"); + } + mService = IBluetoothA2dp.Stub.asInterface(b); + } + + /** Initiate a connection to an A2DP sink. + * Listen for A2DP_SINK_STATE_CHANGED_ACTION to find out when the + * connection is completed. + * @param address Remote BT address. + * @return Result code, negative indicates an immediate error. + * @hide + */ + public int connectSink(String address) { + try { + return mService.connectSink(address); + } catch (RemoteException e) { + Log.w(TAG, "", e); + return BluetoothError.ERROR_IPC; + } + } + + /** Initiate disconnect from an A2DP sink. + * Listen for A2DP_SINK_STATE_CHANGED_ACTION to find out when + * disconnect is completed. + * @param address Remote BT address. + * @return Result code, negative indicates an immediate error. + * @hide + */ + public int disconnectSink(String address) { + try { + return mService.disconnectSink(address); + } catch (RemoteException e) { + Log.w(TAG, "", e); + return BluetoothError.ERROR_IPC; + } + } + + /** Check if a specified A2DP sink is connected. + * @param address Remote BT address. + * @return True if connected (or playing), false otherwise and on error. + * @hide + */ + public boolean isSinkConnected(String address) { + int state = getSinkState(address); + return state == STATE_CONNECTED || state == STATE_PLAYING; + } + + /** Check if any A2DP sink is connected. + * @return a List of connected A2DP sinks, or null on error. + * @hide + */ + public List listConnectedSinks() { + try { + return mService.listConnectedSinks(); + } catch (RemoteException e) { + Log.w(TAG, "", e); + return null; + } + } + + /** Get the state of an A2DP sink + * @param address Remote BT address. + * @return State code, or negative on error + * @hide + */ + public int getSinkState(String address) { + try { + return mService.getSinkState(address); + } catch (RemoteException e) { + Log.w(TAG, "", e); + return BluetoothError.ERROR_IPC; + } + } + + /** Helper for converting a state to a string. + * For debug use only - strings are not internationalized. + * @hide + */ + public static String stateToString(int state) { + switch (state) { + case STATE_DISCONNECTED: + return "disconnected"; + case STATE_CONNECTING: + return "connecting"; + case STATE_CONNECTED: + return "connected"; + case STATE_DISCONNECTING: + return "disconnecting"; + case STATE_PLAYING: + return "playing"; + default: + return ""; + } + } +} diff --git a/core/java/android/bluetooth/BluetoothClass.java b/core/java/android/bluetooth/BluetoothClass.java new file mode 100644 index 0000000000000..88ce18b45773e --- /dev/null +++ b/core/java/android/bluetooth/BluetoothClass.java @@ -0,0 +1,191 @@ +/* + * Copyright (C) 2008 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.bluetooth; + +/** + * The Android Bluetooth API is not finalized, and *will* change. Use at your + * own risk. + * + * Static helper methods and constants to decode the device class bit vector + * returned by the Bluetooth API. + * + * The Android Bluetooth API returns a 32-bit integer to represent the class. + * The format of these bits is defined at + * http://www.bluetooth.org/Technical/AssignedNumbers/baseband.htm + * (login required). This class provides static helper methods and constants to + * determine what Service Class(es) and Device Class are encoded in the 32-bit + * class. + * + * Devices typically have zero or more service classes, and exactly one device + * class. The device class is encoded as a major and minor device class, the + * minor being a subset of the major. + * + * Class is useful to describe a device (for example to show an icon), + * but does not reliably describe what profiles a device supports. To determine + * profile support you usually need to perform SDP queries. + * + * Each of these helper methods takes the 32-bit integer class as an argument. + * + * @hide + */ +public class BluetoothClass { + /** Indicates the Bluetooth API could not retrieve the class */ + public static final int ERROR = 0xFF000000; + + /** Every Bluetooth device has zero or more service classes */ + public static class Service { + public static final int BITMASK = 0xFFE000; + + public static final int LIMITED_DISCOVERABILITY = 0x002000; + public static final int POSITIONING = 0x010000; + public static final int NETWORKING = 0x020000; + public static final int RENDER = 0x040000; + public static final int CAPTURE = 0x080000; + public static final int OBJECT_TRANSFER = 0x100000; + public static final int AUDIO = 0x200000; + public static final int TELEPHONY = 0x400000; + public static final int INFORMATION = 0x800000; + + /** Returns true if the given class supports the given Service Class. + * A bluetooth device can claim to support zero or more service classes. + * @param btClass The bluetooth class. + * @param serviceClass The service class constant to test for. For + * example, Service.AUDIO. Must be one of the + * Service.FOO constants. + * @return True if the service class is supported. + */ + public static boolean hasService(int btClass, int serviceClass) { + if (btClass == ERROR) { + return false; + } + return ((btClass & Service.BITMASK & serviceClass) != 0); + } + } + + /** Every Bluetooth device has exactly one device class, comprimised of + * major and minor components. We have not included the minor classes for + * major classes: NETWORKING, PERIPHERAL and IMAGING yet because they work + * a little differently. */ + public static class Device { + public static final int BITMASK = 0x1FFC; + + public static class Major { + public static final int BITMASK = 0x1F00; + + public static final int MISC = 0x0000; + public static final int COMPUTER = 0x0100; + public static final int PHONE = 0x0200; + public static final int NETWORKING = 0x0300; + public static final int AUDIO_VIDEO = 0x0400; + public static final int PERIPHERAL = 0x0500; + public static final int IMAGING = 0x0600; + public static final int WEARABLE = 0x0700; + public static final int TOY = 0x0800; + public static final int HEALTH = 0x0900; + public static final int UNCATEGORIZED = 0x1F00; + + /** Returns the Major Device Class component of a bluetooth class. + * Values returned from this function can be compared with the constants + * Device.Major.FOO. A bluetooth device can only be associated + * with one major class. + */ + public static int getDeviceMajor(int btClass) { + if (btClass == ERROR) { + return ERROR; + } + return (btClass & Device.Major.BITMASK); + } + } + + // Devices in the COMPUTER major class + public static final int COMPUTER_UNCATEGORIZED = 0x0100; + public static final int COMPUTER_DESKTOP = 0x0104; + public static final int COMPUTER_SERVER = 0x0108; + public static final int COMPUTER_LAPTOP = 0x010C; + public static final int COMPUTER_HANDHELD_PC_PDA = 0x0110; + public static final int COMPUTER_PALM_SIZE_PC_PDA = 0x0114; + public static final int COMPUTER_WEARABLE = 0x0118; + + // Devices in the PHONE major class + public static final int PHONE_UNCATEGORIZED = 0x0200; + public static final int PHONE_CELLULAR = 0x0204; + public static final int PHONE_CORDLESS = 0x0208; + public static final int PHONE_SMART = 0x020C; + public static final int PHONE_MODEM_OR_GATEWAY = 0x0210; + public static final int PHONE_ISDN = 0x0214; + + // Minor classes for the AUDIO_VIDEO major class + public static final int AUDIO_VIDEO_UNCATEGORIZED = 0x0400; + public static final int AUDIO_VIDEO_WEARABLE_HEADSET = 0x0404; + public static final int AUDIO_VIDEO_HANDSFREE = 0x0408; + //public static final int AUDIO_VIDEO_RESERVED = 0x040C; + public static final int AUDIO_VIDEO_MICROPHONE = 0x0410; + public static final int AUDIO_VIDEO_LOUDSPEAKER = 0x0414; + public static final int AUDIO_VIDEO_HEADPHONES = 0x0418; + public static final int AUDIO_VIDEO_PORTABLE_AUDIO = 0x041C; + public static final int AUDIO_VIDEO_CAR_AUDIO = 0x0420; + public static final int AUDIO_VIDEO_SET_TOP_BOX = 0x0424; + public static final int AUDIO_VIDEO_HIFI_AUDIO = 0x0428; + public static final int AUDIO_VIDEO_VCR = 0x042C; + public static final int AUDIO_VIDEO_VIDEO_CAMERA = 0x0430; + public static final int AUDIO_VIDEO_CAMCORDER = 0x0434; + public static final int AUDIO_VIDEO_VIDEO_MONITOR = 0x0438; + public static final int AUDIO_VIDEO_VIDEO_DISPLAY_AND_LOUDSPEAKER = 0x043C; + public static final int AUDIO_VIDEO_VIDEO_CONFERENCING = 0x0440; + //public static final int AUDIO_VIDEO_RESERVED = 0x0444; + public static final int AUDIO_VIDEO_VIDEO_GAMING_TOY = 0x0448; + + // Devices in the WEARABLE major class + public static final int WEARABLE_UNCATEGORIZED = 0x0700; + public static final int WEARABLE_WRIST_WATCH = 0x0704; + public static final int WEARABLE_PAGER = 0x0708; + public static final int WEARABLE_JACKET = 0x070C; + public static final int WEARABLE_HELMET = 0x0710; + public static final int WEARABLE_GLASSES = 0x0714; + + // Devices in the TOY major class + public static final int TOY_UNCATEGORIZED = 0x0800; + public static final int TOY_ROBOT = 0x0804; + public static final int TOY_VEHICLE = 0x0808; + public static final int TOY_DOLL_ACTION_FIGURE = 0x080C; + public static final int TOY_CONTROLLER = 0x0810; + public static final int TOY_GAME = 0x0814; + + // Devices in the HEALTH major class + public static final int HEALTH_UNCATEGORIZED = 0x0900; + public static final int HEALTH_BLOOD_PRESSURE = 0x0904; + public static final int HEALTH_THERMOMETER = 0x0908; + public static final int HEALTH_WEIGHING = 0x090C; + public static final int HEALTH_GLUCOSE = 0x0910; + public static final int HEALTH_PULSE_OXIMETER = 0x0914; + public static final int HEALTH_PULSE_RATE = 0x0918; + public static final int HEALTH_DATA_DISPLAY = 0x091C; + + /** Returns the Device Class component of a bluetooth class. This includes + * both the major and minor device components. Values returned from this + * function can be compared with the constants Device.FOO. A bluetooth + * device can only be associated with one device class. + */ + public static int getDevice(int btClass) { + if (btClass == ERROR) { + return ERROR; + } + return (btClass & Device.BITMASK); + } + } +} + diff --git a/core/java/android/bluetooth/BluetoothDevice.java b/core/java/android/bluetooth/BluetoothDevice.java index 0b24db662cac6..d1f71c55f05a3 100644 --- a/core/java/android/bluetooth/BluetoothDevice.java +++ b/core/java/android/bluetooth/BluetoothDevice.java @@ -514,7 +514,7 @@ public class BluetoothDevice { try { return mService.getRemoteClass(address); } catch (RemoteException e) {Log.e(TAG, "", e);} - return DeviceClass.CLASS_UNKNOWN; + return BluetoothClass.ERROR; } public byte[] getRemoteFeatures(String address) { try { diff --git a/core/java/android/bluetooth/BluetoothError.java b/core/java/android/bluetooth/BluetoothError.java new file mode 100644 index 0000000000000..2554bead0ca28 --- /dev/null +++ b/core/java/android/bluetooth/BluetoothError.java @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2008 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.bluetooth; + +/** + * Bluetooth API error codes. + * + * Errors are always negative. + * + * @hide + */ +public class BluetoothError { + /** No error */ + public static final int SUCCESS = 0; + + /** Generic error */ + public static final int ERROR = -1000; + + /** Bluetooth currently disabled */ + public static final int ERROR_DISABLED = -1001; + + /** IPC is not ready, for example service is not yet bound */ + public static final int ERROR_IPC_NOT_READY = -1011; + + /** Some other IPC error, for example a RemoteException */ + public static final int ERROR_IPC = -1012; + +} diff --git a/core/java/android/bluetooth/BluetoothHeadset.java b/core/java/android/bluetooth/BluetoothHeadset.java index 90db39bc547f8..905173e34083e 100644 --- a/core/java/android/bluetooth/BluetoothHeadset.java +++ b/core/java/android/bluetooth/BluetoothHeadset.java @@ -28,35 +28,36 @@ import android.util.Log; * The Android Bluetooth API is not finalized, and *will* change. Use at your * own risk. * - * Public API for controlling the Bluetooth Headset Service. + * Public API for controlling the Bluetooth Headset Service. This includes both + * Bluetooth Headset and Handsfree (v1.5) profiles. The Headset service will + * attempt a handsfree connection first, and fall back to headset. * * BluetoothHeadset is a proxy object for controlling the Bluetooth Headset - * Service. + * Service via IPC. * * Creating a BluetoothHeadset object will create a binding with the * BluetoothHeadset service. Users of this object should call close() when they * are finished with the BluetoothHeadset, so that this proxy object can unbind * from the service. * - * BlueoothHeadset objects are not guarenteed to be connected to the - * BluetoothHeadsetService at all times. Calls on this object while not - * connected to the service will result in default error return values. Even - * after object construction, there is a short delay (~10ms) before this proxy - * object is actually connected to the Service. + * This BluetoothHeadset object is not immediately bound to the + * BluetoothHeadset service. Use the ServiceListener interface to obtain a + * notification when it is bound, this is especially important if you wish to + * immediately call methods on BluetootHeadset after construction. * * Android only supports one connected Bluetooth Headset at a time. * - * Note that in this context, Headset includes both Bluetooth Headset's and - * Handsfree devices. - * * @hide */ public class BluetoothHeadset { - private final static String TAG = "BluetoothHeadset"; + private static final String TAG = "BluetoothHeadset"; + private static final boolean DBG = false; - private final Context mContext; private IBluetoothHeadset mService; + private final Context mContext; + private final ServiceListener mServiceListener; + private ConnectHeadsetCallback mConnectHeadsetCallback; /** There was an error trying to obtain the state */ public static final int STATE_ERROR = -1; @@ -72,25 +73,44 @@ public class BluetoothHeadset { /** Connection cancelled before completetion. */ public static final int RESULT_CANCELLED = 2; - private ServiceConnection mConnection = new ServiceConnection() { - public void onServiceConnected(ComponentName className, IBinder service) { - mService = IBluetoothHeadset.Stub.asInterface(service); - Log.i(TAG, "Proxy object is now connected to Bluetooth Headset Service"); - } - public void onServiceDisconnected(ComponentName className) { - mService = null; - } - }; + /** + * An interface for notifying BluetoothHeadset IPC clients when they have + * been connected to the BluetoothHeadset service. + */ + public interface ServiceListener { + /** + * Called to notify the client when this proxy object has been + * connected to the BluetoothHeadset service. Clients must wait for + * this callback before making IPC calls on the BluetoothHeadset + * service. + */ + public void onServiceConnected(); + + /** + * Called to notify the client that this proxy object has been + * disconnected from the BluetoothHeadset service. Clients must not + * make IPC calls on the BluetoothHeadset service after this callback. + * This callback will currently only occur if the application hosting + * the BluetoothHeadset service, but may be called more often in future. + */ + public void onServiceDisconnected(); + } + + /** + * Interface for connectHeadset() callback. + * This callback can occur in the Binder thread. + */ + public interface ConnectHeadsetCallback { + public void onConnectHeadsetResult(String address, int resultCode); + } /** * Create a BluetoothHeadset proxy object. - * Remeber to call close() when you are done with this object, so that it - * can unbind from the BluetoothHeadsetService. */ - public BluetoothHeadset(Context context) { + public BluetoothHeadset(Context context, ServiceListener l) { mContext = context; - if (!context.bindService( - new Intent(IBluetoothHeadset.class.getName()), mConnection, 0)) { + mServiceListener = l; + if (!context.bindService(new Intent(IBluetoothHeadset.class.getName()), mConnection, 0)) { Log.e(TAG, "Could not bind to Bluetooth Headset Service"); } } @@ -126,6 +146,9 @@ public class BluetoothHeadset { try { return mService.getState(); } catch (RemoteException e) {Log.e(TAG, e.toString());} + } else { + Log.w(TAG, "Proxy not attached to service"); + if (DBG) Log.d(TAG, Log.getStackTraceString(new Throwable())); } return BluetoothHeadset.STATE_ERROR; } @@ -141,6 +164,9 @@ public class BluetoothHeadset { try { return mService.getHeadsetAddress(); } catch (RemoteException e) {Log.e(TAG, e.toString());} + } else { + Log.w(TAG, "Proxy not attached to service"); + if (DBG) Log.d(TAG, Log.getStackTraceString(new Throwable())); } return null; } @@ -150,20 +176,29 @@ public class BluetoothHeadset { * This call does not block. Fails if a headset is already connecting * or connected. * Will connect to the last connected headset if address is null. + * onConnectHeadsetResult() of your ConnectHeadsetCallback will be called + * on completition. * @param address The Bluetooth Address to connect to, or null to connect * to the last connected headset. - * @param callback A callback with onCreateBondingResult() defined, or - * null. + * @param callback Callback on result. Not called if false is returned. Can + * be null. + * to the last connected headset. * @return False if there was a problem initiating the connection * procedure, and your callback will not be used. True if * the connection procedure was initiated, in which case * your callback is guarenteed to be called. */ - public boolean connectHeadset(String address, IBluetoothHeadsetCallback callback) { + public boolean connectHeadset(String address, ConnectHeadsetCallback callback) { if (mService != null) { try { - return mService.connectHeadset(address, callback); + if (mService.connectHeadset(address, mHeadsetCallback)) { + mConnectHeadsetCallback = callback; + return true; + } } catch (RemoteException e) {Log.e(TAG, e.toString());} + } else { + Log.w(TAG, "Proxy not attached to service"); + if (DBG) Log.d(TAG, Log.getStackTraceString(new Throwable())); } return false; } @@ -178,6 +213,9 @@ public class BluetoothHeadset { try { return mService.isConnected(address); } catch (RemoteException e) {Log.e(TAG, e.toString());} + } else { + Log.w(TAG, "Proxy not attached to service"); + if (DBG) Log.d(TAG, Log.getStackTraceString(new Throwable())); } return false; } @@ -191,8 +229,72 @@ public class BluetoothHeadset { if (mService != null) { try { mService.disconnectHeadset(); + return true; + } catch (RemoteException e) {Log.e(TAG, e.toString());} + } else { + Log.w(TAG, "Proxy not attached to service"); + if (DBG) Log.d(TAG, Log.getStackTraceString(new Throwable())); + } + return false; + } + + /** + * Start BT Voice Recognition mode, and set up Bluetooth audio path. + * Returns false if there is no headset connected, or if the + * connected headset does not support voice recognition, or on + * error. + */ + public boolean startVoiceRecognition() { + if (mService != null) { + try { + return mService.startVoiceRecognition(); + } catch (RemoteException e) {Log.e(TAG, e.toString());} + } else { + Log.w(TAG, "Proxy not attached to service"); + if (DBG) Log.d(TAG, Log.getStackTraceString(new Throwable())); + } + return false; + } + + /** + * Stop BT Voice Recognition mode, and shut down Bluetooth audio path. + * Returns false if there is no headset connected, or the connected + * headset is not in voice recognition mode, or on error. + */ + public boolean stopVoiceRecognition() { + if (mService != null) { + try { + return mService.stopVoiceRecognition(); } catch (RemoteException e) {Log.e(TAG, e.toString());} + } else { + Log.w(TAG, "Proxy not attached to service"); + if (DBG) Log.d(TAG, Log.getStackTraceString(new Throwable())); } return false; } + + private ServiceConnection mConnection = new ServiceConnection() { + public void onServiceConnected(ComponentName className, IBinder service) { + if (DBG) Log.d(TAG, "Proxy object connected"); + mService = IBluetoothHeadset.Stub.asInterface(service); + if (mServiceListener != null) { + mServiceListener.onServiceConnected(); + } + } + public void onServiceDisconnected(ComponentName className) { + if (DBG) Log.d(TAG, "Proxy object disconnected"); + mService = null; + if (mServiceListener != null) { + mServiceListener.onServiceDisconnected(); + } + } + }; + + private IBluetoothHeadsetCallback mHeadsetCallback = new IBluetoothHeadsetCallback.Stub() { + public void onConnectHeadsetResult(String address, int resultCode) { + if (mConnectHeadsetCallback != null) { + mConnectHeadsetCallback.onConnectHeadsetResult(address, resultCode); + } + } + }; } diff --git a/core/java/android/bluetooth/DeviceClass.java b/core/java/android/bluetooth/DeviceClass.java deleted file mode 100644 index 36035ca4db0ce..0000000000000 --- a/core/java/android/bluetooth/DeviceClass.java +++ /dev/null @@ -1,131 +0,0 @@ -/* - * Copyright (C) 2008 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package android.bluetooth; - -/** - * The Android Bluetooth API is not finalized, and *will* change. Use at your - * own risk. - * - * Static helper methods and constants to decode the device class bit vector - * returned by the Bluetooth API. - * - * The Android Bluetooth API returns a 32-bit integer to represent the device - * class. This is actually a bit vector, the format defined at - * http://www.bluetooth.org/Technical/AssignedNumbers/baseband.htm - * (login required). This class provides static helper methods and constants to - * determine what Service Class(es), Major Class, and Minor Class are encoded - * in a 32-bit device class. - * - * Each of the helper methods takes the 32-bit integer device class as an - * argument. - * - * @hide - */ -public class DeviceClass { - - // Baseband class information - // See http://www.bluetooth.org/Technical/AssignedNumbers/baseband.htm - - public static final int SERVICE_CLASS_BITMASK = 0xFFE000; - public static final int SERVICE_CLASS_LIMITED_DISCOVERABILITY = 0x002000; - public static final int SERVICE_CLASS_POSITIONING = 0x010000; - public static final int SERVICE_CLASS_NETWORKING = 0x020000; - public static final int SERVICE_CLASS_RENDER = 0x040000; - public static final int SERVICE_CLASS_CAPTURE = 0x080000; - public static final int SERVICE_CLASS_OBJECT_TRANSFER = 0x100000; - public static final int SERVICE_CLASS_AUDIO = 0x200000; - public static final int SERVICE_CLASS_TELEPHONY = 0x400000; - public static final int SERVICE_CLASS_INFORMATION = 0x800000; - - public static final int MAJOR_CLASS_BITMASK = 0x001F00; - public static final int MAJOR_CLASS_MISC = 0x000000; - public static final int MAJOR_CLASS_COMPUTER = 0x000100; - public static final int MAJOR_CLASS_PHONE = 0x000200; - public static final int MAJOR_CLASS_NETWORKING = 0x000300; - public static final int MAJOR_CLASS_AUDIO_VIDEO = 0x000400; - public static final int MAJOR_CLASS_PERIPHERAL = 0x000500; - public static final int MAJOR_CLASS_IMAGING = 0x000600; - public static final int MAJOR_CLASS_WEARABLE = 0x000700; - public static final int MAJOR_CLASS_TOY = 0x000800; - public static final int MAJOR_CLASS_MEDICAL = 0x000900; - public static final int MAJOR_CLASS_UNCATEGORIZED = 0x001F00; - - // Minor classes for the AUDIO_VIDEO major class - public static final int MINOR_CLASS_AUDIO_VIDEO_BITMASK = 0x0000FC; - public static final int MINOR_CLASS_AUDIO_VIDEO_UNCATEGORIZED = 0x000000; - public static final int MINOR_CLASS_AUDIO_VIDEO_HEADSET = 0x000004; - public static final int MINOR_CLASS_AUDIO_VIDEO_HANDSFREE = 0x000008; - public static final int MINOR_CLASS_AUDIO_VIDEO_MICROPHONE = 0x000010; - public static final int MINOR_CLASS_AUDIO_VIDEO_LOUDSPEAKER = 0x000014; - public static final int MINOR_CLASS_AUDIO_VIDEO_HEADPHONES = 0x000018; - public static final int MINOR_CLASS_AUDIO_VIDEO_PORTABLE_AUDIO = 0x00001C; - public static final int MINOR_CLASS_AUDIO_VIDEO_CAR_AUDIO = 0x000020; - public static final int MINOR_CLASS_AUDIO_VIDEO_SET_TOP_BOX = 0x000024; - public static final int MINOR_CLASS_AUDIO_VIDEO_HIFI_AUDIO = 0x000028; - public static final int MINOR_CLASS_AUDIO_VIDEO_VCR = 0x00002C; - public static final int MINOR_CLASS_AUDIO_VIDEO_VIDEO_CAMERA = 0x000030; - public static final int MINOR_CLASS_AUDIO_VIDEO_CAMCORDER = 0x000034; - public static final int MINOR_CLASS_AUDIO_VIDEO_VIDEO_MONITOR = 0x000038; - public static final int MINOR_CLASS_AUDIO_VIDEO_VIDEO_DISPLAY_AND_LOUDSPEAKER = 0x00003C; - public static final int MINOR_CLASS_AUDIO_VIDEO_VIDEO_CONFERENCING = 0x000040; - public static final int MINOR_CLASS_AUDIO_VIDEO_VIDEO_GAMING_TOY = 0x000048; - - // Indicates the Bluetooth API could not retrieve the class - public static final int CLASS_UNKNOWN = 0xFF000000; - - /** Returns true if the given device class supports the given Service Class. - * A bluetooth device can claim to support zero or more service classes. - * @param deviceClass The bluetooth device class. - * @param serviceClassType The service class constant to test for. For - * example, DeviceClass.SERVICE_CLASS_AUDIO. This - * must be one of the SERVICE_CLASS_xxx constants, - * results of this function are undefined - * otherwise. - * @return If the deviceClass claims to support the serviceClassType. - */ - public static boolean hasServiceClass(int deviceClass, int serviceClassType) { - if (deviceClass == CLASS_UNKNOWN) { - return false; - } - return ((deviceClass & SERVICE_CLASS_BITMASK & serviceClassType) != 0); - } - - /** Returns the Major Class of a bluetooth device class. - * Values returned from this function can be compared with the constants - * MAJOR_CLASS_xxx. A bluetooth device can only be associated - * with one major class. - */ - public static int getMajorClass(int deviceClass) { - if (deviceClass == CLASS_UNKNOWN) { - return CLASS_UNKNOWN; - } - return (deviceClass & MAJOR_CLASS_BITMASK); - } - - /** Returns the Minor Class of a bluetooth device class. - * Values returned from this function can be compared with the constants - * MINOR_CLASS_xxx_yyy, where xxx is the Major Class. A bluetooth - * device can only be associated with one minor class within its major - * class. - */ - public static int getMinorClass(int deviceClass) { - if (deviceClass == CLASS_UNKNOWN) { - return CLASS_UNKNOWN; - } - return (deviceClass & MINOR_CLASS_AUDIO_VIDEO_BITMASK); - } -} diff --git a/core/java/android/bluetooth/IBluetoothA2dp.aidl b/core/java/android/bluetooth/IBluetoothA2dp.aidl new file mode 100644 index 0000000000000..7e0226d2fd9a6 --- /dev/null +++ b/core/java/android/bluetooth/IBluetoothA2dp.aidl @@ -0,0 +1,29 @@ +/* + * Copyright (C) 2008 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.bluetooth; + +/** + * System private API for Bluetooth A2DP service + * + * {@hide} + */ +interface IBluetoothA2dp { + int connectSink(in String address); + int disconnectSink(in String address); + List listConnectedSinks(); + int getSinkState(in String address); +} diff --git a/core/java/android/bluetooth/IBluetoothHeadset.aidl b/core/java/android/bluetooth/IBluetoothHeadset.aidl index 7b6030b1cf657..564861ff4c774 100644 --- a/core/java/android/bluetooth/IBluetoothHeadset.aidl +++ b/core/java/android/bluetooth/IBluetoothHeadset.aidl @@ -36,7 +36,11 @@ interface IBluetoothHeadset { // returns true boolean connectHeadset(in String address, in IBluetoothHeadsetCallback callback); + void disconnectHeadset(); + boolean isConnected(in String address); - void disconnectHeadset(); + boolean startVoiceRecognition(); + + boolean stopVoiceRecognition(); } diff --git a/core/java/android/bluetooth/package.html b/core/java/android/bluetooth/package.html index ccd8fecaf8202..79abf0cb4a046 100644 --- a/core/java/android/bluetooth/package.html +++ b/core/java/android/bluetooth/package.html @@ -9,6 +9,5 @@ query the SDP database of other Bluetooth devices, establish RFCOMM channels/sockets on Android, and connect to specified sockets on other devices.

    Remember, not all Android devices are guaranteed to have Bluetooth functionality.

    -{@hide} diff --git a/core/java/android/content/AbstractTableMerger.java b/core/java/android/content/AbstractTableMerger.java index 56e5d4a7fbc65..e1a484e3363da 100644 --- a/core/java/android/content/AbstractTableMerger.java +++ b/core/java/android/content/AbstractTableMerger.java @@ -548,7 +548,8 @@ public abstract class AbstractTableMerger long numDeletedEntries = 0; if (mDeletedTable != null) { Cursor deletedCursor = mDb.query(mDeletedTable, - syncIdAndVersionProjection, _SYNC_ACCOUNT + "=?", accountSelectionArgs, + syncIdAndVersionProjection, + _SYNC_ACCOUNT + "=? AND " + _SYNC_ID + " IS NOT NULL", accountSelectionArgs, null, null, mDeletedTable + "." + _SYNC_ID); numDeletedEntries = deletedCursor.getCount(); diff --git a/core/java/android/content/AsyncQueryHandler.java b/core/java/android/content/AsyncQueryHandler.java index 48f1bc7023688..2d651a756111c 100644 --- a/core/java/android/content/AsyncQueryHandler.java +++ b/core/java/android/content/AsyncQueryHandler.java @@ -24,6 +24,8 @@ import android.os.Looper; import android.os.Message; import android.util.Log; +import java.lang.ref.WeakReference; + /** * A helper class to help make handling asynchronous {@link ContentResolver} * queries easier. @@ -37,7 +39,7 @@ public abstract class AsyncQueryHandler extends Handler { private static final int EVENT_ARG_UPDATE = 3; private static final int EVENT_ARG_DELETE = 4; - /* package */ ContentResolver mResolver; + /* package */ final WeakReference mResolver; private static Looper sLooper = null; @@ -62,18 +64,26 @@ public abstract class AsyncQueryHandler extends Handler { @Override public void handleMessage(Message msg) { + final ContentResolver resolver = mResolver.get(); + if (resolver == null) return; + WorkerArgs args = (WorkerArgs) msg.obj; int token = msg.what; int event = msg.arg1; - + switch (event) { case EVENT_ARG_QUERY: Cursor cursor; try { - cursor = mResolver.query(args.uri, args.projection, + cursor = resolver.query(args.uri, args.projection, args.selection, args.selectionArgs, args.orderBy); + // Calling getCount() causes the cursor window to be filled, + // which will make the first access on the main thread a lot faster. + if (cursor != null) { + cursor.getCount(); + } } catch (Exception e) { cursor = null; } @@ -82,18 +92,16 @@ public abstract class AsyncQueryHandler extends Handler { break; case EVENT_ARG_INSERT: - args.result = mResolver.insert(args.uri, args.values); + args.result = resolver.insert(args.uri, args.values); break; case EVENT_ARG_UPDATE: - int r = mResolver.update(args.uri, args.values, args.selection, + args.result = resolver.update(args.uri, args.values, args.selection, args.selectionArgs); - args.result = new Integer(r); break; case EVENT_ARG_DELETE: - int r2 = mResolver.delete(args.uri, args.selection, args.selectionArgs); - args.result = new Integer(r2); + args.result = resolver.delete(args.uri, args.selection, args.selectionArgs); break; } @@ -115,7 +123,7 @@ public abstract class AsyncQueryHandler extends Handler { public AsyncQueryHandler(ContentResolver cr) { super(); - mResolver = cr; + mResolver = new WeakReference(cr); synchronized (AsyncQueryHandler.class) { if (sLooper == null) { HandlerThread thread = new HandlerThread("AsyncQueryWorker"); diff --git a/core/java/android/content/BroadcastReceiver.java b/core/java/android/content/BroadcastReceiver.java index 6a6f4f960fb0d..cd92002b72ada 100644 --- a/core/java/android/content/BroadcastReceiver.java +++ b/core/java/android/content/BroadcastReceiver.java @@ -327,7 +327,7 @@ public abstract class BroadcastReceiver { * current broadcast; only works with broadcasts sent through * {@link Context#sendOrderedBroadcast(Intent, String) * Context.sendOrderedBroadcast}. This will prevent - * any other intent receivers from receiving the broadcast. It will still + * any other broadcast receivers from receiving the broadcast. It will still * call {@link #onReceive} of the BroadcastReceiver that the caller of * {@link Context#sendOrderedBroadcast(Intent, String) * Context.sendOrderedBroadcast} passed in. diff --git a/core/java/android/content/Context.java b/core/java/android/content/Context.java index 00a6d316886c3..6da00dfb30f69 100644 --- a/core/java/android/content/Context.java +++ b/core/java/android/content/Context.java @@ -982,10 +982,10 @@ public abstract class Context { String profileFile, Bundle arguments); /** - * Return the handle to a system-level service by name. The class of the - * returned object varies by the requested name. Currently available names + * Return the handle to a system-level service by name. The class of the + * returned object varies by the requested name. Currently available names * are: - * + * *
    *
    {@link #WINDOW_SERVICE} ("window") *
    The top-level window manager in which you can place custom @@ -1021,6 +1021,9 @@ public abstract class Context { *
    {@link #WIFI_SERVICE} ("wifi") *
    A {@link android.net.wifi.WifiManager WifiManager} for management of * Wi-Fi connectivity. + *
    {@link #INPUT_METHOD_SERVICE} ("input_method") + *
    An {@link android.view.inputmethod.InputMethodManager InputMethodManager} + * for management of input methods. *
    * *

    Note: System services obtained via this API may be closely associated with @@ -1029,9 +1032,9 @@ public abstract class Context { * Services, Providers, etc.) * * @param name The name of the desired service. - * + * * @return The service or null if the name does not exist. - * + * * @see #WINDOW_SERVICE * @see android.view.WindowManager * @see #LAYOUT_INFLATER_SERVICE @@ -1062,6 +1065,8 @@ public abstract class Context { * @see android.media.AudioManager * @see #TELEPHONY_SERVICE * @see android.internal.TelephonyManager + * @see #INPUT_METHOD_SERVICE + * @see android.view.inputmethod.InputMethodManager */ public abstract Object getSystemService(String name); @@ -1234,6 +1239,15 @@ public abstract class Context { */ public static final String CLIPBOARD_SERVICE = "clipboard"; + /** + * Use with {@link #getSystemService} to retrieve a + * {@link android.view.inputmethod.InputMethodManager} for accessing input + * methods. + * + * @see #getSystemService + */ + public static final String INPUT_METHOD_SERVICE = "input_method"; + /** * Determine whether the given permission is allowed for a particular * process and user ID running in the system. diff --git a/core/java/android/content/DefaultDataHandler.java b/core/java/android/content/DefaultDataHandler.java index 7dc71b838d3ee..863c9f6f144df 100644 --- a/core/java/android/content/DefaultDataHandler.java +++ b/core/java/android/content/DefaultDataHandler.java @@ -28,42 +28,47 @@ import java.io.InputStream; import java.util.Stack; /** - * insert default data from InputStream, should be in XML format: - * if the provider syncs data to the server, the imported data will be synced to the server - * Samples: - * insert one row - * - * - * - * - * - * delete, it must be in order of uri, select and arg - * + * Inserts default data from InputStream, should be in XML format. + * If the provider syncs data to the server, the imported data will be synced to the server. + *

    Samples:

    + *
    + * Insert one row: + *
    + * <row uri="content://contacts/people">
    + *  <Col column = "name" value = "foo feebe "/>
    + *  <Col column = "addr" value = "Tx"/>
    + * </row>
    + *
    + * Delete, it must be in order of uri, select, and arg: + *
    + * <del uri="content://contacts/people" select="name=? and addr=?" 
    + *  arg1 = "foo feebe" arg2 ="Tx"/>
    + *
    + * Use first row's uri to insert into another table, + * content://contacts/people/1/phones: + *
    + * <row uri="content://contacts/people">
    + *  <col column = "name" value = "foo feebe"/>
    + *  <col column = "addr" value = "Tx"/>
    + *  <row postfix="phones">
    + *    <col column="number" value="512-514-6535"/>
    + *  </row>
    + *  <row postfix="phones">
    + *    <col column="cell" value="512-514-6535"/>
    + *  </row>  
    + * </row>
    + *
    + * Insert multiple rows in to same table and same attributes: + *
    + * <row uri="content://contacts/people" >
    + *  <row>
    + *   <col column= "name" value = "foo feebe"/>
    + *   <col column= "addr" value = "Tx"/>
    + *  </row>
    + *  <row>
    + *  </row>
    + * </row>
    * - * use first row's uri to insert into another table - * content://contacts/people/1/phones - * - * - * - * - * - * - * - * - * - * - * - * insert multiple rows in to same table and same attributes: - * - * - * - * - * - * - * - * - * * @hide */ public class DefaultDataHandler implements ContentInsertHandler { diff --git a/core/java/android/content/DialogInterface.java b/core/java/android/content/DialogInterface.java index fc94aa6788fd5..4afa2946176a5 100644 --- a/core/java/android/content/DialogInterface.java +++ b/core/java/android/content/DialogInterface.java @@ -22,10 +22,39 @@ import android.view.KeyEvent; * */ public interface DialogInterface { - public static final int BUTTON1 = -1; - public static final int BUTTON2 = -2; - public static final int BUTTON3 = -3; + /** + * The identifier for the positive button. + */ + public static final int BUTTON_POSITIVE = -1; + + /** + * The identifier for the negative button. + */ + public static final int BUTTON_NEGATIVE = -2; + /** + * The identifier for the neutral button. + */ + public static final int BUTTON_NEUTRAL = -3; + + /** + * @deprecated Use {@link #BUTTON_POSITIVE} + */ + @Deprecated + public static final int BUTTON1 = BUTTON_POSITIVE; + + /** + * @deprecated Use {@link #BUTTON_NEGATIVE} + */ + @Deprecated + public static final int BUTTON2 = BUTTON_NEGATIVE; + + /** + * @deprecated Use {@link #BUTTON_NEUTRAL} + */ + @Deprecated + public static final int BUTTON3 = BUTTON_NEUTRAL; + public void cancel(); public void dismiss(); @@ -71,9 +100,11 @@ public interface DialogInterface { * This method will be invoked when a button in the dialog is clicked. * * @param dialog The dialog that received the click. - * @param which The button that was clicked, i.e. BUTTON1 or BUTTON2 or - * the position of the item clicked. + * @param which The button that was clicked (e.g. + * {@link DialogInterface#BUTTON1}) or the position + * of the item clicked. */ + /* TODO: Change to use BUTTON_POSITIVE after API council */ public void onClick(DialogInterface dialog, int which); } diff --git a/core/java/android/content/Intent.java b/core/java/android/content/Intent.java index c76158c1adb06..4a92b4c8fb7f5 100644 --- a/core/java/android/content/Intent.java +++ b/core/java/android/content/Intent.java @@ -33,7 +33,6 @@ import android.os.Parcel; import android.os.Parcelable; import android.util.AttributeSet; import android.util.Log; -import android.util.TypedValue; import com.android.internal.util.XmlUtils; import java.io.IOException; @@ -542,23 +541,8 @@ import java.util.Set; *

    Flags

    * *

    These are the possible flags that can be used in the Intent via - * {@link #setFlags} and {@link #addFlags}. - * - *

      - *
    • {@link #FLAG_GRANT_READ_URI_PERMISSION} - *
    • {@link #FLAG_GRANT_WRITE_URI_PERMISSION} - *
    • {@link #FLAG_FROM_BACKGROUND} - *
    • {@link #FLAG_DEBUG_LOG_RESOLUTION} - *
    • {@link #FLAG_ACTIVITY_NO_HISTORY} - *
    • {@link #FLAG_ACTIVITY_SINGLE_TOP} - *
    • {@link #FLAG_ACTIVITY_NEW_TASK} - *
    • {@link #FLAG_ACTIVITY_MULTIPLE_TASK} - *
    • {@link #FLAG_ACTIVITY_FORWARD_RESULT} - *
    • {@link #FLAG_ACTIVITY_PREVIOUS_IS_TOP} - *
    • {@link #FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS} - *
    • {@link #FLAG_ACTIVITY_BROUGHT_TO_FRONT} - *
    • {@link #FLAG_RECEIVER_REGISTERED_ONLY} - *
    + * {@link #setFlags} and {@link #addFlags}. See {@link #setFlags} for a list + * of all possible flags. */ public class Intent implements Parcelable { // --------------------------------------------------------------------- @@ -573,6 +557,7 @@ public class Intent implements Parcelable { */ @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) public static final String ACTION_MAIN = "android.intent.action.MAIN"; + /** * Activity Action: Display the data to the user. This is the most common * action performed on data -- it is the generic action you can use on @@ -586,11 +571,13 @@ public class Intent implements Parcelable { */ @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) public static final String ACTION_VIEW = "android.intent.action.VIEW"; + /** * A synonym for {@link #ACTION_VIEW}, the "standard" action that is * performed on a piece of data. */ public static final String ACTION_DEFAULT = ACTION_VIEW; + /** * Used to indicate that some piece of data should be attached to some other * place. For example, image data could be attached to a contact. It is up @@ -601,6 +588,7 @@ public class Intent implements Parcelable { */ @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) public static final String ACTION_ATTACH_DATA = "android.intent.action.ATTACH_DATA"; + /** * Activity Action: Provide explicit editable access to the given data. *

    Input: {@link #getData} is URI of data to be edited. @@ -608,6 +596,7 @@ public class Intent implements Parcelable { */ @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) public static final String ACTION_EDIT = "android.intent.action.EDIT"; + /** * Activity Action: Pick an existing item, or insert a new item, and then edit it. *

    Input: {@link #getType} is the desired MIME type of the item to create or edit. @@ -618,6 +607,7 @@ public class Intent implements Parcelable { */ @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) public static final String ACTION_INSERT_OR_EDIT = "android.intent.action.INSERT_OR_EDIT"; + /** * Activity Action: Pick an item from the data, returning what was selected. *

    Input: {@link #getData} is URI containing a directory of data @@ -626,13 +616,15 @@ public class Intent implements Parcelable { */ @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) public static final String ACTION_PICK = "android.intent.action.PICK"; + /** * Activity Action: Creates a shortcut. - *

    Input: Nothing. + *

    Input: Nothing.

    *

    Output: An Intent representing the shortcut. The intent must contain three * extras: SHORTCUT_INTENT (value: Intent), SHORTCUT_NAME (value: String), * and SHORTCUT_ICON (value: Bitmap) or SHORTCUT_ICON_RESOURCE - * (value: ShortcutIconResource). + * (value: ShortcutIconResource).

    + * * @see #EXTRA_SHORTCUT_INTENT * @see #EXTRA_SHORTCUT_NAME * @see #EXTRA_SHORTCUT_ICON @@ -670,10 +662,12 @@ public class Intent implements Parcelable { "android.intent.extra.shortcut.ICON_RESOURCE"; /** - * Represents a shortcut icon resource. + * Represents a shortcut/live folder icon resource. * * @see Intent#ACTION_CREATE_SHORTCUT * @see Intent#EXTRA_SHORTCUT_ICON_RESOURCE + * @see android.provider.LiveFolders#ACTION_CREATE_LIVE_FOLDER + * @see android.provider.LiveFolders#EXTRA_LIVE_FOLDER_ICON */ public static class ShortcutIconResource implements Parcelable { /** @@ -972,10 +966,13 @@ public class Intent implements Parcelable { public static final String ACTION_SEARCH = "android.intent.action.SEARCH"; /** * Activity Action: Perform a web search. - *

    Input: {@link #getData} is URI of data. If it is a url - * starts with http or https, the site will be opened. If it is plain text, - * Google search will be applied. - *

    Output: nothing. + *

    + * Input: {@link android.app.SearchManager#QUERY + * getStringExtra(SearchManager.QUERY)} is the text to search for. If it is + * a url starts with http or https, the site will be opened. If it is plain + * text, Google search will be applied. + *

    + * Output: nothing. */ @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) public static final String ACTION_WEB_SEARCH = "android.intent.action.WEB_SEARCH"; @@ -1027,7 +1024,7 @@ public class Intent implements Parcelable { */ @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) public static final String ACTION_VOICE_COMMAND = "android.intent.action.VOICE_COMMAND"; - + // --------------------------------------------------------------------- // --------------------------------------------------------------------- // Standard intent broadcast actions (see action variable). @@ -1318,6 +1315,14 @@ public class Intent implements Parcelable { @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) public static final String ACTION_GTALK_SERVICE_DISCONNECTED = "android.intent.action.GTALK_DISCONNECTED"; + + /** + * Broadcast Action: An input method has been changed. + * {@hide pending API Council approval} + */ + @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) + public static final String ACTION_INPUT_METHOD_CHANGED = + "android.intent.action.INPUT_METHOD_CHANGED"; /** *

    Broadcast Action: The user has switched the phone into or out of Airplane Mode. One or @@ -1644,6 +1649,15 @@ public class Intent implements Parcelable { */ public static final String EXTRA_ALARM_COUNT = "android.intent.extra.ALARM_COUNT"; + /** + * Used as an int extra field in {@link android.content.Intent#ACTION_VOICE_COMMAND} + * intents to request which audio route the voice command should prefer. + * The value should be a route from {@link android.media.AudioManager}, for + * example ROUTE_BLUETOOTH_SCO. Providing this value is optional. + * {@hide pending API Council approval} + */ + public static final String EXTRA_AUDIO_ROUTE = "android.intent.extra.AUDIO_ROUTE"; + // --------------------------------------------------------------------- // --------------------------------------------------------------------- // Intent flags (see mFlags variable). @@ -1671,7 +1685,10 @@ public class Intent implements Parcelable { public static final int FLAG_DEBUG_LOG_RESOLUTION = 0x00000008; /** - * If set, the new activity is not kept in the history stack. + * If set, the new activity is not kept in the history stack. As soon as + * the user navigates away from it, the activity is finished. This may also + * be set with the {@link android.R.styleable#AndroidManifestActivity_noHistory + * noHistory} attribute. */ public static final int FLAG_ACTIVITY_NO_HISTORY = 0x40000000; /** @@ -1794,9 +1811,33 @@ public class Intent implements Parcelable { */ public static final int FLAG_ACTIVITY_RESET_TASK_IF_NEEDED = 0x00200000; /** - * If set, this activity is being launched from history (longpress home key). + * This flag is not normally set by application code, but set for you by + * the system if this activity is being launched from history + * (longpress home key). */ public static final int FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY = 0x00100000; + /** + * If set, this marks a point in the task's activity stack that should + * be cleared when the task is reset. That is, the next time the task + * is broad to the foreground with + * {@link #FLAG_ACTIVITY_RESET_TASK_IF_NEEDED} (typically as a result of + * the user re-launching it from home), this activity and all on top of + * it will be finished so that the user does not return to them, but + * instead returns to whatever activity preceeded it. + * + *

    This is useful for cases where you have a logical break in your + * application. For example, an e-mail application may have a command + * to view an attachment, which launches an image view activity to + * display it. This activity should be part of the e-mail application's + * task, since it is a part of the task the user is involved in. However, + * if the user leaves that task, and later selects the e-mail app from + * home, we may like them to return to the conversation they were + * viewing, not the picture attachment, since that is confusing. By + * setting this flag when launching the image viewer, that viewer and + * any activities it starts will be removed the next time the user returns + * to mail. + */ + public static final int FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET = 0x00080000; /** * If set, when sending a broadcast only registered receivers will be @@ -3724,6 +3765,30 @@ public class Intent implements Parcelable { return this; } + /** + * Completely replace the extras in the Intent with the extras in the + * given Intent. + * + * @param src The exact extras contained in this Intent are copied + * into the target intent, replacing any that were previously there. + */ + public Intent replaceExtras(Intent src) { + mExtras = src.mExtras != null ? new Bundle(src.mExtras) : null; + return this; + } + + /** + * Completely replace the extras in the Intent with the given Bundle of + * extras. + * + * @param extras The new set of extras in the Intent, or null to erase + * all extras. + */ + public Intent replaceExtras(Bundle extras) { + mExtras = extras != null ? new Bundle(extras) : null; + return this; + } + /** * Remove extended data from the intent. * @@ -3762,14 +3827,17 @@ public class Intent implements Parcelable { * @see #FLAG_GRANT_WRITE_URI_PERMISSION * @see #FLAG_DEBUG_LOG_RESOLUTION * @see #FLAG_FROM_BACKGROUND - * @see #FLAG_ACTIVITY_RESET_TASK_IF_NEEDED * @see #FLAG_ACTIVITY_BROUGHT_TO_FRONT + * @see #FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET * @see #FLAG_ACTIVITY_CLEAR_TOP * @see #FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS * @see #FLAG_ACTIVITY_FORWARD_RESULT + * @see #FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY * @see #FLAG_ACTIVITY_MULTIPLE_TASK * @see #FLAG_ACTIVITY_NEW_TASK * @see #FLAG_ACTIVITY_NO_HISTORY + * @see #FLAG_ACTIVITY_PREVIOUS_IS_TOP + * @see #FLAG_ACTIVITY_RESET_TASK_IF_NEEDED * @see #FLAG_ACTIVITY_SINGLE_TOP * @see #FLAG_RECEIVER_REGISTERED_ONLY */ @@ -4334,7 +4402,11 @@ public class Intent implements Parcelable { XmlUtils.skipCurrentTag(parser); } else if (nodeName.equals("extra")) { - parseExtra(resources, intent, parser, attrs); + if (intent.mExtras == null) { + intent.mExtras = new Bundle(); + } + resources.parseBundleExtra("extra", attrs, intent.mExtras); + XmlUtils.skipCurrentTag(parser); } else { XmlUtils.skipCurrentTag(parser); @@ -4343,49 +4415,4 @@ public class Intent implements Parcelable { return intent; } - - private static void parseExtra(Resources resources, Intent intent, XmlPullParser parser, - AttributeSet attrs) throws XmlPullParserException, IOException { - TypedArray sa = resources.obtainAttributes(attrs, - com.android.internal.R.styleable.IntentExtra); - - String name = sa.getString( - com.android.internal.R.styleable.IntentExtra_name); - if (name == null) { - sa.recycle(); - throw new RuntimeException( - " requires an android:name attribute at " - + parser.getPositionDescription()); - } - - TypedValue v = sa.peekValue( - com.android.internal.R.styleable.IntentExtra_value); - if (v != null) { - if (v.type == TypedValue.TYPE_STRING) { - CharSequence cs = v.coerceToString(); - intent.putExtra(name, cs != null ? cs.toString() : null); - } else if (v.type == TypedValue.TYPE_INT_BOOLEAN) { - intent.putExtra(name, v.data != 0); - } else if (v.type >= TypedValue.TYPE_FIRST_INT - && v.type <= TypedValue.TYPE_LAST_INT) { - intent.putExtra(name, v.data); - } else if (v.type == TypedValue.TYPE_FLOAT) { - intent.putExtra(name, v.getFloat()); - } else { - sa.recycle(); - throw new RuntimeException( - " only supports string, integer, float, color, and boolean at " - + parser.getPositionDescription()); - } - } else { - sa.recycle(); - throw new RuntimeException( - " requires an android:value or android:resource attribute at " - + parser.getPositionDescription()); - } - - sa.recycle(); - - XmlUtils.skipCurrentTag(parser); - } } diff --git a/core/java/android/content/SyncManager.java b/core/java/android/content/SyncManager.java index 2bf84e78e0a08..6bc3774859b0d 100644 --- a/core/java/android/content/SyncManager.java +++ b/core/java/android/content/SyncManager.java @@ -50,14 +50,14 @@ import android.os.RemoteException; import android.os.ServiceManager; import android.os.SystemClock; import android.os.SystemProperties; -import android.pim.DateUtils; -import android.pim.Time; import android.preference.Preference; import android.preference.PreferenceGroup; import android.provider.Sync; import android.provider.Settings; import android.provider.Sync.History; import android.text.TextUtils; +import android.text.format.DateUtils; +import android.text.format.Time; import android.util.Config; import android.util.EventLog; import android.util.Log; @@ -1484,7 +1484,8 @@ class SyncManager { // skip the sync if it isn't a force and the settings are off for this provider final boolean force = syncOperation.extras.getBoolean( ContentResolver.SYNC_EXTRAS_FORCE, false); - if (!force && (!syncSettings.getListenForNetworkTickles() + if (!force && (!syncSettings.getBackgroundData() + || !syncSettings.getListenForNetworkTickles() || !syncSettings.getSyncProviderAutomatically( syncOperation.authority))) { if (isLoggable) { diff --git a/core/java/android/content/pm/ActivityInfo.java b/core/java/android/content/pm/ActivityInfo.java index f577d2df68737..85d877a070170 100644 --- a/core/java/android/content/pm/ActivityInfo.java +++ b/core/java/android/content/pm/ActivityInfo.java @@ -119,13 +119,20 @@ public class ActivityInfo extends ComponentInfo * {@link android.R.attr#allowTaskReparenting} attribute. */ public static final int FLAG_ALLOW_TASK_REPARENTING = 0x0040; + /** + * Bit in {@link #flags} indicating that, when the user navigates away + * from an activity, it should be finished. + * Set from the + * {@link android.R.attr#noHistory} attribute. + */ + public static final int FLAG_NO_HISTORY = 0x0080; /** * Options that have been set in the activity declaration in the * manifest: {@link #FLAG_MULTIPROCESS}, * {@link #FLAG_FINISH_ON_TASK_LAUNCH}, {@link #FLAG_CLEAR_TASK_ON_LAUNCH}, * {@link #FLAG_ALWAYS_RETAIN_TASK_STATE}, * {@link #FLAG_STATE_NOT_NEEDED}, {@link #FLAG_EXCLUDE_FROM_RECENTS}, - * {@link #FLAG_ALLOW_TASK_REPARENTING}. + * {@link #FLAG_ALLOW_TASK_REPARENTING}, {@link #FLAG_NO_HISTORY}. */ public int flags; @@ -247,6 +254,16 @@ public class ActivityInfo extends ComponentInfo */ public int configChanges; + /** + * The desired soft input mode for this activity's main window. + * Set from the {@link android.R.attr#windowSoftInputMode} attribute + * in the activity's manifest. May be any of the same values allowed + * for {@link android.view.WindowManager.LayoutParams#softInputMode + * WindowManager.LayoutParams.softInputMode}. If 0 (unspecified), + * the mode from the theme will be used. + */ + public int softInputMode; + public ActivityInfo() { } @@ -260,6 +277,7 @@ public class ActivityInfo extends ComponentInfo flags = orig.flags; screenOrientation = orig.screenOrientation; configChanges = orig.configChanges; + softInputMode = orig.softInputMode; } /** @@ -280,9 +298,10 @@ public class ActivityInfo extends ComponentInfo + " targetActivity=" + targetActivity); pw.println(prefix + "launchMode=" + launchMode + " flags=0x" + Integer.toHexString(flags) - + " theme=0x" + Integer.toHexString(theme) - + " orien=" + screenOrientation - + " configChanges=0x" + Integer.toHexString(configChanges)); + + " theme=0x" + Integer.toHexString(theme)); + pw.println(prefix + "screenOrientation=" + screenOrientation + + " configChanges=0x" + Integer.toHexString(configChanges) + + " softInputMode=0x" + Integer.toHexString(softInputMode)); super.dumpBack(pw, prefix); } @@ -306,6 +325,7 @@ public class ActivityInfo extends ComponentInfo dest.writeInt(flags); dest.writeInt(screenOrientation); dest.writeInt(configChanges); + dest.writeInt(softInputMode); } public static final Parcelable.Creator CREATOR @@ -328,5 +348,6 @@ public class ActivityInfo extends ComponentInfo flags = source.readInt(); screenOrientation = source.readInt(); configChanges = source.readInt(); + softInputMode = source.readInt(); } } diff --git a/core/java/android/content/pm/ApplicationInfo.java b/core/java/android/content/pm/ApplicationInfo.java index 22d01dcb0178e..8d727ed9d0b43 100644 --- a/core/java/android/content/pm/ApplicationInfo.java +++ b/core/java/android/content/pm/ApplicationInfo.java @@ -112,6 +112,13 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable { * android:allowClearUserData} of the <application> tag. */ public static final int FLAG_ALLOW_CLEAR_USER_DATA = 1<<6; + + + /** + * Value for {@link #flags}: default value for the corresponding ActivityInfo flag. + * {@hide} + */ + public static final int FLAG_UPDATED_SYSTEM_APP = 1<<7; /** * Flags associated with the application. Any combination of @@ -195,7 +202,7 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable { sb = ab.packageName; } - return sCollator.compare(sa, sb); + return sCollator.compare(sa.toString(), sb.toString()); } private final Collator sCollator = Collator.getInstance(); diff --git a/core/java/android/content/pm/ConfigurationInfo.java b/core/java/android/content/pm/ConfigurationInfo.java new file mode 100755 index 0000000000000..9115225c4415e --- /dev/null +++ b/core/java/android/content/pm/ConfigurationInfo.java @@ -0,0 +1,120 @@ +/* + * Copyright (C) 2008 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.content.pm; + +import android.content.res.Configuration; +import android.os.Parcel; +import android.os.Parcelable; + +/** + * Information you can retrieve about hardware configuration preferences + * declared by an application. This corresponds to information collected from the + * AndroidManifest.xml's <uses-configuration> tags. + */ +public class ConfigurationInfo implements Parcelable { + /** + * The kind of touch screen attached to the device. + * One of: {@link android.content.res.Configuration#TOUCHSCREEN_NOTOUCH}, + * {@link android.content.res.Configuration#TOUCHSCREEN_STYLUS}, + * {@link android.content.res.Configuration#TOUCHSCREEN_FINGER}. + */ + public int reqTouchScreen; + + /** + * Application's input method preference. + * One of: {@link android.content.res.Configuration#KEYBOARD_UNDEFINED}, + * {@link android.content.res.Configuration#KEYBOARD_NOKEYS}, + * {@link android.content.res.Configuration#KEYBOARD_QWERTY}, + * {@link android.content.res.Configuration#KEYBOARD_12KEY} + */ + public int reqKeyboardType; + + /** + * A flag indicating whether any keyboard is available. + * one of: {@link android.content.res.Configuration#NAVIGATION_UNDEFINED}, + * {@link android.content.res.Configuration#NAVIGATION_DPAD}, + * {@link android.content.res.Configuration#NAVIGATION_TRACKBALL}, + * {@link android.content.res.Configuration#NAVIGATION_WHEEL} + */ + public int reqNavigation; + + /** + * Value for {@link #reqInputFeatures}: if set, indicates that the application + * requires a hard keyboard + */ + public static final int INPUT_FEATURE_HARD_KEYBOARD = 0x00000001; + + /** + * Value for {@link #reqInputFeatures}: if set, indicates that the application + * requires a hard keyboard + */ + public static final int INPUT_FEATURE_FIVE_WAY_NAV = 0x00000002; + + /** + * Flags associated with the application. Any combination of + * {@link #INPUT_FEATURE_HARD_KEYBOARD}, + * {@link #INPUT_FEATURE_FIVE_WAY_NAV} + */ + public int reqInputFeatures = 0; + + public ConfigurationInfo() { + } + + public ConfigurationInfo(ConfigurationInfo orig) { + reqTouchScreen = orig.reqTouchScreen; + reqKeyboardType = orig.reqKeyboardType; + reqNavigation = orig.reqNavigation; + reqInputFeatures = orig.reqInputFeatures; + } + + public String toString() { + return "ApplicationHardwarePreferences{" + + Integer.toHexString(System.identityHashCode(this)) + + ", touchscreen = " + reqTouchScreen + "}" + + ", inputMethod = " + reqKeyboardType + "}" + + ", navigation = " + reqNavigation + "}" + + ", reqInputFeatures = " + reqInputFeatures + "}"; + } + + public int describeContents() { + return 0; + } + + public void writeToParcel(Parcel dest, int parcelableFlags) { + dest.writeInt(reqTouchScreen); + dest.writeInt(reqKeyboardType); + dest.writeInt(reqNavigation); + dest.writeInt(reqInputFeatures); + } + + public static final Creator CREATOR = + new Creator() { + public ConfigurationInfo createFromParcel(Parcel source) { + return new ConfigurationInfo(source); + } + public ConfigurationInfo[] newArray(int size) { + return new ConfigurationInfo[size]; + } + }; + + private ConfigurationInfo(Parcel source) { + reqTouchScreen = source.readInt(); + reqKeyboardType = source.readInt(); + reqNavigation = source.readInt(); + reqInputFeatures = source.readInt(); + } +} diff --git a/core/java/android/content/pm/IPackageManager.aidl b/core/java/android/content/pm/IPackageManager.aidl index c79655d4abdbe..fdb2a2f4a3b6d 100644 --- a/core/java/android/content/pm/IPackageManager.aidl +++ b/core/java/android/content/pm/IPackageManager.aidl @@ -76,6 +76,8 @@ interface IPackageManager { String getNameForUid(int uid); + int getUidForSharedUser(String sharedUserName); + ResolveInfo resolveIntent(in Intent intent, String resolvedType, int flags); List queryIntentActivities(in Intent intent, diff --git a/core/java/android/content/pm/InstrumentationInfo.java b/core/java/android/content/pm/InstrumentationInfo.java index e6745dac43de8..30ca002d23ad4 100644 --- a/core/java/android/content/pm/InstrumentationInfo.java +++ b/core/java/android/content/pm/InstrumentationInfo.java @@ -73,6 +73,7 @@ public class InstrumentationInfo extends PackageItemInfo implements Parcelable { dest.writeString(publicSourceDir); dest.writeString(dataDir); dest.writeInt((handleProfiling == false) ? 0 : 1); + dest.writeInt((functionalTest == false) ? 0 : 1); } public static final Parcelable.Creator CREATOR @@ -92,5 +93,6 @@ public class InstrumentationInfo extends PackageItemInfo implements Parcelable { publicSourceDir = source.readString(); dataDir = source.readString(); handleProfiling = source.readInt() != 0; + functionalTest = source.readInt() != 0; } } diff --git a/core/java/android/content/pm/PackageInfo.java b/core/java/android/content/pm/PackageInfo.java index 7d694c78818a3..994afc8381ff1 100644 --- a/core/java/android/content/pm/PackageInfo.java +++ b/core/java/android/content/pm/PackageInfo.java @@ -103,6 +103,15 @@ public class PackageInfo implements Parcelable { * in if the flag {@link PackageManager#GET_SIGNATURES} was set. */ public Signature[] signatures; + + /** + * Application specified preferred configuration + * {@link android.R.styleable#AndroidManifestUsesConfiguration + * <uses-configuration>} tags included under <manifest>, + * or null if there were none. This is only filled in if the flag + * {@link PackageManager#GET_CONFIGURATIONS} was set. + */ + public ConfigurationInfo[] configPreferences; public PackageInfo() { } @@ -136,6 +145,7 @@ public class PackageInfo implements Parcelable { dest.writeTypedArray(permissions, parcelableFlags); dest.writeStringArray(requestedPermissions); dest.writeTypedArray(signatures, parcelableFlags); + dest.writeTypedArray(configPreferences, parcelableFlags); } public static final Parcelable.Creator CREATOR @@ -166,5 +176,6 @@ public class PackageInfo implements Parcelable { permissions = source.createTypedArray(PermissionInfo.CREATOR); requestedPermissions = source.createStringArray(); signatures = source.createTypedArray(Signature.CREATOR); + configPreferences = source.createTypedArray(ConfigurationInfo.CREATOR); } } diff --git a/core/java/android/content/pm/PackageItemInfo.java b/core/java/android/content/pm/PackageItemInfo.java index 406a3eb696319..46e7ca43b973f 100644 --- a/core/java/android/content/pm/PackageItemInfo.java +++ b/core/java/android/content/pm/PackageItemInfo.java @@ -90,7 +90,10 @@ public class PackageItemInfo { return label; } } - return name; + if(name != null) { + return name; + } + return packageName; } /** @@ -179,7 +182,7 @@ public class PackageItemInfo { if (sa == null) sa = aa.name; CharSequence sb = ab.loadLabel(mPM); if (sb == null) sb = ab.name; - return sCollator.compare(sa, sb); + return sCollator.compare(sa.toString(), sb.toString()); } private final Collator sCollator = Collator.getInstance(); diff --git a/core/java/android/content/pm/PackageManager.java b/core/java/android/content/pm/PackageManager.java index db00a9ab365e5..a5445507a0438 100644 --- a/core/java/android/content/pm/PackageManager.java +++ b/core/java/android/content/pm/PackageManager.java @@ -148,6 +148,21 @@ public abstract class PackageManager { * {@link PackageInfo#permissions}. */ public static final int GET_PERMISSIONS = 0x00001000; + + /** + * Flag parameter to retrieve all applications(even uninstalled ones) with data directories. + * This state could have resulted if applications have been deleted with flag + * DONT_DELETE_DATA + * with a possibility of being replaced or reinstalled in future + */ + public static final int GET_UNINSTALLED_PACKAGES = 0x00002000; + + /** + * {@link PackageInfo} flag: return information about + * hardware preferences + * {@link PackageInfo#configPreferences} + */ + public static final int GET_CONFIGURATIONS = 0x00004000; /** * Permission check result: this is returned by {@link #checkPermission} @@ -427,16 +442,38 @@ public abstract class PackageManager { * * @param packageName The full name (i.e. com.google.apps.contacts) of the * desired package. - * @param flags Optional flags to control what information is returned. If - * 0, none of the optional information is returned. - * - * @return Returns a PackageInfo containing information about the package. - * + + * @param flags Additional option flags. Use any combination of + * {@link #GET_ACTIVITIES}, + * {@link #GET_GIDS}, + * {@link #GET_CONFIGURATIONS}, + * {@link #GET_INSTRUMENTATION}, + * {@link #GET_PERMISSIONS}, + * {@link #GET_PROVIDERS}, + * {@link #GET_RECEIVERS}, + * {@link #GET_SERVICES}, + * {@link #GET_SIGNATURES}, + * {@link #GET_UNINSTALLED_PACKAGES} to modify the data returned. + * + * @return Returns a PackageInfo object containing information about the package. + * If flag GET_UNINSTALLED_PACKAGES is set and if the package is not + * found in the list of installed applications, the package information is + * retrieved from the list of uninstalled applications(which includes + * installed applications as well as applications + * with data directory ie applications which had been + * deleted with DONT_DELTE_DATA flag set). + * * @see #GET_ACTIVITIES + * @see #GET_GIDS + * @see #GET_CONFIGURATIONS + * @see #GET_INSTRUMENTATION + * @see #GET_PERMISSIONS + * @see #GET_PROVIDERS * @see #GET_RECEIVERS * @see #GET_SERVICES - * @see #GET_INSTRUMENTATION * @see #GET_SIGNATURES + * @see #GET_UNINSTALLED_PACKAGES + * */ public abstract PackageInfo getPackageInfo(String packageName, int flags) throws NameNotFoundException; @@ -530,10 +567,23 @@ public abstract class PackageManager { * * @param packageName The full name (i.e. com.google.apps.contacts) of an * application. - * @param flags Additional option flags. Currently should always be 0. - * - * @return {@link ApplicationInfo} containing information about the - * application. + * @param flags Additional option flags. Use any combination of + * {@link #GET_META_DATA}, {@link #GET_SHARED_LIBRARY_FILES}, + * {@link #GET_UNINSTALLED_PACKAGES} to modify the data returned. + * + * @return {@link ApplicationInfo} Returns ApplicationInfo object containing + * information about the package. + * If flag GET_UNINSTALLED_PACKAGES is set and if the package is not + * found in the list of installed applications, + * the application information is retrieved from the + * list of uninstalled applications(which includes + * installed applications as well as applications + * with data directory ie applications which had been + * deleted with DONT_DELTE_DATA flag set). + * + * @see #GET_META_DATA + * @see #GET_SHARED_LIBRARY_FILES + * @see #GET_UNINSTALLED_PACKAGES */ public abstract ApplicationInfo getApplicationInfo(String packageName, int flags) throws NameNotFoundException; @@ -548,11 +598,15 @@ public abstract class PackageManager { * @param className The full name (i.e. * com.google.apps.contacts.ContactsList) of an Activity * class. - * @param flags Additional option flags. Usually 0. + * @param flags Additional option flags. Use any combination of + * {@link #GET_META_DATA}, {@link #GET_SHARED_LIBRARY_FILES}, + * to modify the data (in ApplicationInfo) returned. * * @return {@link ActivityInfo} containing information about the activity. * * @see #GET_INTENT_FILTERS + * @see #GET_META_DATA + * @see #GET_SHARED_LIBRARY_FILES */ public abstract ActivityInfo getActivityInfo(ComponentName className, int flags) throws NameNotFoundException; @@ -567,11 +621,15 @@ public abstract class PackageManager { * @param className The full name (i.e. * com.google.apps.contacts.CalendarAlarm) of a Receiver * class. - * @param flags Additional option flags. Usually 0. + * @param flags Additional option flags. Use any combination of + * {@link #GET_META_DATA}, {@link #GET_SHARED_LIBRARY_FILES}, + * to modify the data returned. * * @return {@link ActivityInfo} containing information about the receiver. * * @see #GET_INTENT_FILTERS + * @see #GET_META_DATA + * @see #GET_SHARED_LIBRARY_FILES */ public abstract ActivityInfo getReceiverInfo(ComponentName className, int flags) throws NameNotFoundException; @@ -586,9 +644,14 @@ public abstract class PackageManager { * @param className The full name (i.e. * com.google.apps.media.BackgroundPlayback) of a Service * class. - * @param flags Additional option flags. Currently should always be 0. + * @param flags Additional option flags. Use any combination of + * {@link #GET_META_DATA}, {@link #GET_SHARED_LIBRARY_FILES}, + * to modify the data returned. * * @return ServiceInfo containing information about the service. + * + * @see #GET_META_DATA + * @see #GET_SHARED_LIBRARY_FILES */ public abstract ServiceInfo getServiceInfo(ComponentName className, int flags) throws NameNotFoundException; @@ -597,18 +660,36 @@ public abstract class PackageManager { * Return a List of all packages that are installed * on the device. * - * @param flags Optional flags to control what information is returned. If - * 0, none of the optional information is returned. + * @param flags Additional option flags. Use any combination of + * {@link #GET_ACTIVITIES}, + * {@link #GET_GIDS}, + * {@link #GET_CONFIGURATIONS}, + * {@link #GET_INSTRUMENTATION}, + * {@link #GET_PERMISSIONS}, + * {@link #GET_PROVIDERS}, + * {@link #GET_RECEIVERS}, + * {@link #GET_SERVICES}, + * {@link #GET_SIGNATURES}, + * {@link #GET_UNINSTALLED_PACKAGES} to modify the data returned. * * @return A List of PackageInfo objects, one for each package that is * installed on the device. In the unlikely case of there being no - * installed packages, an empty list is returned. + * installed packages, an empty list is returned. + * If flag GET_UNINSTALLED_PACKAGES is set, a list of all + * applications including those deleted with DONT_DELETE_DATA + * (partially installed apps with data directory) will be returned. * * @see #GET_ACTIVITIES + * @see #GET_GIDS + * @see #GET_CONFIGURATIONS + * @see #GET_INSTRUMENTATION + * @see #GET_PERMISSIONS + * @see #GET_PROVIDERS * @see #GET_RECEIVERS * @see #GET_SERVICES - * @see #GET_INSTRUMENTATION * @see #GET_SIGNATURES + * @see #GET_UNINSTALLED_PACKAGES + * */ public abstract List getInstalledPackages(int flags); @@ -731,16 +812,42 @@ public abstract class PackageManager { * user id is not currently assigned. */ public abstract String getNameForUid(int uid); + + /** + * Return the user id associated with a shared user name. Multiple + * applications can specify a shared user name in their manifest and thus + * end up using a common uid. This might be used for new applications + * that use an existing shared user name and need to know the uid of the + * shared user. + * + * @param sharedUserName The shared user name whose uid is to be retrieved. + * @return Returns the uid associated with the shared user, or NameNotFoundException + * if the shared user name is not being used by any installed packages + * @hide + */ + public abstract int getUidForSharedUser(String sharedUserName) + throws NameNotFoundException; /** * Return a List of all application packages that are installed on the - * device. - * - * @param flags Additional option flags. Currently should always be 0. + * device. If flag GET_UNINSTALLED_PACKAGES has been set, a list of all + * applications including those deleted with DONT_DELETE_DATA(partially + * installed apps with data directory) will be returned. + * + * @param flags Additional option flags. Use any combination of + * {@link #GET_META_DATA}, {@link #GET_SHARED_LIBRARY_FILES}, + * {link #GET_UNINSTALLED_PACKAGES} to modify the data returned. * * @return A List of ApplicationInfo objects, one for each application that * is installed on the device. In the unlikely case of there being - * no installed applications, an empty list is returned. + * no installed applications, an empty list is returned. + * If flag GET_UNINSTALLED_PACKAGES is set, a list of all + * applications including those deleted with DONT_DELETE_DATA + * (partially installed apps with data directory) will be returned. + * + * @see #GET_META_DATA + * @see #GET_SHARED_LIBRARY_FILES + * @see #GET_UNINSTALLED_PACKAGES */ public abstract List getInstalledApplications(int flags); @@ -1139,17 +1246,30 @@ public abstract class PackageManager { * in a package archive file * * @param archiveFilePath The path to the archive file - * @param flags Optional flags to control what information is returned. If - * 0, none of the optional information is returned. + * @param flags Additional option flags. Use any combination of + * {@link #GET_ACTIVITIES}, + * {@link #GET_GIDS}, + * {@link #GET_CONFIGURATIONS}, + * {@link #GET_INSTRUMENTATION}, + * {@link #GET_PERMISSIONS}, + * {@link #GET_PROVIDERS}, + * {@link #GET_RECEIVERS}, + * {@link #GET_SERVICES}, + * {@link #GET_SIGNATURES}, to modify the data returned. * * @return Returns the information about the package. Returns * null if the package could not be successfully parsed. * * @see #GET_ACTIVITIES + * @see #GET_GIDS + * @see #GET_CONFIGURATIONS + * @see #GET_INSTRUMENTATION + * @see #GET_PERMISSIONS + * @see #GET_PROVIDERS * @see #GET_RECEIVERS * @see #GET_SERVICES - * @see #GET_INSTRUMENTATION * @see #GET_SIGNATURES + * */ public PackageInfo getPackageArchiveInfo(String archiveFilePath, int flags) { PackageParser packageParser = new PackageParser(archiveFilePath); @@ -1314,16 +1434,28 @@ public abstract class PackageManager { * first package on the list is the most preferred, the last is the * least preferred. * - * @param flags Optional flags to control what information is returned. If - * 0, none of the optional information is returned. + * @param flags Additional option flags. Use any combination of + * {@link #GET_ACTIVITIES}, + * {@link #GET_GIDS}, + * {@link #GET_CONFIGURATIONS}, + * {@link #GET_INSTRUMENTATION}, + * {@link #GET_PERMISSIONS}, + * {@link #GET_PROVIDERS}, + * {@link #GET_RECEIVERS}, + * {@link #GET_SERVICES}, + * {@link #GET_SIGNATURES}, to modify the data returned. * * @return Returns a list of PackageInfo objects describing each * preferred application, in order of preference. * * @see #GET_ACTIVITIES + * @see #GET_GIDS + * @see #GET_CONFIGURATIONS + * @see #GET_INSTRUMENTATION + * @see #GET_PERMISSIONS + * @see #GET_PROVIDERS * @see #GET_RECEIVERS * @see #GET_SERVICES - * @see #GET_INSTRUMENTATION * @see #GET_SIGNATURES */ public abstract List getPreferredPackages(int flags); diff --git a/core/java/android/content/pm/PackageParser.java b/core/java/android/content/pm/PackageParser.java index 5a902614308e1..e08f1d154dc2e 100644 --- a/core/java/android/content/pm/PackageParser.java +++ b/core/java/android/content/pm/PackageParser.java @@ -23,6 +23,7 @@ import android.content.ComponentName; import android.content.Intent; import android.content.IntentFilter; import android.content.res.AssetManager; +import android.content.res.Configuration; import android.content.res.Resources; import android.content.res.TypedArray; import android.content.res.XmlResourceParser; @@ -104,6 +105,15 @@ public class PackageParser { if ((flags&PackageManager.GET_GIDS) != 0) { pi.gids = gids; } + if ((flags&PackageManager.GET_CONFIGURATIONS) != 0) { + int N = p.configPreferences.size(); + if (N > 0) { + pi.configPreferences = new ConfigurationInfo[N]; + for (int i=0; i 0) { @@ -245,18 +255,24 @@ public class PackageParser { XmlResourceParser parser = null; AssetManager assmgr = null; + boolean assetError = true; try { assmgr = new AssetManager(); - assmgr.addAssetPath(mArchiveSourcePath); - parser = assmgr.openXmlResourceParser("AndroidManifest.xml"); + if(assmgr.addAssetPath(mArchiveSourcePath) != 0) { + parser = assmgr.openXmlResourceParser("AndroidManifest.xml"); + assetError = false; + } else { + Log.w(TAG, "Failed adding asset path:"+mArchiveSourcePath); + } } catch (Exception e) { - if (assmgr != null) assmgr.close(); Log.w(TAG, "Unable to read AndroidManifest.xml of " + mArchiveSourcePath, e); + } + if(assetError) { + if (assmgr != null) assmgr.close(); mParseError = PackageManager.INSTALL_PARSE_FAILED_BAD_MANIFEST; return null; } - String[] errorText = new String[1]; Package pkg = null; Exception errorException = null; @@ -626,7 +642,35 @@ public class PackageParser { XmlUtils.skipCurrentTag(parser); - } else if (tagName.equals("uses-sdk")) { + } else if (tagName.equals("uses-configuration")) { + ConfigurationInfo cPref = new ConfigurationInfo(); + sa = res.obtainAttributes(attrs, + com.android.internal.R.styleable.AndroidManifestUsesConfiguration); + cPref.reqTouchScreen = sa.getInt( + com.android.internal.R.styleable.AndroidManifestUsesConfiguration_reqTouchScreen, + Configuration.TOUCHSCREEN_UNDEFINED); + cPref.reqKeyboardType = sa.getInt( + com.android.internal.R.styleable.AndroidManifestUsesConfiguration_reqKeyboardType, + Configuration.KEYBOARD_UNDEFINED); + if (sa.getBoolean( + com.android.internal.R.styleable.AndroidManifestUsesConfiguration_reqHardKeyboard, + false)) { + cPref.reqInputFeatures |= ConfigurationInfo.INPUT_FEATURE_HARD_KEYBOARD; + } + cPref.reqNavigation = sa.getInt( + com.android.internal.R.styleable.AndroidManifestUsesConfiguration_reqNavigation, + Configuration.NAVIGATION_UNDEFINED); + if (sa.getBoolean( + com.android.internal.R.styleable.AndroidManifestUsesConfiguration_reqFiveWayNav, + false)) { + cPref.reqInputFeatures |= ConfigurationInfo.INPUT_FEATURE_FIVE_WAY_NAV; + } + sa.recycle(); + pkg.configPreferences.add(cPref); + + XmlUtils.skipCurrentTag(parser); + + } else if (tagName.equals("uses-sdk")) { if (mSdkVersion > 0) { sa = res.obtainAttributes(attrs, com.android.internal.R.styleable.AndroidManifestUsesSdk); @@ -650,6 +694,10 @@ public class PackageParser { if (parseInstrumentation(pkg, res, parser, attrs, outError) == null) { return null; } + } else if (tagName.equals("eat-comment")) { + // Just skip this tag + XmlUtils.skipCurrentTag(parser); + continue; } else if (RIGID_PARSER) { outError[0] = "Bad element under : " + parser.getName(); @@ -1038,11 +1086,6 @@ public class PackageParser { if (outError[0] != null) { mParseError = PackageManager.INSTALL_PARSE_FAILED_MANIFEST_MALFORMED; return false; - } else if (ai.processName != null && !ai.processName.equals(ai.packageName) - && ai.className != null) { - Log.w(TAG, "In package " + ai.packageName - + " specifies both a name and a process; ignoring the process"); - ai.processName = null; } final int innerDepth = parser.getDepth(); @@ -1257,6 +1300,12 @@ public class PackageParser { a.info.flags |= ActivityInfo.FLAG_CLEAR_TASK_ON_LAUNCH; } + if (sa.getBoolean( + com.android.internal.R.styleable.AndroidManifestActivity_noHistory, + false)) { + a.info.flags |= ActivityInfo.FLAG_NO_HISTORY; + } + if (sa.getBoolean( com.android.internal.R.styleable.AndroidManifestActivity_alwaysRetainTaskState, false)) { @@ -1291,6 +1340,9 @@ public class PackageParser { a.info.configChanges = sa.getInt( com.android.internal.R.styleable.AndroidManifestActivity_configChanges, 0); + a.info.softInputMode = sa.getInt( + com.android.internal.R.styleable.AndroidManifestActivity_windowSoftInputMode, + 0); } else { a.info.launchMode = ActivityInfo.LAUNCH_MULTIPLE; a.info.configChanges = 0; @@ -2002,6 +2054,12 @@ public class PackageParser { // Additional data supplied by callers. public Object mExtras; + + /* + * Applications hardware preferences + */ + public final ArrayList configPreferences = + new ArrayList(); public Package(String _name) { packageName = _name; @@ -2031,7 +2089,7 @@ public class PackageParser { metaData = clone.metaData; } } - + public final static class Permission extends Component { public final PermissionInfo info; public boolean tree; diff --git a/core/java/android/content/res/ColorStateList.java b/core/java/android/content/res/ColorStateList.java index ee88c899abe5c..4b1e67843608c 100644 --- a/core/java/android/content/res/ColorStateList.java +++ b/core/java/android/content/res/ColorStateList.java @@ -16,6 +16,10 @@ package android.content.res; +import com.google.android.collect.Lists; + +import com.android.internal.util.ArrayUtils; + import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParserException; @@ -30,8 +34,6 @@ import java.io.IOException; import java.lang.ref.WeakReference; import java.util.Arrays; -import com.android.internal.util.ArrayUtils; - /** * * Lets you map {@link android.view.View} state sets to colors. diff --git a/core/java/android/content/res/Configuration.java b/core/java/android/content/res/Configuration.java index 78a90de6c7110..7e4b7ac1803cd 100644 --- a/core/java/android/content/res/Configuration.java +++ b/core/java/android/content/res/Configuration.java @@ -34,6 +34,12 @@ public final class Configuration implements Parcelable, Comparable

      + *
    • {@link TypedValue#TYPE_STRING}: + * {@link Bundle#putCharSequence Bundle.putCharSequence()} + *
    • {@link TypedValue#TYPE_INT_BOOLEAN}: + * {@link Bundle#putCharSequence Bundle.putBoolean()} + *
    • {@link TypedValue#TYPE_FIRST_INT}-{@link TypedValue#TYPE_LAST_INT}: + * {@link Bundle#putCharSequence Bundle.putBoolean()} + *
    • {@link TypedValue#TYPE_FLOAT}: + * {@link Bundle#putCharSequence Bundle.putFloat()} + *
    + * + * @param tagName The name of the tag these attributes come from; this is + * only used for reporting error messages. + * @param attrs The attributes from which to retrieve the name/value pair. + * @param outBundle The Bundle in which to place the parsed value. + * @throws XmlPullParserException If the attributes are not valid. + */ + public void parseBundleExtra(String tagName, AttributeSet attrs, + Bundle outBundle) throws XmlPullParserException { + TypedArray sa = obtainAttributes(attrs, + com.android.internal.R.styleable.Extra); + + String name = sa.getString( + com.android.internal.R.styleable.Extra_name); + if (name == null) { + sa.recycle(); + throw new XmlPullParserException("<" + tagName + + "> requires an android:name attribute at " + + attrs.getPositionDescription()); + } + + TypedValue v = sa.peekValue( + com.android.internal.R.styleable.Extra_value); + if (v != null) { + if (v.type == TypedValue.TYPE_STRING) { + CharSequence cs = v.coerceToString(); + outBundle.putCharSequence(name, cs); + } else if (v.type == TypedValue.TYPE_INT_BOOLEAN) { + outBundle.putBoolean(name, v.data != 0); + } else if (v.type >= TypedValue.TYPE_FIRST_INT + && v.type <= TypedValue.TYPE_LAST_INT) { + outBundle.putInt(name, v.data); + } else if (v.type == TypedValue.TYPE_FLOAT) { + outBundle.putFloat(name, v.getFloat()); + } else { + sa.recycle(); + throw new XmlPullParserException("<" + tagName + + "> only supports string, integer, float, color, and boolean at " + + attrs.getPositionDescription()); + } + } else { + sa.recycle(); + throw new XmlPullParserException("<" + tagName + + "> requires an android:value or android:resource attribute at " + + attrs.getPositionDescription()); + } + + sa.recycle(); + } + /** * Retrieve underlying AssetManager storage for these resources. */ diff --git a/core/java/android/content/res/StringBlock.java b/core/java/android/content/res/StringBlock.java index da32cc82c81f5..3df770889d66f 100644 --- a/core/java/android/content/res/StringBlock.java +++ b/core/java/android/content/res/StringBlock.java @@ -96,6 +96,7 @@ final class StringBlock { mStyleIDs.subId = nativeIndexOfString(mNative, "sub"); mStyleIDs.strikeId = nativeIndexOfString(mNative, "strike"); mStyleIDs.listItemId = nativeIndexOfString(mNative, "li"); + mStyleIDs.marqueeId = nativeIndexOfString(mNative, "marquee"); if (localLOGV) Log.v(TAG, "BoldId=" + mStyleIDs.boldId + ", ItalicId=" + mStyleIDs.italicId @@ -127,6 +128,7 @@ final class StringBlock { private int supId; private int strikeId; private int listItemId; + private int marqueeId; } private CharSequence applyStyles(String str, int[] style, StyleIDs ids) { @@ -179,6 +181,10 @@ final class StringBlock { buffer.setSpan(new BulletSpan(10), style[i+1], style[i+2]+1, Spannable.SPAN_PARAGRAPH); + } else if (type == ids.marqueeId) { + buffer.setSpan(TextUtils.TruncateAt.MARQUEE, + style[i+1], style[i+2]+1, + Spannable.SPAN_INCLUSIVE_INCLUSIVE); } else { String tag = nativeGetString(mNative, type); @@ -216,6 +222,15 @@ final class StringBlock { style[i+1], style[i+2]+1, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); } + } else if (tag.startsWith("a;")) { + String sub; + + sub = subtag(tag, ";href="); + if (sub != null) { + buffer.setSpan(new URLSpan(sub), + style[i+1], style[i+2]+1, + Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); + } } } diff --git a/core/java/android/database/AbstractCursor.java b/core/java/android/database/AbstractCursor.java index e81f7f81fd06d..76f0860b9d36d 100644 --- a/core/java/android/database/AbstractCursor.java +++ b/core/java/android/database/AbstractCursor.java @@ -21,6 +21,10 @@ import android.net.Uri; import android.util.Config; import android.util.Log; import android.os.Bundle; +import android.os.Handler; +import android.os.HandlerThread; +import android.os.Looper; +import android.os.Message; import java.lang.ref.WeakReference; import java.lang.UnsupportedOperationException; @@ -457,9 +461,24 @@ public abstract class AbstractCursor implements CrossProcessCursor { mContentObservable.unregisterObserver(observer); } } - + + /** + * @hide pending API council approval + */ + protected void notifyDataSetChange() { + mDataSetObservable.notifyChanged(); + } + + /** + * @hide pending API council approval + */ + protected DataSetObservable getDataSetObservable() { + return mDataSetObservable; + + } public void registerDataSetObserver(DataSetObserver observer) { mDataSetObservable.registerObserver(observer); + } public void unregisterDataSetObserver(DataSetObserver observer) { diff --git a/core/java/android/database/AbstractWindowedCursor.java b/core/java/android/database/AbstractWindowedCursor.java index 1ec4312f114dc..4ac0aef81ea38 100644 --- a/core/java/android/database/AbstractWindowedCursor.java +++ b/core/java/android/database/AbstractWindowedCursor.java @@ -172,7 +172,7 @@ public abstract class AbstractWindowedCursor extends AbstractCursor super.checkPosition(); if (mWindow == null) { - throw new StaleDataException("This cursor has changed, you must call requery()"); + throw new StaleDataException("Access closed cursor"); } } diff --git a/core/java/android/database/CursorWindow.java b/core/java/android/database/CursorWindow.java index 72dc3a99f4535..8e2673036e063 100644 --- a/core/java/android/database/CursorWindow.java +++ b/core/java/android/database/CursorWindow.java @@ -409,8 +409,13 @@ public class CursorWindow extends SQLiteClosable implements Parcelable { * change across a call to clear(). */ public void clear() { - mStartPos = 0; - native_clear(); + acquireReference(); + try { + mStartPos = 0; + native_clear(); + } finally { + releaseReference(); + } } /** Clears out the native side of things */ diff --git a/core/java/android/database/DatabaseUtils.java b/core/java/android/database/DatabaseUtils.java index ab0dc3f7d3a95..2ff72947879f8 100644 --- a/core/java/android/database/DatabaseUtils.java +++ b/core/java/android/database/DatabaseUtils.java @@ -240,6 +240,21 @@ public class DatabaseUtils { } } + /** + * Concatenates two SQL WHERE clauses, handling empty or null values. + * @hide + */ + public static String concatenateWhere(String a, String b) { + if (TextUtils.isEmpty(a)) { + return b; + } + if (TextUtils.isEmpty(b)) { + return a; + } + + return "(" + a + ") AND (" + b + ")"; + } + /** * return the collation key * @param name diff --git a/core/java/android/database/sqlite/SQLiteCursor.java b/core/java/android/database/sqlite/SQLiteCursor.java index ae2fc956e751e..70b9b835b5bb1 100644 --- a/core/java/android/database/sqlite/SQLiteCursor.java +++ b/core/java/android/database/sqlite/SQLiteCursor.java @@ -18,7 +18,12 @@ package android.database.sqlite; import android.database.AbstractWindowedCursor; import android.database.CursorWindow; +import android.database.DataSetObserver; import android.database.SQLException; + +import android.os.Handler; +import android.os.Message; +import android.os.Process; import android.text.TextUtils; import android.util.Config; import android.util.Log; @@ -26,6 +31,7 @@ import android.util.Log; import java.util.HashMap; import java.util.Iterator; import java.util.Map; +import java.util.concurrent.locks.ReentrantLock; /** * A Cursor implementation that exposes results from a query on a @@ -59,7 +65,131 @@ public class SQLiteCursor extends AbstractWindowedCursor { /** Used to find out where a cursor was allocated in case it never got * released. */ private StackTraceElement[] mStackTraceElements; - + + /** + * mMaxRead is the max items that each cursor window reads + * default to a very high value + */ + private int mMaxRead = Integer.MAX_VALUE; + private int mInitialRead = Integer.MAX_VALUE; + private int mCursorState = 0; + private ReentrantLock mLock = null; + private boolean mPendingData = false; + + /** + * support for a cursor variant that doesn't always read all results + * initialRead is the initial number of items that cursor window reads + * if query contains more than this number of items, a thread will be + * created and handle the left over items so that caller can show + * results as soon as possible + * @param initialRead initial number of items that cursor read + * @param maxRead leftover items read at maxRead items per time + * @hide + */ + public void setLoadStyle(int initialRead, int maxRead) { + mMaxRead = maxRead; + mInitialRead = initialRead; + mLock = new ReentrantLock(true); + } + + private void queryThreadLock() { + if (mLock != null) { + mLock.lock(); + } + } + + private void queryThreadUnlock() { + if (mLock != null) { + mLock.unlock(); + } + } + + + /** + * @hide + */ + final private class QueryThread implements Runnable { + private final int mThreadState; + QueryThread(int version) { + mThreadState = version; + } + private void sendMessage() { + if (mNotificationHandler != null) { + mNotificationHandler.sendEmptyMessage(1); + mPendingData = false; + } else { + mPendingData = true; + } + + } + public void run() { + // use cached mWindow, to avoid get null mWindow + CursorWindow cw = mWindow; + Process.setThreadPriority(Process.myTid(), Process.THREAD_PRIORITY_BACKGROUND); + // the cursor's state doesn't change + while (true) { + mLock.lock(); + if (mCursorState != mThreadState) { + mLock.unlock(); + break; + } + try { + int count = mQuery.fillWindow(cw, mMaxRead, mCount); + // return -1 means not finished + if (count != 0) { + if (count == NO_COUNT){ + mCount += mMaxRead; + sendMessage(); + } else { + mCount = count; + sendMessage(); + break; + } + } else { + break; + } + } catch (Exception e) { + // end the tread when the cursor is close + break; + } finally { + mLock.unlock(); + } + } + } + } + + /** + * @hide + */ + protected class MainThreadNotificationHandler extends Handler { + public void handleMessage(Message msg) { + notifyDataSetChange(); + } + } + + /** + * @hide + */ + protected MainThreadNotificationHandler mNotificationHandler; + + public void registerDataSetObserver(DataSetObserver observer) { + super.registerDataSetObserver(observer); + if ((Integer.MAX_VALUE != mMaxRead || Integer.MAX_VALUE != mInitialRead) && + mNotificationHandler == null) { + queryThreadLock(); + try { + mNotificationHandler = new MainThreadNotificationHandler(); + if (mPendingData) { + notifyDataSetChange(); + mPendingData = false; + } + } finally { + queryThreadUnlock(); + } + } + + } + /** * Execute a query and provide access to its result set through a Cursor * interface. For a query such as: {@code SELECT name, birth, phone FROM @@ -146,11 +276,22 @@ public class SQLiteCursor extends AbstractWindowedCursor { // If there isn't a window set already it will only be accessed locally mWindow = new CursorWindow(true /* the window is local only */); } else { - mWindow.clear(); + mCursorState++; + queryThreadLock(); + try { + mWindow.clear(); + } finally { + queryThreadUnlock(); + } } - - // mWindow must be cleared - mCount = mQuery.fillWindow(mWindow, startPos); + mWindow.setStartPosition(startPos); + mCount = mQuery.fillWindow(mWindow, mInitialRead, 0); + // return -1 means not finished + if (mCount == NO_COUNT){ + mCount = startPos + mInitialRead; + Thread t = new Thread(new QueryThread(mCursorState), "query thread"); + t.start(); + } } @Override @@ -344,6 +485,7 @@ public class SQLiteCursor extends AbstractWindowedCursor { private void deactivateCommon() { if (Config.LOGV) Log.v(TAG, "<<< Releasing cursor " + this); + mCursorState = 0; if (mWindow != null) { mWindow.close(); mWindow = null; @@ -368,6 +510,9 @@ public class SQLiteCursor extends AbstractWindowedCursor { @Override public boolean requery() { + if (isClosed()) { + return false; + } long timeStart = 0; if (Config.LOGV) { timeStart = System.currentTimeMillis(); @@ -385,8 +530,13 @@ public class SQLiteCursor extends AbstractWindowedCursor { // This one will recreate the temp table, and get its count mDriver.cursorRequeried(this); mCount = NO_COUNT; - // Requery the program that runs over the temp table - mQuery.requery(); + mCursorState++; + queryThreadLock(); + try { + mQuery.requery(); + } finally { + queryThreadUnlock(); + } } finally { mDatabase.unlock(); } @@ -405,9 +555,15 @@ public class SQLiteCursor extends AbstractWindowedCursor { } @Override - public void setWindow(CursorWindow window) { + public void setWindow(CursorWindow window) { if (mWindow != null) { - mWindow.close(); + mCursorState++; + queryThreadLock(); + try { + mWindow.close(); + } finally { + queryThreadUnlock(); + } mCount = NO_COUNT; } mWindow = window; diff --git a/core/java/android/database/sqlite/SQLiteDatabase.java b/core/java/android/database/sqlite/SQLiteDatabase.java index e49719098ffb9..fa062c86e00e3 100644 --- a/core/java/android/database/sqlite/SQLiteDatabase.java +++ b/core/java/android/database/sqlite/SQLiteDatabase.java @@ -53,6 +53,69 @@ import java.util.concurrent.locks.ReentrantLock; public class SQLiteDatabase extends SQLiteClosable { private final static String TAG = "Database"; + /** + * Algorithms used in ON CONFLICT clause + * http://www.sqlite.org/lang_conflict.html + * @hide + */ + public enum ConflictAlgorithm { + /** + * When a constraint violation occurs, an immediate ROLLBACK occurs, + * thus ending the current transaction, and the command aborts with a + * return code of SQLITE_CONSTRAINT. If no transaction is active + * (other than the implied transaction that is created on every command) + * then this algorithm works the same as ABORT. + */ + ROLLBACK("ROLLBACK"), + + /** + * When a constraint violation occurs,no ROLLBACK is executed + * so changes from prior commands within the same transaction + * are preserved. This is the default behavior. + */ + ABORT("ABORT"), + + /** + * When a constraint violation occurs, the command aborts with a return + * code SQLITE_CONSTRAINT. But any changes to the database that + * the command made prior to encountering the constraint violation + * are preserved and are not backed out. + */ + FAIL("FAIL"), + + /** + * When a constraint violation occurs, the one row that contains + * the constraint violation is not inserted or changed. + * But the command continues executing normally. Other rows before and + * after the row that contained the constraint violation continue to be + * inserted or updated normally. No error is returned. + */ + IGNORE("IGNORE"), + + /** + * When a UNIQUE constraint violation occurs, the pre-existing rows that + * are causing the constraint violation are removed prior to inserting + * or updating the current row. Thus the insert or update always occurs. + * The command continues executing normally. No error is returned. + * If a NOT NULL constraint violation occurs, the NULL value is replaced + * by the default value for that column. If the column has no default + * value, then the ABORT algorithm is used. If a CHECK constraint + * violation occurs then the IGNORE algorithm is used. When this conflict + * resolution strategy deletes rows in order to satisfy a constraint, + * it does not invoke delete triggers on those rows. + * This behavior might change in a future release. + */ + REPLACE("REPLACE"); + + private final String mValue; + ConflictAlgorithm(String value) { + mValue = value; + } + public String value() { + return mValue; + } + } + /** * Maximum Length Of A LIKE Or GLOB Pattern * The pattern matching algorithm used in the default LIKE and GLOB implementation @@ -437,8 +500,26 @@ public class SQLiteDatabase extends SQLiteClosable { * successful so far. Do not call setTransactionSuccessful before calling this. When this * returns a new transaction will have been created but not marked as successful. * @return true if the transaction was yielded + * @deprecated if the db is locked more than once (becuase of nested transactions) then the lock + * will not be yielded. Use yieldIfContendedSafely instead. */ public boolean yieldIfContended() { + return yieldIfContendedHelper(false /* do not check yielding */); + } + + /** + * Temporarily end the transaction to let other threads run. The transaction is assumed to be + * successful so far. Do not call setTransactionSuccessful before calling this. When this + * returns a new transaction will have been created but not marked as successful. This assumes + * that there are no nested transactions (beginTransaction has only been called once) and will + * through an exception if that is not the case. + * @return true if the transaction was yielded + */ + public boolean yieldIfContendedSafely() { + return yieldIfContendedHelper(true /* check yielding */); + } + + private boolean yieldIfContendedHelper(boolean checkFullyYielded) { if (mLock.getQueueLength() == 0) { // Reset the lock acquire time since we know that the thread was willing to yield // the lock at this time. @@ -448,6 +529,12 @@ public class SQLiteDatabase extends SQLiteClosable { } setTransactionSuccessful(); endTransaction(); + if (checkFullyYielded) { + if (this.isDbLockedByCurrentThread()) { + throw new IllegalStateException( + "Db locked more than once. yielfIfContended cannot yield"); + } + } beginTransaction(); return true; } @@ -1030,6 +1117,28 @@ public class SQLiteDatabase extends SQLiteClosable { } } + /** + * Runs the provided SQL and returns a cursor over the result set. + * The cursor will read an initial set of rows and the return to the caller. + * It will continue to read in batches and send data changed notifications + * when the later batches are ready. + * @param sql the SQL query. The SQL string must not be ; terminated + * @param selectionArgs You may include ?s in where clause in the query, + * which will be replaced by the values from selectionArgs. The + * values will be bound as Strings. + * @param initialRead set the initial count of items to read from the cursor + * @param maxRead set the count of items to read on each iteration after the first + * @return A {@link Cursor} object, which is positioned before the first entry + * @hide pending API council approval + */ + public Cursor rawQuery(String sql, String[] selectionArgs, + int initialRead, int maxRead) { + SQLiteCursor c = (SQLiteCursor)rawQueryWithFactory( + null, sql, selectionArgs, null); + c.setLoadStyle(initialRead, maxRead); + return c; + } + /** * Convenience method for inserting a row into the database. * @@ -1044,7 +1153,7 @@ public class SQLiteDatabase extends SQLiteClosable { */ public long insert(String table, String nullColumnHack, ContentValues values) { try { - return insertOrReplace(table, nullColumnHack, values, false); + return insertWithOnConflict(table, nullColumnHack, values, null); } catch (SQLException e) { Log.e(TAG, "Error inserting " + values, e); return -1; @@ -1066,7 +1175,7 @@ public class SQLiteDatabase extends SQLiteClosable { */ public long insertOrThrow(String table, String nullColumnHack, ContentValues values) throws SQLException { - return insertOrReplace(table, nullColumnHack, values, false) ; + return insertWithOnConflict(table, nullColumnHack, values, null); } /** @@ -1082,7 +1191,8 @@ public class SQLiteDatabase extends SQLiteClosable { */ public long replace(String table, String nullColumnHack, ContentValues initialValues) { try { - return insertOrReplace(table, nullColumnHack, initialValues, true); + return insertWithOnConflict(table, nullColumnHack, initialValues, + ConflictAlgorithm.REPLACE); } catch (SQLException e) { Log.e(TAG, "Error inserting " + initialValues, e); return -1; @@ -1103,22 +1213,38 @@ public class SQLiteDatabase extends SQLiteClosable { */ public long replaceOrThrow(String table, String nullColumnHack, ContentValues initialValues) throws SQLException { - return insertOrReplace(table, nullColumnHack, initialValues, true); + return insertWithOnConflict(table, nullColumnHack, initialValues, + ConflictAlgorithm.REPLACE); } - private long insertOrReplace(String table, String nullColumnHack, - ContentValues initialValues, boolean allowReplace) { + /** + * General method for inserting a row into the database. + * + * @param table the table to insert the row into + * @param nullColumnHack SQL doesn't allow inserting a completely empty row, + * so if initialValues is empty this column will explicitly be + * assigned a NULL value + * @param initialValues this map contains the initial column values for the + * row. The keys should be the column names and the values the + * column values + * @param algorithm {@link ConflictAlgorithm} for insert conflict resolver + * @return the row ID of the newly inserted row, or -1 if an error occurred + * @hide + */ + public long insertWithOnConflict(String table, String nullColumnHack, + ContentValues initialValues, ConflictAlgorithm algorithm) { if (!isOpen()) { throw new IllegalStateException("database not open"); } // Measurements show most sql lengths <= 152 StringBuilder sql = new StringBuilder(152); - sql.append("INSERT "); - if (allowReplace) { - sql.append("OR REPLACE "); + sql.append("INSERT"); + if (algorithm != null) { + sql.append(" OR "); + sql.append(algorithm.value()); } - sql.append("INTO "); + sql.append(" INTO "); sql.append(table); // Measurements show most values lengths < 40 StringBuilder values = new StringBuilder(40); @@ -1241,6 +1367,23 @@ public class SQLiteDatabase extends SQLiteClosable { * @return the number of rows affected */ public int update(String table, ContentValues values, String whereClause, String[] whereArgs) { + return updateWithOnConflict(table, values, whereClause, whereArgs, null); + } + + /** + * Convenience method for updating rows in the database. + * + * @param table the table to update in + * @param values a map from column names to new column values. null is a + * valid value that will be translated to NULL. + * @param whereClause the optional WHERE clause to apply when updating. + * Passing null will update all rows. + * @param algorithm {@link ConflictAlgorithm} for update conflict resolver + * @return the number of rows affected + * @hide + */ + public int updateWithOnConflict(String table, ContentValues values, + String whereClause, String[] whereArgs, ConflictAlgorithm algorithm) { if (!isOpen()) { throw new IllegalStateException("database not open"); } @@ -1251,6 +1394,11 @@ public class SQLiteDatabase extends SQLiteClosable { StringBuilder sql = new StringBuilder(120); sql.append("UPDATE "); + if (algorithm != null) { + sql.append(" OR "); + sql.append(algorithm.value()); + } + sql.append(table); sql.append(" SET "); diff --git a/core/java/android/database/sqlite/SQLiteOpenHelper.java b/core/java/android/database/sqlite/SQLiteOpenHelper.java index f6872acb4fe89..35bf6456ed97c 100644 --- a/core/java/android/database/sqlite/SQLiteOpenHelper.java +++ b/core/java/android/database/sqlite/SQLiteOpenHelper.java @@ -26,8 +26,6 @@ import android.util.Log; * optionally {@link #onOpen}, and this class takes care of opening the database * if it exists, creating it if it does not, and upgrading it as necessary. * Transactions are used to make sure the database is always in a sensible state. - * - * @see com.google.provider.NotePad.NotePadProvider */ public abstract class SQLiteOpenHelper { private static final String TAG = SQLiteOpenHelper.class.getSimpleName(); diff --git a/core/java/android/database/sqlite/SQLiteProgram.java b/core/java/android/database/sqlite/SQLiteProgram.java index e0341a2142edf..f89c87d9baa1c 100644 --- a/core/java/android/database/sqlite/SQLiteProgram.java +++ b/core/java/android/database/sqlite/SQLiteProgram.java @@ -239,7 +239,9 @@ public abstract class SQLiteProgram extends SQLiteClosable { Log.d(TAG, " " + ste); } } - onAllReferencesReleased(); + // when in finalize() it is already removed from weakhashmap + // so it is safe to not removed itself from db + onAllReferencesReleasedFromContainer(); } } diff --git a/core/java/android/database/sqlite/SQLiteQuery.java b/core/java/android/database/sqlite/SQLiteQuery.java index 40855b661f257..22c53abca37e2 100644 --- a/core/java/android/database/sqlite/SQLiteQuery.java +++ b/core/java/android/database/sqlite/SQLiteQuery.java @@ -40,9 +40,8 @@ public class SQLiteQuery extends SQLiteProgram { * Create a persistent query object. * * @param db The database that this query object is associated with - * @param query The SQL string for this query. It must include "INDEX -1 - * OFFSET ?" at the end - * @param offsetIndex The 1-based index to the OFFSET parameter + * @param query The SQL string for this query. + * @param offsetIndex The 1-based index to the OFFSET parameter, */ /* package */ SQLiteQuery(SQLiteDatabase db, String query, int offsetIndex, String[] bindArgs) { super(db, query); @@ -59,24 +58,28 @@ public class SQLiteQuery extends SQLiteProgram { * @param startPos The position to start reading rows from * @return number of total rows in the query */ - /* package */ int fillWindow(CursorWindow window, int startPos) { - if (startPos < 0) { - throw new IllegalArgumentException("startPos should > 0"); - } - window.setStartPosition(startPos); + /* package */ int fillWindow(CursorWindow window, + int maxRead, int lastPos) { mDatabase.lock(); try { acquireReference(); - window.acquireReference(); - return native_fill_window(window, startPos, mOffsetIndex); - } catch (IllegalStateException e){ - // simply ignore it - return 0; - } catch (SQLiteDatabaseCorruptException e) { - mDatabase.onCorruption(); - throw e; + try { + window.acquireReference(); + // if the start pos is not equal to 0, then most likely window is + // too small for the data set, loading by another thread + // is not safe in this situation. the native code will ignore maxRead + return native_fill_window(window, window.getStartPosition(), mOffsetIndex, + maxRead, lastPos); + } catch (IllegalStateException e){ + // simply ignore it + return 0; + } catch (SQLiteDatabaseCorruptException e) { + mDatabase.onCorruption(); + throw e; + } finally { + window.releaseReference(); + } } finally { - window.releaseReference(); releaseReference(); mDatabase.unlock(); } @@ -113,7 +116,13 @@ public class SQLiteQuery extends SQLiteProgram { releaseReference(); } } - + + /** {@hide pending API Council approval} */ + @Override + public String toString() { + return "SQLiteQuery: " + mQuery; + } + @Override public void close() { super.close(); @@ -124,11 +133,6 @@ public class SQLiteQuery extends SQLiteProgram { * Called by SQLiteCursor when it is requeried. */ /* package */ void requery() { - boolean oldMClosed = mClosed; - if (mClosed) { - mClosed = false; - compile(mQuery, false); - } if (mBindArgs != null) { int len = mBindArgs.length; try { @@ -136,8 +140,7 @@ public class SQLiteQuery extends SQLiteProgram { super.bindString(i + 1, mBindArgs[i]); } } catch (SQLiteMisuseException e) { - StringBuilder errMsg = new StringBuilder - ("old mClosed " + oldMClosed + " mQuery " + mQuery); + StringBuilder errMsg = new StringBuilder("mQuery " + mQuery); for (int i = 0; i < len; i++) { errMsg.append(" "); errMsg.append(mBindArgs[i]); @@ -174,7 +177,8 @@ public class SQLiteQuery extends SQLiteProgram { if (!mClosed) super.bindString(index, value); } - private final native int native_fill_window(CursorWindow window, int startPos, int offsetParam); + private final native int native_fill_window(CursorWindow window, + int startPos, int offsetParam, int maxRead, int lastPos); private final native int native_column_count(); diff --git a/core/java/android/hardware/Camera.java b/core/java/android/hardware/Camera.java index 833075078a19c..dc757480d9a83 100644 --- a/core/java/android/hardware/Camera.java +++ b/core/java/android/hardware/Camera.java @@ -18,6 +18,7 @@ package android.hardware; import java.lang.ref.WeakReference; import java.util.HashMap; +import java.io.IOException; import android.util.Log; import android.view.Surface; @@ -97,14 +98,29 @@ public class Camera { native_release(); } + /** + * Reconnect to the camera after passing it to MediaRecorder. To save + * setup/teardown time, a client of Camara can pass an initialized Camera + * object to a MediaRecorder to use for video recording. Once the + * MediaRecorder is done with the Camera, this method can be used to + * re-establish a connection with the camera hardware. + * + * @throws IOException if the method fails. + * + * FIXME: Unhide after approval + * @hide + */ + public native final void reconnect() throws IOException; + /** * Sets the SurfaceHolder to be used for a picture preview. If the surface * changed since the last call, the screen will blank. Nothing happens * if the same surface is re-set. * * @param holder the SurfaceHolder upon which to place the picture preview + * @throws IOException if the method fails. */ - public final void setPreviewDisplay(SurfaceHolder holder) { + public final void setPreviewDisplay(SurfaceHolder holder) throws IOException { setPreviewDisplay(holder.getSurface()); } @@ -263,10 +279,19 @@ public class Camera { }; /** - * Registers a callback to be invoked when a picture is taken. + * Triggers an asynchronous image capture. The camera service + * will initiate a series of callbacks to the application as the + * image capture progresses. The shutter callback occurs after + * the image is captured. This can be used to trigger a sound + * to let the user know that image has been captured. The raw + * callback occurs when the raw image data is available. The jpeg + * callback occurs when the compressed image is available. If the + * application does not need a particular callback, a null can be + * passed instead of a callback method. * - * @param raw the callback to run for raw images, may be null - * @param jpeg the callback to run for jpeg images, may be null + * @param shutter callback after the image is captured, may be null + * @param raw callback with raw image data, may be null + * @param jpeg callback with jpeg image data, may be null */ public final void takePicture(ShutterCallback shutter, PictureCallback raw, PictureCallback jpeg) { diff --git a/core/java/android/hardware/ISensorService.aidl b/core/java/android/hardware/ISensorService.aidl index b6ac3aba683f0..8aad9b465bda0 100644 --- a/core/java/android/hardware/ISensorService.aidl +++ b/core/java/android/hardware/ISensorService.aidl @@ -26,5 +26,4 @@ interface ISensorService { ParcelFileDescriptor getDataChanel(); boolean enableSensor(IBinder listener, int sensor, int enable); - oneway void reportAccuracy(int sensor, int value); } diff --git a/core/java/android/hardware/Sensor.java b/core/java/android/hardware/Sensor.java new file mode 100644 index 0000000000000..0ce2f7bc84784 --- /dev/null +++ b/core/java/android/hardware/Sensor.java @@ -0,0 +1,146 @@ +/* + * Copyright (C) 2008 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +package android.hardware; + +/** + * Class representing a sensor. Use {@link SensorManager#getSensorList} + * to get the list of available Sensors. + */ +public class Sensor { + + /** + * A constant describing an accelerometer sensor type. + * See {@link android.hardware.SensorEvent SensorEvent} + * for more details. + */ + public static final int TYPE_ACCELEROMETER = 1; + + /** + * A constant describing a magnetic field sensor type. + * See {@link android.hardware.SensorEvent SensorEvent} + * for more details. + */ + public static final int TYPE_MAGNETIC_FIELD = 2; + + /** + * A constant describing an orientation sensor type. + * See {@link android.hardware.SensorEvent SensorEvent} + * for more details. + */ + public static final int TYPE_ORIENTATION = 3; + + /** A constant describing a gyroscope sensor type */ + public static final int TYPE_GYROSCOPE = 4; + /** A constant describing a light sensor type */ + public static final int TYPE_LIGHT = 5; + /** A constant describing a pressure sensor type */ + public static final int TYPE_PRESSURE = 6; + /** A constant describing a temperature sensor type */ + public static final int TYPE_TEMPERATURE = 7; + /** A constant describing a proximity sensor type */ + public static final int TYPE_PROXIMITY = 8; + + + /** + * A constant describing all sensor types. + */ + public static final int TYPE_ALL = -1; + + /* Some of these fields are set only by the native bindings in + * SensorManager. + */ + private String mName; + private String mVendor; + private int mVersion; + private int mHandle; + private int mType; + private float mMaxRange; + private float mResolution; + private float mPower; + private int mLegacyType; + + + Sensor() { + } + + /** + * @return name string of the sensor. + */ + public String getName() { + return mName; + } + + /** + * @return vendor string of this sensor. + */ + public String getVendor() { + return mVendor; + } + + /** + * @return generic type of this sensor. + */ + public int getType() { + return mType; + } + + /** + * @return version of the sensor's module. + */ + public int getVersion() { + return mVersion; + } + + /** + * @return maximum range of the sensor in the sensor's unit. + */ + public float getMaximumRange() { + return mMaxRange; + } + + /** + * @return resolution of the sensor in the sensor's unit. + */ + public float getResolution() { + return mResolution; + } + + /** + * @return the power in mA used by this sensor while in use + */ + public float getPower() { + return mPower; + } + + int getHandle() { + return mHandle; + } + + void setRange(float max, float res) { + mMaxRange = max; + mResolution = res; + } + + void setLegacyType(int legacyType) { + mLegacyType = legacyType; + } + + int getLegacyType() { + return mLegacyType; + } +} diff --git a/core/java/android/hardware/SensorEvent.java b/core/java/android/hardware/SensorEvent.java new file mode 100644 index 0000000000000..cf939c52a5e3e --- /dev/null +++ b/core/java/android/hardware/SensorEvent.java @@ -0,0 +1,146 @@ +/* + * Copyright (C) 2008 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.hardware; + +/** + * This class represents a sensor event and holds informations such as the + * sensor type (eg: accelerometer, orientation, etc...), the time-stamp, + * accuracy and of course the sensor's {@link SensorEvent#values data}. + * + *

    Definition of the coordinate system used by the SensorEvent API.

    + * + *

    + * The coordinate space is defined relative to the screen of the phone 
    + * in its default orientation. The axes are not swapped when the device's
    + * screen orientation changes.
    + * 
    + * The OpenGL ES coordinate system is used. The origin is in the
    + * lower-left corner  with respect to the screen, with the X axis horizontal
    + * and pointing  right, the Y axis vertical and pointing up and the Z axis
    + * pointing outside the front face of the screen. In this system, coordinates
    + * behind the screen have negative Z values.
    + * 
    + * Note: This coordinate system is different from the one used in the
    + * Android 2D APIs where the origin is in the top-left corner. 
    + *
    + *   x<0         x>0
    + *                ^
    + *                |
    + *    +-----------+-->  y>0
    + *    |           |
    + *    |           |
    + *    |           |
    + *    |           |   / z<0
    + *    |           |  /
    + *    |           | /
    + *    O-----------+/
    + *    |[]  [ ]  []/
    + *    +----------/+     y<0
    + *              /
    + *             /
    + *           |/ z>0 (toward the sky)
    + *
    + *    O: Origin (x=0,y=0,z=0)
    + * 
    + */ + +public class SensorEvent { + /** + * The length and contents of the values array vary depending on which + * sensor type is being monitored (see also {@link SensorEvent} for a + * definition of the coordinate system used): + * + *

    {@link android.hardware.Sensor#TYPE_ORIENTATION Sensor.TYPE_ORIENTATION}:

    + * All values are angles in degrees. + * + *

    values[0]: Azimuth, angle between the magnetic north direction and + * the Y axis, around the Z axis (0 to 359). + * 0=North, 90=East, 180=South, 270=West + * + *

    values[1]: Pitch, rotation around X axis (-180 to 180), + * with positive values when the z-axis moves toward the y-axis. + * + *

    values[2]: Roll, rotation around Y axis (-90 to 90), with + * positive values when the x-axis moves away from the z-axis. + * + *

    Note: This definition is different from yaw, pitch and + * roll used in aviation where the X axis is along the long side of + * the plane (tail to nose). + * + *

    Note: It is preferable to use + * {@link android.hardware.SensorManager#getRotationMatrix + * getRotationMatrix()} in conjunction with + * {@link android.hardware.SensorManager#remapCoordinateSystem + * remapCoordinateSystem()} and + * {@link android.hardware.SensorManager#getOrientation getOrientation()} + * to compute these values; while it may be more expensive, it is usually + * more accurate. + * + *

    {@link android.hardware.Sensor#TYPE_ACCELEROMETER Sensor.TYPE_ACCELEROMETER}:

    + * All values are in SI units (m/s^2) and measure the acceleration applied + * to the phone minus the force of gravity. + * + *

    values[0]: Acceleration minus Gx on the x-axis + *

    values[1]: Acceleration minus Gy on the y-axis + *

    values[2]: Acceleration minus Gz on the z-axis + * + *

    Examples: + *

  • When the device lies flat on a table and is pushed on its left + * side toward the right, the x acceleration value is positive.
  • + * + *
  • When the device lies flat on a table, the acceleration value is + * +9.81, which correspond to the acceleration of the device (0 m/s^2) + * minus the force of gravity (-9.81 m/s^2).
  • + * + *
  • When the device lies flat on a table and is pushed toward the sky + * with an acceleration of A m/s^2, the acceleration value is equal to + * A+9.81 which correspond to the acceleration of the + * device (+A m/s^2) minus the force of gravity (-9.81 m/s^2).
  • + * + * + *

    {@link android.hardware.Sensor#TYPE_MAGNETIC_FIELD Sensor.TYPE_MAGNETIC_FIELD}:

    + * All values are in micro-Tesla (uT) and measure the ambient magnetic + * field in the X, Y and Z axis. + * + */ + public final float[] values; + + /** + * The sensor that generated this event. + * See {@link android.hardware.SensorManager SensorManager} + * for details. + */ + public Sensor sensor; + + /** + * The accuracy of this event. + * See {@link android.hardware.SensorManager SensorManager} + * for details. + */ + public int accuracy; + + + /** + * The time in nanosecond at which the event happened + */ + public long timestamp; + + + SensorEvent(int size) { + values = new float[size]; + } +} diff --git a/core/java/android/hardware/SensorEventListener.java b/core/java/android/hardware/SensorEventListener.java new file mode 100644 index 0000000000000..716d0d4734742 --- /dev/null +++ b/core/java/android/hardware/SensorEventListener.java @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2008 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.hardware; + +/** + * Used for receiving notifications from the SensorManager when + * sensor values have changed. + */ +public interface SensorEventListener { + + /** + * Called when sensor values have changed. + *

    See {@link android.hardware.SensorManager SensorManager} + * for details on possible sensor types. + *

    See also {@link android.hardware.SensorEvent SensorEvent}. + * + *

    NOTE: The application doesn't own the + * {@link android.hardware.SensorEvent event} + * object passed as a parameter and therefore cannot hold on o it. + * The object may be part of an internal pool and may be reused by + * the framework. + * + * @param event the {@link android.hardware.SensorEvent SensorEvent}. + */ + public void onSensorChanged(SensorEvent event); + + /** + * Called when the accuracy of a sensor has changed. + *

    See {@link android.hardware.SensorManager SensorManager} + * for details. + * + * @param accuracy The new accuracy of this sensor + */ + public void onAccuracyChanged(Sensor sensor, int accuracy); +} diff --git a/core/java/android/hardware/SensorListener.java b/core/java/android/hardware/SensorListener.java index d676a5e093ee3..cfa184bf1784d 100644 --- a/core/java/android/hardware/SensorListener.java +++ b/core/java/android/hardware/SensorListener.java @@ -19,18 +19,74 @@ package android.hardware; /** * Used for receiving notifications from the SensorManager when * sensor values have changed. + * + * This interface is deprecated, use + * {@link android.hardware.SensorEventListener SensorEventListener} instead. + * */ +@Deprecated public interface SensorListener { /** - * Called when sensor values have changed. + *

    Called when sensor values have changed. * The length and contents of the values array vary * depending on which sensor is being monitored. * See {@link android.hardware.SensorManager SensorManager} - * for details on possible sensor types and values. + * for details on possible sensor types. * + *

    Definition of the coordinate system used below.

    + *

    The X axis refers to the screen's horizontal axis + * (the small edge in portrait mode, the long edge in landscape mode) and + * points to the right. + *

    The Y axis refers to the screen's vertical axis and points towards + * the top of the screen (the origin is in the lower-left corner). + *

    The Z axis points toward the sky when the device is lying on its back + * on a table. + *

    IMPORTANT NOTE: The axis are swapped when the + * device's screen orientation changes. To access the unswapped values, + * use indices 3, 4 and 5 in values[]. + * + *

    {@link android.hardware.SensorManager#SENSOR_ORIENTATION SENSOR_ORIENTATION}, + * {@link android.hardware.SensorManager#SENSOR_ORIENTATION_RAW SENSOR_ORIENTATION_RAW}:

    + * All values are angles in degrees. + * + *

    values[0]: Azimuth, rotation around the Z axis (0<=azimuth<360). + * 0 = North, 90 = East, 180 = South, 270 = West + * + *

    values[1]: Pitch, rotation around X axis (-180<=pitch<=180), with positive + * values when the z-axis moves toward the y-axis. + * + *

    values[2]: Roll, rotation around Y axis (-90<=roll<=90), with positive values + * when the z-axis moves toward the x-axis. + * + *

    Note that this definition of yaw, pitch and roll is different from the + * traditional definition used in aviation where the X axis is along the long + * side of the plane (tail to nose). + * + *

    {@link android.hardware.SensorManager#SENSOR_ACCELEROMETER SENSOR_ACCELEROMETER}:

    + * All values are in SI units (m/s^2) and measure contact forces. + * + *

    values[0]: force applied by the device on the x-axis + *

    values[1]: force applied by the device on the y-axis + *

    values[2]: force applied by the device on the z-axis + * + *

    Examples: + *

  • When the device is pushed on its left side toward the right, the + * x acceleration value is negative (the device applies a reaction force + * to the push toward the left)
  • + * + *
  • When the device lies flat on a table, the acceleration value is + * {@link android.hardware.SensorManager#STANDARD_GRAVITY -STANDARD_GRAVITY}, + * which correspond to the force the device applies on the table in reaction + * to gravity.
  • + * + *

    {@link android.hardware.SensorManager#SENSOR_MAGNETIC_FIELD SENSOR_MAGNETIC_FIELD}:

    + * All values are in micro-Tesla (uT) and measure the ambient magnetic + * field in the X, Y and -Z axis. + *

    Note: the magnetic field's Z axis is inverted. + * * @param sensor The ID of the sensor being monitored - * @param values The new values for the sensor + * @param values The new values for the sensor. */ public void onSensorChanged(int sensor, float[] values); @@ -40,7 +96,7 @@ public interface SensorListener { * for details. * * @param sensor The ID of the sensor being monitored - * @param accuracy The new accuracy of this sensor + * @param accuracy The new accuracy of this sensor. */ public void onAccuracyChanged(int sensor, int accuracy); } diff --git a/core/java/android/hardware/SensorManager.java b/core/java/android/hardware/SensorManager.java index 9b88fff0976f9..f02094eed63d1 100644 --- a/core/java/android/hardware/SensorManager.java +++ b/core/java/android/hardware/SensorManager.java @@ -26,6 +26,7 @@ import android.os.Handler; import android.os.Message; import android.os.ServiceManager; import android.util.Log; +import android.util.SparseArray; import android.view.IRotationWatcher; import android.view.IWindowManager; import android.view.Surface; @@ -33,7 +34,9 @@ import android.view.Surface; import java.io.FileDescriptor; import java.io.IOException; import java.util.ArrayList; -import java.util.Arrays; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; /** * Class that lets you access the device's sensors. Get an instance of this @@ -43,126 +46,119 @@ import java.util.Arrays; public class SensorManager extends IRotationWatcher.Stub { private static final String TAG = "SensorManager"; + private static final float[] mTempMatrix = new float[16]; - /** NOTE: sensor IDs must be a power of 2 */ + /* NOTE: sensor IDs must be a power of 2 */ - /** A constant describing an orientation sensor. - * Sensor values are yaw, pitch and roll - * - * Yaw is the compass heading in degrees, range [0, 360[ - * 0 = North, 90 = East, 180 = South, 270 = West - * - * Pitch indicates the tilt of the top of the device, - * with range -90 to 90. - * Positive values indicate that the bottom of the device is tilted up - * and negative values indicate the top of the device is tilted up. - * - * Roll indicates the side to side tilt of the device, - * with range -90 to 90. - * Positive values indicate that the left side of the device is tilted up - * and negative values indicate the right side of the device is tilted up. + /** + * A constant describing an orientation sensor. + * See {@link android.hardware.SensorListener SensorListener} for more details. + * @deprecated use {@link android.hardware.Sensor Sensor} instead. */ + @Deprecated public static final int SENSOR_ORIENTATION = 1 << 0; - /** A constant describing an accelerometer. - * Sensor values are acceleration in the X, Y and Z axis, - * where the X axis has positive direction toward the right side of the device, - * the Y axis has positive direction toward the top of the device - * and the Z axis has positive direction toward the front of the device. - * - * The direction of the force of gravity is indicated by acceleration values in the - * X, Y and Z axes. The typical case where the device is flat relative to the surface - * of the Earth appears as -STANDARD_GRAVITY in the Z axis - * and X and Z values close to zero. - * - * Acceleration values are given in SI units (m/s^2) - * + /** + * A constant describing an accelerometer. + * See {@link android.hardware.SensorListener SensorListener} for more details. + * @deprecated use {@link android.hardware.Sensor Sensor} instead. */ + @Deprecated public static final int SENSOR_ACCELEROMETER = 1 << 1; - /** A constant describing a temperature sensor - * Only the first value is defined for this sensor and it - * contains the ambient temperature in degree C. + /** + * A constant describing a temperature sensor + * See {@link android.hardware.SensorListener SensorListener} for more details. + * @deprecated use {@link android.hardware.Sensor Sensor} instead. */ + @Deprecated public static final int SENSOR_TEMPERATURE = 1 << 2; - /** A constant describing a magnetic sensor - * Sensor values are the magnetic vector in the X, Y and Z axis, - * where the X axis has positive direction toward the right side of the device, - * the Y axis has positive direction toward the top of the device - * and the Z axis has positive direction toward the front of the device. - * - * Magnetic values are given in micro-Tesla (uT) - * + /** + * A constant describing a magnetic sensor + * See {@link android.hardware.SensorListener SensorListener} for more details. + * @deprecated use {@link android.hardware.Sensor Sensor} instead. */ + @Deprecated public static final int SENSOR_MAGNETIC_FIELD = 1 << 3; - /** A constant describing an ambient light sensor - * Only the first value is defined for this sensor and it contains - * the ambient light measure in lux. - * + /** + * A constant describing an ambient light sensor + * See {@link android.hardware.SensorListener SensorListener} for more details. + * @deprecated use {@link android.hardware.Sensor Sensor} instead. */ + @Deprecated public static final int SENSOR_LIGHT = 1 << 4; - /** A constant describing a proximity sensor - * Only the first value is defined for this sensor and it contains - * the distance between the sensor and the object in meters (m) + /** + * A constant describing a proximity sensor + * See {@link android.hardware.SensorListener SensorListener} for more details. + * @deprecated use {@link android.hardware.Sensor Sensor} instead. */ + @Deprecated public static final int SENSOR_PROXIMITY = 1 << 5; - /** A constant describing a Tricorder - * When this sensor is available and enabled, the device can be - * used as a fully functional Tricorder. All values are returned in - * SI units. + /** + * A constant describing a Tricorder + * See {@link android.hardware.SensorListener SensorListener} for more details. + * @deprecated use {@link android.hardware.Sensor Sensor} instead. */ + @Deprecated public static final int SENSOR_TRICORDER = 1 << 6; - /** A constant describing an orientation sensor. - * Sensor values are yaw, pitch and roll - * - * Yaw is the compass heading in degrees, 0 <= range < 360 - * 0 = North, 90 = East, 180 = South, 270 = West - * - * This is similar to SENSOR_ORIENTATION except the data is not - * smoothed or filtered in any way. + /** + * A constant describing an orientation sensor. + * See {@link android.hardware.SensorListener SensorListener} for more details. + * @deprecated use {@link android.hardware.Sensor Sensor} instead. */ + @Deprecated public static final int SENSOR_ORIENTATION_RAW = 1 << 7; /** A constant that includes all sensors */ + @Deprecated public static final int SENSOR_ALL = 0x7F; /** Smallest sensor ID */ + @Deprecated public static final int SENSOR_MIN = SENSOR_ORIENTATION; /** Largest sensor ID */ + @Deprecated public static final int SENSOR_MAX = ((SENSOR_ALL + 1)>>1); - /** Index of the X value in the array returned by + /** Index of the X value in the array returned by * {@link android.hardware.SensorListener#onSensorChanged} */ + @Deprecated public static final int DATA_X = 0; - /** Index of the Y value in the array returned by + /** Index of the Y value in the array returned by * {@link android.hardware.SensorListener#onSensorChanged} */ + @Deprecated public static final int DATA_Y = 1; - /** Index of the Z value in the array returned by + /** Index of the Z value in the array returned by * {@link android.hardware.SensorListener#onSensorChanged} */ + @Deprecated public static final int DATA_Z = 2; - - /** Offset to the raw values in the array returned by + + /** Offset to the untransformed values in the array returned by * {@link android.hardware.SensorListener#onSensorChanged} */ + @Deprecated public static final int RAW_DATA_INDEX = 3; - /** Index of the raw X value in the array returned by + /** Index of the untransformed X value in the array returned by * {@link android.hardware.SensorListener#onSensorChanged} */ + @Deprecated public static final int RAW_DATA_X = 3; - /** Index of the raw X value in the array returned by + /** Index of the untransformed Y value in the array returned by * {@link android.hardware.SensorListener#onSensorChanged} */ + @Deprecated public static final int RAW_DATA_Y = 4; - /** Index of the raw X value in the array returned by + /** Index of the untransformed Z value in the array returned by * {@link android.hardware.SensorListener#onSensorChanged} */ + @Deprecated public static final int RAW_DATA_Z = 5; - - + + /** Standard gravity (g) on Earth. This value is equivalent to 1G */ public static final float STANDARD_GRAVITY = 9.80665f; @@ -177,7 +173,7 @@ public class SensorManager extends IRotationWatcher.Stub public static final float GRAVITY_JUPITER = 23.12f; public static final float GRAVITY_SATURN = 8.96f; public static final float GRAVITY_URANUS = 8.69f; - public static final float GRAVITY_NEPTUN = 11.0f; + public static final float GRAVITY_NEPTUNE = 11.0f; public static final float GRAVITY_PLUTO = 0.6f; public static final float GRAVITY_DEATH_STAR_I = 0.000000353036145f; public static final float GRAVITY_THE_ISLAND = 4.815162342f; @@ -208,52 +204,84 @@ public class SensorManager extends IRotationWatcher.Stub /** rate suitable for the user interface */ public static final int SENSOR_DELAY_UI = 2; /** rate (default) suitable for screen orientation changes */ - public static final int SENSOR_DELAY_NORMAL = 3; + public static final int SENSOR_DELAY_NORMAL = 3; + - /** The values returned by this sensor cannot be trusted, calibration * is needed or the environment doesn't allow readings */ public static final int SENSOR_STATUS_UNRELIABLE = 0; - + /** This sensor is reporting data with low accuracy, calibration with the * environment is needed */ public static final int SENSOR_STATUS_ACCURACY_LOW = 1; - /** This sensor is reporting data with an average level of accuracy, + /** This sensor is reporting data with an average level of accuracy, * calibration with the environment may improve the readings */ public static final int SENSOR_STATUS_ACCURACY_MEDIUM = 2; - + /** This sensor is reporting data with maximum accuracy */ public static final int SENSOR_STATUS_ACCURACY_HIGH = 3; - + /** see {@link #remapCoordinateSystem} */ + public static final int AXIS_X = 1; + /** see {@link #remapCoordinateSystem} */ + public static final int AXIS_Y = 2; + /** see {@link #remapCoordinateSystem} */ + public static final int AXIS_Z = 3; + /** see {@link #remapCoordinateSystem} */ + public static final int AXIS_MINUS_X = AXIS_X | 0x80; + /** see {@link #remapCoordinateSystem} */ + public static final int AXIS_MINUS_Y = AXIS_Y | 0x80; + /** see {@link #remapCoordinateSystem} */ + public static final int AXIS_MINUS_Z = AXIS_Z | 0x80; + + /*-----------------------------------------------------------------------*/ - private static final int SENSOR_DISABLE = -1; - private static final int SENSOR_ORDER_MASK = 0x1F; - private static final int SENSOR_STATUS_SHIFT = 28; private ISensorService mSensorService; - private Looper mLooper; + Looper mMainLooper; + @SuppressWarnings("deprecation") + private HashMap mLegacyListenersMap = + new HashMap(); - private static IWindowManager sWindowManager; - private static int sRotation = 0; + /*-----------------------------------------------------------------------*/ - /* The thread and the sensor list are global to the process + private static final int SENSOR_DISABLE = -1; + private static boolean sSensorModuleInitialized = false; + private static ArrayList sFullSensorsList = new ArrayList(); + private static SparseArray> sSensorListByType = new SparseArray>(); + private static IWindowManager sWindowManager; + private static int sRotation = Surface.ROTATION_0; + /* The thread and the sensor list are global to the process * but the actual thread is spawned on demand */ - static final private SensorThread sSensorThread = new SensorThread(); - static final private ArrayList sListeners = + private static SensorThread sSensorThread; + + // Used within this module from outside SensorManager, don't make private + static SparseArray sHandleToSensor = new SparseArray(); + static final ArrayList sListeners = new ArrayList(); + /*-----------------------------------------------------------------------*/ static private class SensorThread { - private Thread mThread; + Thread mThread; + + SensorThread() { + // this gets to the sensor module. We can have only one per process. + sensors_data_init(); + } + + @Override + protected void finalize() { + sensors_data_uninit(); + } // must be called with sListeners lock void startLocked(ISensorService service) { try { if (mThread == null) { ParcelFileDescriptor fd = service.getDataChanel(); - mThread = new Thread(new SensorThreadRunnable(fd, service), + mThread = new Thread(new SensorThreadRunnable(fd), SensorThread.class.getName()); mThread.start(); } @@ -263,162 +291,165 @@ public class SensorManager extends IRotationWatcher.Stub } private class SensorThreadRunnable implements Runnable { - private ISensorService mSensorService; private ParcelFileDescriptor mSensorDataFd; - private final byte mAccuracies[] = new byte[32]; - SensorThreadRunnable(ParcelFileDescriptor fd, ISensorService service) { + SensorThreadRunnable(ParcelFileDescriptor fd) { mSensorDataFd = fd; - mSensorService = service; - Arrays.fill(mAccuracies, (byte)-1); } public void run() { - int sensors_of_interest; - float[] values = new float[6]; + //Log.d(TAG, "entering main sensor thread"); + final float[] values = new float[3]; + final int[] status = new int[1]; + final long timestamp[] = new long[1]; Process.setThreadPriority(Process.THREAD_PRIORITY_DISPLAY); - synchronized (sListeners) { - _sensors_data_open(mSensorDataFd.getFileDescriptor()); - try { - mSensorDataFd.close(); - } catch (IOException e) { - // *shrug* - Log.e(TAG, "IOException: ", e); - } - mSensorDataFd = null; - //mSensorDataFd. - // the first time, compute the sensors we need. this is not - // a big deal if it changes by the time we call - // _sensors_data_poll, it'll get recomputed for the next - // round. - sensors_of_interest = 0; - final int size = sListeners.size(); - for (int i=0 ; i>>SENSOR_STATUS_SHIFT; - - if ((sensors_of_interest & sensor)!=0) { - // show the notification only if someone is listening for - // this sensor - if (accuracy != mAccuracies[sensor_order]) { - try { - mSensorService.reportAccuracy(sensor, accuracy); - mAccuracies[sensor_order] = (byte)accuracy; - } catch (RemoteException e) { - Log.e(TAG, "RemoteException in reportAccuracy: ", e); - } - } else { - accuracy = -1; - } + final int sensor = sensors_data_poll(values, status, timestamp); + + if (sensor == -1) { + // we lost the connection to the event stream. this happens + // when the last listener is removed. + Log.d(TAG, "_sensors_data_poll() failed, we bail out."); + break; } - + + int accuracy = status[0]; synchronized (sListeners) { if (sListeners.isEmpty()) { // we have no more listeners, terminate the thread - _sensors_data_close(); + sensors_data_close(); mThread = null; break; } - // convert for the current screen orientation - mapSensorDataToWindow(sensor, values, SensorManager.getRotation()); - // report the sensor event to all listeners that - // care about it. - sensors_of_interest = 0; - final int size = sListeners.size(); - for (int i=0 ; i mSensorList = new ArrayList(); + private final Handler mHandler; + private SensorEvent mValuesPool; + public int mSensors; + + ListenerDelegate(SensorEventListener listener, Sensor sensor, Handler handler) { + mSensorEventListener = listener; + Looper looper = (handler != null) ? handler.getLooper() : mMainLooper; + // currently we create one Handler instance per listener, but we could + // have one per looper (we'd need to pass the ListenerDelegate + // instance to handleMessage and keep track of them separately). + mHandler = new Handler(looper) { + @Override + public void handleMessage(Message msg) { + SensorEvent t = (SensorEvent)msg.obj; + if (t.accuracy >= 0) { + mSensorEventListener.onAccuracyChanged(t.sensor, t.accuracy); + } + mSensorEventListener.onSensorChanged(t); + returnToPool(t); + } + }; + addSensor(sensor); } - int addSensors(int sensors) { - mSensors |= sensors; - return mSensors; - } - int removeSensors(int sensors) { - mSensors &= ~sensors; - return mSensors; - } - boolean hasSensor(int sensor) { - return ((mSensors & sensor) != 0); + protected SensorEvent createSensorEvent() { + // maximal size for all legacy events is 3 + return new SensorEvent(3); } - void onSensorChanged(int sensor, float[] values, int accuracy) { - float[] v; + protected SensorEvent getFromPool() { + SensorEvent t = null; synchronized (this) { // remove the array from the pool - v = mValuesPool; + t = mValuesPool; mValuesPool = null; } + if (t == null) { + // the pool was empty, we need a new one + t = createSensorEvent(); + } + return t; + } - if (v != null) { - v[0] = values[0]; - v[1] = values[1]; - v[2] = values[2]; - v[3] = values[3]; - v[4] = values[4]; - v[5] = values[5]; - } else { - // the pool was empty, we need to dup the array - v = values.clone(); + protected void returnToPool(SensorEvent t) { + synchronized (this) { + // put back the array into the pool + if (mValuesPool == null) { + mValuesPool = t; + } } + } + + Object getListener() { + return mSensorEventListener; + } + + int addSensor(Sensor sensor) { + mSensors |= 1< getSensors() { + return mSensorList; + } + void onSensorChangedLocked(Sensor sensor, float[] values, long[] timestamp, int accuracy) { + SensorEvent t = getFromPool(); + final float[] v = t.values; + v[0] = values[0]; + v[1] = values[1]; + v[2] = values[2]; + t.timestamp = timestamp[0]; + t.accuracy = accuracy; + t.sensor = sensor; Message msg = Message.obtain(); - msg.what = sensor; - msg.obj = v; - msg.arg1 = accuracy; + msg.what = 0; + msg.obj = t; mHandler.sendMessage(msg); } - - private final Handler mHandler = new Handler(mLooper) { - @Override public void handleMessage(Message msg) { - if (msg.arg1 >= 0) { - try { - mListener.onAccuracyChanged(msg.what, msg.arg1); - } catch (AbstractMethodError e) { - // old app that doesn't implement this method - // just ignore it. - } - } - mListener.onSensorChanged(msg.what, (float[])msg.obj); - synchronized (this) { - // put back the array into the pool - if (mValuesPool == null) { - mValuesPool = (float[])msg.obj; - } - } - } - }; } /** @@ -427,41 +458,157 @@ public class SensorManager extends IRotationWatcher.Stub public SensorManager(Looper mainLooper) { mSensorService = ISensorService.Stub.asInterface( ServiceManager.getService(Context.SENSOR_SERVICE)); - - sWindowManager = IWindowManager.Stub.asInterface( - ServiceManager.getService("window")); + mMainLooper = mainLooper; - if (sWindowManager != null) { - // if it's null we're running in the system process - // which won't get the rotated values - try { - sWindowManager.watchRotation(this); - } catch (RemoteException e) { + + synchronized(sListeners) { + if (!sSensorModuleInitialized) { + sSensorModuleInitialized = true; + + nativeClassInit(); + + sWindowManager = IWindowManager.Stub.asInterface( + ServiceManager.getService("window")); + if (sWindowManager != null) { + // if it's null we're running in the system process + // which won't get the rotated values + try { + sRotation = sWindowManager.watchRotation(this); + } catch (RemoteException e) { + } + } + + // initialize the sensor list + sensors_module_init(); + final ArrayList fullList = sFullSensorsList; + int i = 0; + do { + Sensor sensor = new Sensor(); + i = sensors_module_get_next_sensor(sensor, i); + + if (i>=0) { + Log.d(TAG, "found sensor: " + sensor.getName() + + ", handle=" + sensor.getHandle()); + sensor.setLegacyType(getLegacySensorType(sensor.getType())); + fullList.add(sensor); + sHandleToSensor.append(sensor.getHandle(), sensor); + } + } while (i>0); + + sSensorThread = new SensorThread(); } } + } - mLooper = mainLooper; + private int getLegacySensorType(int type) { + switch (type) { + case Sensor.TYPE_ACCELEROMETER: + return SENSOR_ACCELEROMETER; + case Sensor.TYPE_MAGNETIC_FIELD: + return SENSOR_MAGNETIC_FIELD; + case Sensor.TYPE_ORIENTATION: + return SENSOR_ORIENTATION_RAW; + case Sensor.TYPE_TEMPERATURE: + return SENSOR_TEMPERATURE; + } + return 0; } - /** @return available sensors */ + /** @return available sensors. + * @deprecated This method is deprecated, use + * {@link SensorManager#getSensorList(int)} instead + */ + @Deprecated public int getSensors() { - return _sensors_data_get_sensors(); + int result = 0; + final ArrayList fullList = sFullSensorsList; + for (Sensor i : fullList) { + switch (i.getType()) { + case Sensor.TYPE_ACCELEROMETER: + result |= SensorManager.SENSOR_ACCELEROMETER; + break; + case Sensor.TYPE_MAGNETIC_FIELD: + result |= SensorManager.SENSOR_MAGNETIC_FIELD; + break; + case Sensor.TYPE_ORIENTATION: + result |= SensorManager.SENSOR_ORIENTATION | + SensorManager.SENSOR_ORIENTATION_RAW; + break; + } + } + return result; } + /** + * Use this method to get the list of available sensors of a certain + * type. Make multiple calls to get sensors of different types or use + * {@link android.hardware.Sensor#TYPE_ALL Sensor.TYPE_ALL} to get all + * the sensors. + * + * @param type of sensors requested + * @return a list of sensors matching the asked type. + */ + public List getSensorList(int type) { + // cache the returned lists the first time + List list; + final ArrayList fullList = sFullSensorsList; + synchronized(fullList) { + list = sSensorListByType.get(type); + if (list == null) { + if (type == Sensor.TYPE_ALL) { + list = fullList; + } else { + list = new ArrayList(); + for (Sensor i : fullList) { + if (i.getType() == type) + list.add(i); + } + } + list = Collections.unmodifiableList(list); + sSensorListByType.append(type, list); + } + } + return list; + } + + /** + * Use this method to get the default sensor for a given type. Note that + * the returned sensor could be a composite sensor, and its data could be + * averaged or filtered. If you need to access the raw sensors use + * {@link SensorManager#getSensorList(int) getSensorList}. + * + * + * @param type of sensors requested + * @return the default sensors matching the asked type. + */ + public Sensor getDefaultSensor(int type) { + // TODO: need to be smarter, for now, just return the 1st sensor + List l = getSensorList(type); + return l.isEmpty() ? null : l.get(0); + } + + /** * Registers a listener for given sensors. + * @deprecated This method is deprecated, use + * {@link SensorManager#registerListener(SensorEventListener, Sensor, int)} + * instead. * * @param listener sensor listener object * @param sensors a bit masks of the sensors to register to * * @return true if the sensor is supported and successfully enabled */ + @Deprecated public boolean registerListener(SensorListener listener, int sensors) { return registerListener(listener, sensors, SENSOR_DELAY_NORMAL); } /** - * Registers a listener for given sensors. + * Registers a SensorListener for given sensors. + * @deprecated This method is deprecated, use + * {@link SensorManager#registerListener(SensorEventListener, Sensor, int)} + * instead. * * @param listener sensor listener object * @param sensors a bit masks of the sensors to register to @@ -471,9 +618,189 @@ public class SensorManager extends IRotationWatcher.Stub * * @return true if the sensor is supported and successfully enabled */ + @Deprecated public boolean registerListener(SensorListener listener, int sensors, int rate) { - boolean result; + boolean result = false; + result = registerLegacyListener(SENSOR_ACCELEROMETER, Sensor.TYPE_ACCELEROMETER, + listener, sensors, rate) || result; + result = registerLegacyListener(SENSOR_MAGNETIC_FIELD, Sensor.TYPE_MAGNETIC_FIELD, + listener, sensors, rate) || result; + result = registerLegacyListener(SENSOR_ORIENTATION_RAW, Sensor.TYPE_ORIENTATION, + listener, sensors, rate) || result; + result = registerLegacyListener(SENSOR_ORIENTATION, Sensor.TYPE_ORIENTATION, + listener, sensors, rate) || result; + result = registerLegacyListener(SENSOR_TEMPERATURE, Sensor.TYPE_TEMPERATURE, + listener, sensors, rate) || result; + return result; + } + @SuppressWarnings("deprecation") + private boolean registerLegacyListener(int legacyType, int type, + SensorListener listener, int sensors, int rate) + { + boolean result = false; + // Are we activating this legacy sensor? + if ((sensors & legacyType) != 0) { + // if so, find a suitable Sensor + Sensor sensor = getDefaultSensor(type); + if (sensor != null) { + // If we don't already have one, create a LegacyListener + // to wrap this listener and process the events as + // they are expected by legacy apps. + LegacyListener legacyListener = null; + synchronized (mLegacyListenersMap) { + legacyListener = mLegacyListenersMap.get(listener); + if (legacyListener == null) { + // we didn't find a LegacyListener for this client, + // create one, and put it in our list. + legacyListener = new LegacyListener(listener); + mLegacyListenersMap.put(listener, legacyListener); + } + } + // register this legacy sensor with this legacy listener + legacyListener.registerSensor(legacyType); + // and finally, register the legacy listener with the new apis + result = registerListener(legacyListener, sensor, rate); + } + } + return result; + } + + /** + * Unregisters a listener for the sensors with which it is registered. + * @deprecated This method is deprecated, use + * {@link SensorManager#unregisterListener(SensorEventListener, Sensor)} + * instead. + * + * @param listener a SensorListener object + * @param sensors a bit masks of the sensors to unregister from + */ + @Deprecated + public void unregisterListener(SensorListener listener, int sensors) { + unregisterLegacyListener(SENSOR_ACCELEROMETER, Sensor.TYPE_ACCELEROMETER, + listener, sensors); + unregisterLegacyListener(SENSOR_MAGNETIC_FIELD, Sensor.TYPE_MAGNETIC_FIELD, + listener, sensors); + unregisterLegacyListener(SENSOR_ORIENTATION_RAW, Sensor.TYPE_ORIENTATION, + listener, sensors); + unregisterLegacyListener(SENSOR_ORIENTATION, Sensor.TYPE_ORIENTATION, + listener, sensors); + unregisterLegacyListener(SENSOR_TEMPERATURE, Sensor.TYPE_TEMPERATURE, + listener, sensors); + } + + @SuppressWarnings("deprecation") + private void unregisterLegacyListener(int legacyType, int type, + SensorListener listener, int sensors) + { + // do we know about this listener? + LegacyListener legacyListener = null; + synchronized (mLegacyListenersMap) { + legacyListener = mLegacyListenersMap.get(listener); + } + if (legacyListener != null) { + // Are we deactivating this legacy sensor? + if ((sensors & legacyType) != 0) { + // if so, find the corresponding Sensor + Sensor sensor = getDefaultSensor(type); + if (sensor != null) { + // unregister this legacy sensor and if we don't + // need the corresponding Sensor, unregister it too + if (legacyListener.unregisterSensor(legacyType)) { + // corresponding sensor not needed, unregister + unregisterListener(legacyListener, sensor); + // finally check if we still need the legacyListener + // in our mapping, if not, get rid of it too. + synchronized(sListeners) { + boolean found = false; + for (ListenerDelegate i : sListeners) { + if (i.getListener() == legacyListener) { + found = true; + break; + } + } + if (!found) { + synchronized (mLegacyListenersMap) { + mLegacyListenersMap.remove(listener); + } + } + } + } + } + } + } + } + + /** + * Unregisters a listener for all sensors. + * @deprecated This method is deprecated, use + * {@link SensorManager#unregisterListener(SensorEventListener)} + * instead. + * + * @param listener a SensorListener object + */ + @Deprecated + public void unregisterListener(SensorListener listener) { + unregisterListener(listener, SENSOR_ALL); + } + + /** + * Unregisters a listener for the sensors with which it is registered. + * + * @param listener a SensorEventListener object + * @param sensor the sensor to unregister from + * + */ + public void unregisterListener(SensorEventListener listener, Sensor sensor) { + unregisterListener((Object)listener, sensor); + } + + /** + * Unregisters a listener for all sensors. + * + * @param listener a SensorListener object + * + */ + public void unregisterListener(SensorEventListener listener) { + unregisterListener((Object)listener); + } + + + /** + * Registers a {@link android.hardware.SensorEventListener SensorEventListener} + * for the given sensor. + * + * @param listener A {@link android.hardware.SensorEventListener SensorEventListener} object. + * @param sensor The {@link android.hardware.Sensor Sensor} to register to. + * @param rate The rate {@link android.hardware.SensorEvent sensor events} are delivered at. + * This is only a hint to the system. Events may be received faster or + * slower than the specified rate. Usually events are received faster. + * + * @return true if the sensor is supported and successfully enabled. + * + */ + public boolean registerListener(SensorEventListener listener, Sensor sensor, int rate) { + return registerListener(listener, sensor, rate, null); + } + + /** + * Registers a {@link android.hardware.SensorEventListener SensorEventListener} + * for the given sensor. + * + * @param listener A {@link android.hardware.SensorEventListener SensorEventListener} object. + * @param sensor The {@link android.hardware.Sensor Sensor} to register to. + * @param rate The rate {@link android.hardware.SensorEvent sensor events} are delivered at. + * This is only a hint to the system. Events may be received faster or + * slower than the specified rate. Usually events are received faster. + * @param handler The {@link android.os.Handler Handler} the + * {@link android.hardware.SensorEvent sensor events} will be delivered to. + * + * @return true if the sensor is supported and successfully enabled. + * + */ + public boolean registerListener(SensorEventListener listener, Sensor sensor, int rate, + Handler handler) { + boolean result; int delay = -1; switch (rate) { case SENSOR_DELAY_FASTEST: @@ -496,15 +823,15 @@ public class SensorManager extends IRotationWatcher.Stub synchronized (sListeners) { ListenerDelegate l = null; for (ListenerDelegate i : sListeners) { - if (i.mListener == listener) { + if (i.getListener() == listener) { l = i; break; } } if (l == null) { - l = new ListenerDelegate(listener, sensors); - result = mSensorService.enableSensor(l, sensors, delay); + l = new ListenerDelegate(listener, sensor, handler); + result = mSensorService.enableSensor(l, sensor.getHandle(), delay); if (result) { sListeners.add(l); sListeners.notify(); @@ -513,9 +840,9 @@ public class SensorManager extends IRotationWatcher.Stub sSensorThread.startLocked(mSensorService); } } else { - result = mSensorService.enableSensor(l, sensors, delay); + result = mSensorService.enableSensor(l, sensor.getHandle(), delay); if (result) { - l.addSensors(sensors); + l.addSensor(sensor); } } } @@ -526,25 +853,42 @@ public class SensorManager extends IRotationWatcher.Stub return result; } - /** - * Unregisters a listener for the sensors with which it is registered. - * - * @param listener a SensorListener object - * @param sensors a bit masks of the sensors to unregister from - */ - public void unregisterListener(SensorListener listener, int sensors) { + private void unregisterListener(Object listener, Sensor sensor) { try { synchronized (sListeners) { final int size = sListeners.size(); for (int i=0 ; iI as well as the rotation + * matrix R transforming a vector from the + * device coordinate system to the world's coordinate system which is + * defined as a direct orthonormal basis, where: + * + *

  • X is defined as the vector product Y.Z (It is tangential to + * the ground at the device's current location and roughly points East).
  • + *
  • Y is tangential to the ground at the device's current location and + * points towards the magnetic North Pole.
  • + *
  • Z points towards the sky and is perpendicular to the ground.
  • + *

    + *


    + *

    By definition: + *

    [0 0 g] = R * gravity (g = magnitude of gravity) + *

    [0 m 0] = I * R * geomagnetic + * (m = magnitude of geomagnetic field) + *

    R is the identity matrix when the device is aligned with the + * world's coordinate system, that is, when the device's X axis points + * toward East, the Y axis points to the North Pole and the device is facing + * the sky. * - * @param listener a SensorListener object + *

    I is a rotation matrix transforming the geomagnetic + * vector into the same coordinate space as gravity (the world's coordinate + * space). I is a simple rotation around the X axis. + * The inclination angle in radians can be computed with + * {@link #getInclination}. + *


    + * + *

    Each matrix is returned either as a 3x3 or 4x4 row-major matrix + * depending on the length of the passed array: + *

    If the array length is 16: + *

    +     *   /  M[ 0]   M[ 1]   M[ 2]   M[ 3]  \
    +     *   |  M[ 4]   M[ 5]   M[ 6]   M[ 7]  |
    +     *   |  M[ 8]   M[ 9]   M[10]   M[11]  |
    +     *   \  M[12]   M[13]   M[14]   M[15]  /
    +     *
    + * This matrix is ready to be used by OpenGL ES's + * {@link javax.microedition.khronos.opengles.GL10#glLoadMatrixf(float[], int) + * glLoadMatrixf(float[], int)}. + *

    Note that because OpenGL matrices are column-major matrices you must + * transpose the matrix before using it. However, since the matrix is a + * rotation matrix, its transpose is also its inverse, conveniently, it is + * often the inverse of the rotation that is needed for rendering; it can + * therefore be used with OpenGL ES directly. + *

    + * Also note that the returned matrices always have this form: + *

    +     *   /  M[ 0]   M[ 1]   M[ 2]   0  \
    +     *   |  M[ 4]   M[ 5]   M[ 6]   0  |
    +     *   |  M[ 8]   M[ 9]   M[10]   0  |
    +     *   \      0       0       0   1  /
    +     *
    + *

    If the array length is 9: + *

    +     *   /  M[ 0]   M[ 1]   M[ 2]  \
    +     *   |  M[ 3]   M[ 4]   M[ 5]  |
    +     *   \  M[ 6]   M[ 7]   M[ 8]  /
    +     *
    + * + *
    + *

    The inverse of each matrix can be computed easily by taking its + * transpose. + * + *

    The matrices returned by this function are meaningful only when the + * device is not free-falling and it is not close to the magnetic north. + * If the device is accelerating, or placed into a strong magnetic field, + * the returned matrices may be inaccurate. + * + * @param R is an array of 9 floats holding the rotation matrix R + * when this function returns. R can be null.

    + * @param I is an array of 9 floats holding the rotation matrix I + * when this function returns. I can be null.

    + * @param gravity is an array of 3 floats containing the gravity vector + * expressed in the device's coordinate. You can simply use the + * {@link android.hardware.SensorEvent#values values} + * returned by a {@link android.hardware.SensorEvent SensorEvent} of a + * {@link android.hardware.Sensor Sensor} of type + * {@link android.hardware.Sensor#TYPE_ACCELEROMETER TYPE_ACCELEROMETER}.

    + * @param geomagnetic is an array of 3 floats containing the geomagnetic + * vector expressed in the device's coordinate. You can simply use the + * {@link android.hardware.SensorEvent#values values} + * returned by a {@link android.hardware.SensorEvent SensorEvent} of a + * {@link android.hardware.Sensor Sensor} of type + * {@link android.hardware.Sensor#TYPE_MAGNETIC_FIELD TYPE_MAGNETIC_FIELD}. + * @return + * true on success

    + * false on failure (for instance, if the device is in free fall). + * On failure the output matrices are not modified. */ - public void unregisterListener(SensorListener listener) { - unregisterListener(listener, SENSOR_ALL); + + public static boolean getRotationMatrix(float[] R, float[] I, + float[] gravity, float[] geomagnetic) { + // TODO: move this to native code for efficiency + float Ax = gravity[0]; + float Ay = gravity[1]; + float Az = gravity[2]; + final float Ex = geomagnetic[0]; + final float Ey = geomagnetic[1]; + final float Ez = geomagnetic[2]; + float Hx = Ey*Az - Ez*Ay; + float Hy = Ez*Ax - Ex*Az; + float Hz = Ex*Ay - Ey*Ax; + final float normH = (float)Math.sqrt(Hx*Hx + Hy*Hy + Hz*Hz); + if (normH < 0.1f) { + // device is close to free fall (or in space?), or close to + // magnetic north pole. Typical values are > 100. + return false; + } + final float invH = 1.0f / normH; + Hx *= invH; + Hy *= invH; + Hz *= invH; + final float invA = 1.0f / (float)Math.sqrt(Ax*Ax + Ay*Ay + Az*Az); + Ax *= invA; + Ay *= invA; + Az *= invA; + final float Mx = Ay*Hz - Az*Hy; + final float My = Az*Hx - Ax*Hz; + final float Mz = Ax*Hy - Ay*Hx; + if (R != null) { + if (R.length == 9) { + R[0] = Hx; R[1] = Hy; R[2] = Hz; + R[3] = Mx; R[4] = My; R[5] = Mz; + R[6] = Ax; R[7] = Ay; R[8] = Az; + } else if (R.length == 16) { + R[0] = Hx; R[1] = Hy; R[2] = Hz; R[3] = 0; + R[4] = Mx; R[5] = My; R[6] = Mz; R[7] = 0; + R[8] = Ax; R[9] = Ay; R[10] = Az; R[11] = 0; + R[12] = 0; R[13] = 0; R[14] = 0; R[15] = 1; + } + } + if (I != null) { + // compute the inclination matrix by projecting the geomagnetic + // vector onto the Z (gravity) and X (horizontal component + // of geomagnetic vector) axes. + final float invE = 1.0f / (float)Math.sqrt(Ex*Ex + Ey*Ey + Ez*Ez); + final float c = (Ex*Mx + Ey*My + Ez*Mz) * invE; + final float s = (Ex*Ax + Ey*Ay + Ez*Az) * invE; + if (I.length == 9) { + I[0] = 1; I[1] = 0; I[2] = 0; + I[3] = 0; I[4] = c; I[5] = s; + I[6] = 0; I[7] =-s; I[8] = c; + } else if (I.length == 16) { + I[0] = 1; I[1] = 0; I[2] = 0; + I[4] = 0; I[5] = c; I[6] = s; + I[8] = 0; I[9] =-s; I[10]= c; + I[3] = I[7] = I[11] = I[12] = I[13] = I[14] = 0; + I[15] = 1; + } + } + return true; } + /** + * Computes the geomagnetic inclination angle in radians from the + * inclination matrix I returned by {@link #getRotationMatrix}. + * @param I inclination matrix see {@link #getRotationMatrix}. + * @return The geomagnetic inclination angle in radians. + */ + public static float getInclination(float[] I) { + if (I.length == 9) { + return (float)Math.atan2(I[5], I[4]); + } else { + return (float)Math.atan2(I[6], I[5]); + } + } /** - * Helper function to convert the specified sensor's data to the windows's - * coordinate space from the device's coordinate space. - */ - - private static void mapSensorDataToWindow(int sensor, float[] values, int orientation) { - final float x = values[DATA_X]; - final float y = values[DATA_Y]; - final float z = values[DATA_Z]; - // copy the raw raw values... - values[RAW_DATA_X] = x; - values[RAW_DATA_Y] = y; - values[RAW_DATA_Z] = z; - // TODO: add support for 180 and 270 orientations - if (orientation == Surface.ROTATION_90) { - switch (sensor) { - case SENSOR_ACCELEROMETER: - case SENSOR_MAGNETIC_FIELD: - values[DATA_X] =-y; - values[DATA_Y] = x; - values[DATA_Z] = z; - break; - case SENSOR_ORIENTATION: - case SENSOR_ORIENTATION_RAW: - values[DATA_X] = x + ((x < 270) ? 90 : -270); - values[DATA_Y] = z; - values[DATA_Z] = y; - break; + * Rotates the supplied rotation matrix so it is expressed in a + * different coordinate system. This is typically used when an application + * needs to compute the three orientation angles of the device (see + * {@link #getOrientation}) in a different coordinate system. + * + *

    When the rotation matrix is used for drawing (for instance with + * OpenGL ES), it usually doesn't need to be transformed by this + * function, unless the screen is physically rotated, such as when used + * in landscape mode. + * + *

    Examples:

    + * + *

  • Using the camera (Y axis along the camera's axis) for an augmented + * reality application where the rotation angles are needed :
  • + * + * remapCoordinateSystem(inR, AXIS_X, AXIS_Z, outR);

    + * + *

  • Using the device as a mechanical compass in landscape mode:
  • + * + * remapCoordinateSystem(inR, AXIS_Y, AXIS_MINUS_X, outR);

    + * + * Beware of the above example. This call is needed only if the device is + * physically used in landscape mode to calculate the rotation angles (see + * {@link #getOrientation}). + * If the rotation matrix is also used for rendering, it may not need to + * be transformed, for instance if your {@link android.app.Activity + * Activity} is running in landscape mode. + * + *

    Since the resulting coordinate system is orthonormal, only two axes + * need to be specified. + * + * @param inR the rotation matrix to be transformed. Usually it is the + * matrix returned by {@link #getRotationMatrix}. + * @param X defines on which world axis and direction the X axis of the + * device is mapped. + * @param Y defines on which world axis and direction the Y axis of the + * device is mapped. + * @param outR the transformed rotation matrix. inR and outR can be the same + * array, but it is not recommended for performance reason. + * @return true on success. false if the input parameters are incorrect, for + * instance if X and Y define the same axis. Or if inR and outR don't have + * the same length. + */ + + public static boolean remapCoordinateSystem(float[] inR, int X, int Y, + float[] outR) + { + if (inR == outR) { + final float[] temp = mTempMatrix; + synchronized(temp) { + // we don't expect to have a lot of contention + if (remapCoordinateSystemImpl(inR, X, Y, temp)) { + final int size = outR.length; + for (int i=0 ; i=0x80); + final boolean sy = (Y>=0x80); + final boolean sz = (Z>=0x80); + + // Perform R * r, in avoiding actual muls and adds. + final int rowLength = ((length==16)?4:3); + for (int j=0 ; j<3 ; j++) { + final int offset = j*rowLength; + for (int i=0 ; i<3 ; i++) { + if (x==i) outR[offset+i] = sx ? -inR[offset+0] : inR[offset+0]; + if (y==i) outR[offset+i] = sy ? -inR[offset+1] : inR[offset+1]; + if (z==i) outR[offset+i] = sz ? -inR[offset+2] : inR[offset+2]; + } + } + if (length == 16) { + outR[3] = outR[7] = outR[11] = outR[12] = outR[13] = outR[14] = 0; + outR[15] = 1; + } + return true; + } - private static native int _sensors_data_open(FileDescriptor fd); - private static native int _sensors_data_close(); - // returns the sensor's status in the top 4 bits of "res". - private static native int _sensors_data_poll(float[] values, int sensors); - private static native int _sensors_data_get_sensors(); + /** + * Computes the device's orientation based on the rotation matrix. + *

    When it returns, the array values is filled with the result: + *

  • values[0]: azimuth, rotation around the Z axis.
  • + *
  • values[1]: pitch, rotation around the X axis.
  • + *
  • values[2]: roll, rotation around the Y axis.
  • + *

    + * + * @param R rotation matrix see {@link #getRotationMatrix}. + * @param values an array of 3 floats to hold the result. + * @return The array values passed as argument. + */ + public static float[] getOrientation(float[] R, float values[]) { + /* + * 4x4 (length=16) case: + * / R[ 0] R[ 1] R[ 2] 0 \ + * | R[ 4] R[ 5] R[ 6] 0 | + * | R[ 8] R[ 9] R[10] 0 | + * \ 0 0 0 1 / + * + * 3x3 (length=9) case: + * / R[ 0] R[ 1] R[ 2] \ + * | R[ 3] R[ 4] R[ 5] | + * \ R[ 6] R[ 7] R[ 8] / + * + */ + if (R.length == 9) { + values[0] = (float)Math.atan2(R[1], R[4]); + values[1] = (float)Math.asin(-R[7]); + values[2] = (float)Math.atan2(-R[6], R[8]); + } else { + values[0] = (float)Math.atan2(R[1], R[5]); + values[1] = (float)Math.asin(-R[9]); + values[2] = (float)Math.atan2(-R[8], R[10]); + } + return values; + } - /** {@hide} */ + + /** + * {@hide} + */ public void onRotationChanged(int rotation) { synchronized(sListeners) { sRotation = rotation; } } - - private static int getRotation() { + + static int getRotation() { synchronized(sListeners) { return sRotation; } } -} + private class LegacyListener implements SensorEventListener { + private float mValues[] = new float[6]; + @SuppressWarnings("deprecation") + private SensorListener mTarget; + private int mSensors; + private final LmsFilter mYawfilter = new LmsFilter(); + + @SuppressWarnings("deprecation") + LegacyListener(SensorListener target) { + mTarget = target; + mSensors = 0; + } + + void registerSensor(int legacyType) { + mSensors |= legacyType; + } + + boolean unregisterSensor(int legacyType) { + mSensors &= ~legacyType; + int mask = SENSOR_ORIENTATION|SENSOR_ORIENTATION_RAW; + if (((legacyType&mask)!=0) && ((mSensors&mask)!=0)) { + return false; + } + return true; + } + + @SuppressWarnings("deprecation") + public void onAccuracyChanged(Sensor sensor, int accuracy) { + try { + mTarget.onAccuracyChanged(sensor.getLegacyType(), accuracy); + } catch (AbstractMethodError e) { + // old app that doesn't implement this method + // just ignore it. + } + } + + @SuppressWarnings("deprecation") + public void onSensorChanged(SensorEvent event) { + final float v[] = mValues; + v[0] = event.values[0]; + v[1] = event.values[1]; + v[2] = event.values[2]; + int legacyType = event.sensor.getLegacyType(); + mapSensorDataToWindow(legacyType, v, SensorManager.getRotation()); + if (event.sensor.getType() == Sensor.TYPE_ORIENTATION) { + if ((mSensors & SENSOR_ORIENTATION_RAW)!=0) { + mTarget.onSensorChanged(SENSOR_ORIENTATION_RAW, v); + } + if ((mSensors & SENSOR_ORIENTATION)!=0) { + v[0] = mYawfilter.filter(event.timestamp, v[0]); + mTarget.onSensorChanged(SENSOR_ORIENTATION, v); + } + } else { + mTarget.onSensorChanged(legacyType, v); + } + } + + /* + * Helper function to convert the specified sensor's data to the windows's + * coordinate space from the device's coordinate space. + * + * output: 3,4,5: values in the old API format + * 0,1,2: transformed values in the old API format + * + */ + private void mapSensorDataToWindow(int sensor, + float[] values, int orientation) { + float x = values[0]; + float y = values[1]; + float z = values[2]; + + switch (sensor) { + case SensorManager.SENSOR_ORIENTATION: + case SensorManager.SENSOR_ORIENTATION_RAW: + z = -z; + break; + case SensorManager.SENSOR_ACCELEROMETER: + x = -x; + y = -y; + z = -z; + break; + case SensorManager.SENSOR_MAGNETIC_FIELD: + x = -x; + y = -y; + break; + } + values[0] = x; + values[1] = y; + values[2] = z; + values[3] = x; + values[4] = y; + values[5] = z; + // TODO: add support for 180 and 270 orientations + if (orientation == Surface.ROTATION_90) { + switch (sensor) { + case SENSOR_ACCELEROMETER: + case SENSOR_MAGNETIC_FIELD: + values[0] =-y; + values[1] = x; + values[2] = z; + break; + case SENSOR_ORIENTATION: + case SENSOR_ORIENTATION_RAW: + values[0] = x + ((x < 270) ? 90 : -270); + values[1] = z; + values[2] = y; + break; + } + } + } + } + + class LmsFilter { + private static final int SENSORS_RATE_MS = 20; + private static final int COUNT = 12; + private static final float PREDICTION_RATIO = 1.0f/3.0f; + private static final float PREDICTION_TIME = (SENSORS_RATE_MS*COUNT/1000.0f)*PREDICTION_RATIO; + private float mV[] = new float[COUNT*2]; + private float mT[] = new float[COUNT*2]; + private int mIndex; + + public LmsFilter() { + mIndex = COUNT; + } + + public float filter(long time, float in) { + float v = in; + final float ns = 1.0f / 1000000000.0f; + final float t = time*ns; + float v1 = mV[mIndex]; + if ((v-v1) > 180) { + v -= 360; + } else if ((v1-v) > 180) { + v += 360; + } + /* Manage the circular buffer, we write the data twice spaced + * by COUNT values, so that we don't have to copy the array + * when it's full + */ + mIndex++; + if (mIndex >= COUNT*2) + mIndex = COUNT; + mV[mIndex] = v; + mT[mIndex] = t; + mV[mIndex-COUNT] = v; + mT[mIndex-COUNT] = t; + + float A, B, C, D, E; + float a, b; + int i; + + A = B = C = D = E = 0; + for (i=0 ; i=0)?f:-f) >= 0.5f) + f = f - (float)Math.ceil(f + 0.5f) + 1.0f; + if (f < 0) + f += 1.0f; + f *= 360.0f; + return f; + } + } + + + private static native void nativeClassInit(); + + private static native int sensors_module_init(); + private static native int sensors_module_get_next_sensor(Sensor sensor, int next); + + // Used within this module from outside SensorManager, don't make private + static native int sensors_data_init(); + static native int sensors_data_uninit(); + static native int sensors_data_open(FileDescriptor fd); + static native int sensors_data_close(); + static native int sensors_data_poll(float[] values, int[] status, long[] timestamp); +} diff --git a/core/java/android/inputmethodservice/AbstractInputMethodService.java b/core/java/android/inputmethodservice/AbstractInputMethodService.java new file mode 100644 index 0000000000000..7d02f6588db4c --- /dev/null +++ b/core/java/android/inputmethodservice/AbstractInputMethodService.java @@ -0,0 +1,170 @@ +/* + * Copyright (C) 2007-2008 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ + +package android.inputmethodservice; + +import android.app.Service; +import android.content.Intent; +import android.os.IBinder; +import android.view.KeyEvent; +import android.view.MotionEvent; +import android.view.inputmethod.InputMethod; +import android.view.inputmethod.InputMethodSession; + +/** + * AbstractInputMethodService provides a abstract base class for input methods. + * Normal input method implementations will not derive from this directly, + * instead building on top of {@link InputMethodService} or another more + * complete base class. Be sure to read {@link InputMethod} for more + * information on the basics of writing input methods. + * + *

    This class combines a Service (representing the input method component + * to the system with the InputMethod interface that input methods must + * implement. This base class takes care of reporting your InputMethod from + * the service when clients bind to it, but provides no standard implementation + * of the InputMethod interface itself. Derived classes must implement that + * interface. + */ +public abstract class AbstractInputMethodService extends Service + implements KeyEvent.Callback { + private InputMethod mInputMethod; + + /** + * Base class for derived classes to implement their {@link InputMethod} + * interface. This takes care of basic maintenance of the input method, + * but most behavior must be implemented in a derived class. + */ + public abstract class AbstractInputMethodImpl implements InputMethod { + /** + * Instantiate a new client session for the input method, by calling + * back to {@link AbstractInputMethodService#onCreateInputMethodSessionInterface() + * AbstractInputMethodService.onCreateInputMethodSessionInterface()}. + */ + public void createSession(SessionCallback callback) { + callback.sessionCreated(onCreateInputMethodSessionInterface()); + } + + /** + * Take care of enabling or disabling an existing session by calling its + * {@link AbstractInputMethodSessionImpl#revokeSelf() + * AbstractInputMethodSessionImpl.setEnabled()} method. + */ + public void setSessionEnabled(InputMethodSession session, boolean enabled) { + ((AbstractInputMethodSessionImpl)session).setEnabled(enabled); + } + + /** + * Take care of killing an existing session by calling its + * {@link AbstractInputMethodSessionImpl#revokeSelf() + * AbstractInputMethodSessionImpl.revokeSelf()} method. + */ + public void revokeSession(InputMethodSession session) { + ((AbstractInputMethodSessionImpl)session).revokeSelf(); + } + } + + /** + * Base class for derived classes to implement their {@link InputMethodSession} + * interface. This takes care of basic maintenance of the session, + * but most behavior must be implemented in a derived class. + */ + public abstract class AbstractInputMethodSessionImpl implements InputMethodSession { + boolean mEnabled = true; + boolean mRevoked; + + /** + * Check whether this session has been enabled by the system. If not + * enabled, you should not execute any calls on to it. + */ + public boolean isEnabled() { + return mEnabled; + } + + /** + * Check whether this session has been revoked by the system. Revoked + * session is also always disabled, so there is generally no need to + * explicitly check for this. + */ + public boolean isRevoked() { + return mRevoked; + } + + /** + * Change the enabled state of the session. This only works if the + * session has not been revoked. + */ + public void setEnabled(boolean enabled) { + if (!mRevoked) { + mEnabled = enabled; + } + } + + /** + * Revoke the session from the client. This disabled the session, and + * prevents it from ever being enabled again. + */ + public void revokeSelf() { + mRevoked = true; + mEnabled = false; + } + + /** + * Take care of dispatching incoming key events to the appropriate + * callbacks on the service, and tell the client when this is done. + */ + public void dispatchKeyEvent(int seq, KeyEvent event, EventCallback callback) { + boolean handled = event.dispatch(AbstractInputMethodService.this); + if (callback != null) { + callback.finishedEvent(seq, handled); + } + } + + /** + * Take care of dispatching incoming trackball events to the appropriate + * callbacks on the service, and tell the client when this is done. + */ + public void dispatchTrackballEvent(int seq, MotionEvent event, EventCallback callback) { + boolean handled = onTrackballEvent(event); + if (callback != null) { + callback.finishedEvent(seq, handled); + } + } + } + + /** + * Called by the framework during initialization, when the InputMethod + * interface for this service needs to be created. + */ + public abstract AbstractInputMethodImpl onCreateInputMethodInterface(); + + /** + * Called by the framework when a new InputMethodSession interface is + * needed for a new client of the input method. + */ + public abstract AbstractInputMethodSessionImpl onCreateInputMethodSessionInterface(); + + @Override + final public IBinder onBind(Intent intent) { + if (mInputMethod == null) { + mInputMethod = onCreateInputMethodInterface(); + } + return new IInputMethodWrapper(this, mInputMethod); + } + + public boolean onTrackballEvent(MotionEvent event) { + return false; + } +} diff --git a/core/java/android/inputmethodservice/ExtractEditText.java b/core/java/android/inputmethodservice/ExtractEditText.java new file mode 100644 index 0000000000000..e59f38b368db0 --- /dev/null +++ b/core/java/android/inputmethodservice/ExtractEditText.java @@ -0,0 +1,23 @@ +package android.inputmethodservice; + +import android.content.Context; +import android.util.AttributeSet; +import android.widget.EditText; + +/*** + * Specialization of {@link EditText} for showing and interacting with the + * extracted text in a full-screen input method. + */ +public class ExtractEditText extends EditText { + public ExtractEditText(Context context) { + super(context, null); + } + + public ExtractEditText(Context context, AttributeSet attrs) { + super(context, attrs, com.android.internal.R.attr.editTextStyle); + } + + public ExtractEditText(Context context, AttributeSet attrs, int defStyle) { + super(context, attrs, defStyle); + } +} diff --git a/core/java/android/inputmethodservice/IInputMethodSessionWrapper.java b/core/java/android/inputmethodservice/IInputMethodSessionWrapper.java new file mode 100644 index 0000000000000..40c03cd898f06 --- /dev/null +++ b/core/java/android/inputmethodservice/IInputMethodSessionWrapper.java @@ -0,0 +1,151 @@ +package android.inputmethodservice; + +import com.android.internal.os.HandlerCaller; +import com.android.internal.view.IInputMethodCallback; +import com.android.internal.view.IInputMethodSession; + +import android.content.Context; +import android.graphics.Rect; +import android.os.Bundle; +import android.os.Message; +import android.os.RemoteException; +import android.util.Log; +import android.view.KeyEvent; +import android.view.MotionEvent; +import android.view.inputmethod.CompletionInfo; +import android.view.inputmethod.ExtractedText; +import android.view.inputmethod.InputMethodSession; +import android.view.inputmethod.EditorInfo; + +class IInputMethodSessionWrapper extends IInputMethodSession.Stub + implements HandlerCaller.Callback { + private static final String TAG = "InputMethodWrapper"; + private static final boolean DEBUG = false; + + private static final int DO_FINISH_INPUT = 60; + private static final int DO_DISPLAY_COMPLETIONS = 65; + private static final int DO_UPDATE_EXTRACTED_TEXT = 67; + private static final int DO_DISPATCH_KEY_EVENT = 70; + private static final int DO_DISPATCH_TRACKBALL_EVENT = 80; + private static final int DO_UPDATE_SELECTION = 90; + private static final int DO_UPDATE_CURSOR = 95; + private static final int DO_APP_PRIVATE_COMMAND = 100; + + final HandlerCaller mCaller; + final InputMethodSession mInputMethodSession; + + // NOTE: we should have a cache of these. + static class InputMethodEventCallbackWrapper implements InputMethodSession.EventCallback { + final IInputMethodCallback mCb; + InputMethodEventCallbackWrapper(IInputMethodCallback cb) { + mCb = cb; + } + public void finishedEvent(int seq, boolean handled) { + try { + mCb.finishedEvent(seq, handled); + } catch (RemoteException e) { + } + } + } + + public IInputMethodSessionWrapper(Context context, + InputMethodSession inputMethodSession) { + mCaller = new HandlerCaller(context, this); + mInputMethodSession = inputMethodSession; + } + + public InputMethodSession getInternalInputMethodSession() { + return mInputMethodSession; + } + + public void executeMessage(Message msg) { + switch (msg.what) { + case DO_FINISH_INPUT: + mInputMethodSession.finishInput(); + return; + case DO_DISPLAY_COMPLETIONS: + mInputMethodSession.displayCompletions((CompletionInfo[])msg.obj); + return; + case DO_UPDATE_EXTRACTED_TEXT: + mInputMethodSession.updateExtractedText(msg.arg1, + (ExtractedText)msg.obj); + return; + case DO_DISPATCH_KEY_EVENT: { + HandlerCaller.SomeArgs args = (HandlerCaller.SomeArgs)msg.obj; + mInputMethodSession.dispatchKeyEvent(msg.arg1, + (KeyEvent)args.arg1, + new InputMethodEventCallbackWrapper( + (IInputMethodCallback)args.arg2)); + mCaller.recycleArgs(args); + return; + } + case DO_DISPATCH_TRACKBALL_EVENT: { + HandlerCaller.SomeArgs args = (HandlerCaller.SomeArgs)msg.obj; + mInputMethodSession.dispatchTrackballEvent(msg.arg1, + (MotionEvent)args.arg1, + new InputMethodEventCallbackWrapper( + (IInputMethodCallback)args.arg2)); + mCaller.recycleArgs(args); + return; + } + case DO_UPDATE_SELECTION: { + HandlerCaller.SomeArgs args = (HandlerCaller.SomeArgs)msg.obj; + mInputMethodSession.updateSelection(args.argi1, args.argi2, + args.argi3, args.argi4); + mCaller.recycleArgs(args); + return; + } + case DO_UPDATE_CURSOR: { + mInputMethodSession.updateCursor((Rect)msg.obj); + return; + } + case DO_APP_PRIVATE_COMMAND: { + HandlerCaller.SomeArgs args = (HandlerCaller.SomeArgs)msg.obj; + mInputMethodSession.appPrivateCommand((String)args.arg1, + (Bundle)args.arg2); + mCaller.recycleArgs(args); + return; + } + } + Log.w(TAG, "Unhandled message code: " + msg.what); + } + + public void finishInput() { + mCaller.executeOrSendMessage(mCaller.obtainMessage(DO_FINISH_INPUT)); + } + + public void displayCompletions(CompletionInfo[] completions) { + mCaller.executeOrSendMessage(mCaller.obtainMessageO( + DO_DISPLAY_COMPLETIONS, completions)); + } + + public void updateExtractedText(int token, ExtractedText text) { + mCaller.executeOrSendMessage(mCaller.obtainMessageIO( + DO_UPDATE_EXTRACTED_TEXT, token, text)); + } + + public void dispatchKeyEvent(int seq, KeyEvent event, IInputMethodCallback callback) { + mCaller.executeOrSendMessage(mCaller.obtainMessageIOO(DO_DISPATCH_KEY_EVENT, seq, + event, callback)); + } + + public void dispatchTrackballEvent(int seq, MotionEvent event, IInputMethodCallback callback) { + mCaller.executeOrSendMessage(mCaller.obtainMessageIOO(DO_DISPATCH_TRACKBALL_EVENT, seq, + event, callback)); + } + + public void updateSelection(int oldSelStart, int oldSelEnd, + int newSelStart, int newSelEnd) { + mCaller.executeOrSendMessage(mCaller.obtainMessageIIII(DO_UPDATE_SELECTION, + oldSelStart, oldSelEnd, newSelStart, newSelEnd)); + } + + public void updateCursor(Rect newCursor) { + mCaller.executeOrSendMessage(mCaller.obtainMessageO(DO_UPDATE_CURSOR, + newCursor)); + } + + public void appPrivateCommand(String action, Bundle data) { + mCaller.executeOrSendMessage(mCaller.obtainMessageOO(DO_APP_PRIVATE_COMMAND, action, data)); + } +} diff --git a/core/java/android/inputmethodservice/IInputMethodWrapper.java b/core/java/android/inputmethodservice/IInputMethodWrapper.java new file mode 100644 index 0000000000000..4108bdd654d21 --- /dev/null +++ b/core/java/android/inputmethodservice/IInputMethodWrapper.java @@ -0,0 +1,172 @@ +package android.inputmethodservice; + +import com.android.internal.os.HandlerCaller; +import com.android.internal.view.IInputContext; +import com.android.internal.view.IInputMethod; +import com.android.internal.view.IInputMethodCallback; +import com.android.internal.view.IInputMethodSession; +import com.android.internal.view.InputConnectionWrapper; + +import android.content.Context; +import android.os.IBinder; +import android.os.Message; +import android.os.RemoteException; +import android.util.Log; +import android.view.inputmethod.EditorInfo; +import android.view.inputmethod.InputBinding; +import android.view.inputmethod.InputConnection; +import android.view.inputmethod.InputMethod; +import android.view.inputmethod.InputMethodSession; + +/** + * Implements the internal IInputMethod interface to convert incoming calls + * on to it back to calls on the public InputMethod interface, scheduling + * them on the main thread of the process. + */ +class IInputMethodWrapper extends IInputMethod.Stub + implements HandlerCaller.Callback { + private static final String TAG = "InputMethodWrapper"; + private static final boolean DEBUG = false; + + private static final int DO_ATTACH_TOKEN = 10; + private static final int DO_SET_INPUT_CONTEXT = 20; + private static final int DO_UNSET_INPUT_CONTEXT = 30; + private static final int DO_START_INPUT = 32; + private static final int DO_RESTART_INPUT = 34; + private static final int DO_CREATE_SESSION = 40; + private static final int DO_SET_SESSION_ENABLED = 45; + private static final int DO_REVOKE_SESSION = 50; + private static final int DO_SHOW_SOFT_INPUT = 60; + private static final int DO_HIDE_SOFT_INPUT = 70; + + final HandlerCaller mCaller; + final InputMethod mInputMethod; + + // NOTE: we should have a cache of these. + static class InputMethodSessionCallbackWrapper implements InputMethod.SessionCallback { + final Context mContext; + final IInputMethodCallback mCb; + InputMethodSessionCallbackWrapper(Context context, IInputMethodCallback cb) { + mContext = context; + mCb = cb; + } + public void sessionCreated(InputMethodSession session) { + try { + if (session != null) { + IInputMethodSessionWrapper wrap = + new IInputMethodSessionWrapper(mContext, session); + mCb.sessionCreated(wrap); + } else { + mCb.sessionCreated(null); + } + } catch (RemoteException e) { + } + } + } + + public IInputMethodWrapper(Context context, InputMethod inputMethod) { + mCaller = new HandlerCaller(context, this); + mInputMethod = inputMethod; + } + + public InputMethod getInternalInputMethod() { + return mInputMethod; + } + + public void executeMessage(Message msg) { + switch (msg.what) { + case DO_ATTACH_TOKEN: { + mInputMethod.attachToken((IBinder)msg.obj); + return; + } + case DO_SET_INPUT_CONTEXT: { + mInputMethod.bindInput((InputBinding)msg.obj); + return; + } + case DO_UNSET_INPUT_CONTEXT: + mInputMethod.unbindInput(); + return; + case DO_START_INPUT: + mInputMethod.startInput((EditorInfo)msg.obj); + return; + case DO_RESTART_INPUT: + mInputMethod.restartInput((EditorInfo)msg.obj); + return; + case DO_CREATE_SESSION: { + mInputMethod.createSession(new InputMethodSessionCallbackWrapper( + mCaller.mContext, (IInputMethodCallback)msg.obj)); + return; + } + case DO_SET_SESSION_ENABLED: + mInputMethod.setSessionEnabled((InputMethodSession)msg.obj, + msg.arg1 != 0); + return; + case DO_REVOKE_SESSION: + mInputMethod.revokeSession((InputMethodSession)msg.obj); + return; + case DO_SHOW_SOFT_INPUT: + mInputMethod.showSoftInput(); + return; + case DO_HIDE_SOFT_INPUT: + mInputMethod.hideSoftInput(); + return; + } + Log.w(TAG, "Unhandled message code: " + msg.what); + } + + public void attachToken(IBinder token) { + mCaller.executeOrSendMessage(mCaller.obtainMessageO(DO_ATTACH_TOKEN, token)); + } + + public void bindInput(InputBinding binding) { + InputConnection ic = new InputConnectionWrapper( + IInputContext.Stub.asInterface(binding.getConnectionToken())); + InputBinding nu = new InputBinding(ic, binding); + mCaller.executeOrSendMessage(mCaller.obtainMessageO(DO_SET_INPUT_CONTEXT, nu)); + } + + public void unbindInput() { + mCaller.executeOrSendMessage(mCaller.obtainMessage(DO_UNSET_INPUT_CONTEXT)); + } + + public void startInput(EditorInfo attribute) { + mCaller.executeOrSendMessage(mCaller.obtainMessageO(DO_START_INPUT, attribute)); + } + + public void restartInput(EditorInfo attribute) { + mCaller.executeOrSendMessage(mCaller.obtainMessageO(DO_RESTART_INPUT, attribute)); + } + + public void createSession(IInputMethodCallback callback) { + mCaller.executeOrSendMessage(mCaller.obtainMessageO(DO_CREATE_SESSION, callback)); + } + + public void setSessionEnabled(IInputMethodSession session, boolean enabled) { + try { + InputMethodSession ls = ((IInputMethodSessionWrapper) + session).getInternalInputMethodSession(); + mCaller.executeOrSendMessage(mCaller.obtainMessageIO( + DO_SET_SESSION_ENABLED, enabled ? 1 : 0, ls)); + } catch (ClassCastException e) { + Log.w(TAG, "Incoming session not of correct type: " + session, e); + } + } + + public void revokeSession(IInputMethodSession session) { + try { + InputMethodSession ls = ((IInputMethodSessionWrapper) + session).getInternalInputMethodSession(); + mCaller.executeOrSendMessage(mCaller.obtainMessageO(DO_REVOKE_SESSION, ls)); + } catch (ClassCastException e) { + Log.w(TAG, "Incoming session not of correct type: " + session, e); + } + } + + public void showSoftInput() { + mCaller.executeOrSendMessage(mCaller.obtainMessage(DO_SHOW_SOFT_INPUT)); + } + + public void hideSoftInput() { + mCaller.executeOrSendMessage(mCaller.obtainMessage(DO_HIDE_SOFT_INPUT)); + } +} diff --git a/core/java/android/inputmethodservice/InputMethodService.java b/core/java/android/inputmethodservice/InputMethodService.java new file mode 100644 index 0000000000000..9ebf1271ee67f --- /dev/null +++ b/core/java/android/inputmethodservice/InputMethodService.java @@ -0,0 +1,864 @@ +/* + * Copyright (C) 2007-2008 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ + +package android.inputmethodservice; + +import static android.view.ViewGroup.LayoutParams.FILL_PARENT; +import static android.view.ViewGroup.LayoutParams.WRAP_CONTENT; + +import android.app.Dialog; +import android.content.Context; +import android.content.res.Configuration; +import android.graphics.Rect; +import android.graphics.drawable.Drawable; +import android.os.Bundle; +import android.os.IBinder; +import android.util.Log; +import android.view.KeyEvent; +import android.view.LayoutInflater; +import android.view.MotionEvent; +import android.view.View; +import android.view.ViewGroup; +import android.view.ViewTreeObserver; +import android.view.inputmethod.CompletionInfo; +import android.view.inputmethod.ExtractedText; +import android.view.inputmethod.ExtractedTextRequest; +import android.view.inputmethod.InputBinding; +import android.view.inputmethod.InputConnection; +import android.view.inputmethod.InputMethod; +import android.view.inputmethod.InputMethodManager; +import android.view.inputmethod.EditorInfo; +import android.widget.FrameLayout; + +/** + * InputMethodService provides a standard implementation of an InputMethod, + * which final implementations can derive from and customize. See the + * base class {@link AbstractInputMethodService} and the {@link InputMethod} + * interface for more information on the basics of writing input methods. + */ +public class InputMethodService extends AbstractInputMethodService { + static final String TAG = "InputMethodService"; + static final boolean DEBUG = false; + + LayoutInflater mInflater; + View mRootView; + SoftInputWindow mWindow; + boolean mWindowCreated; + boolean mWindowAdded; + boolean mWindowVisible; + FrameLayout mExtractFrame; + FrameLayout mCandidatesFrame; + FrameLayout mInputFrame; + + IBinder mToken; + + InputBinding mInputBinding; + InputConnection mInputConnection; + boolean mInputStarted; + EditorInfo mInputInfo; + + boolean mShowInputRequested; + boolean mShowCandidatesRequested; + + boolean mFullscreenApplied; + boolean mIsFullscreen; + View mExtractView; + ExtractEditText mExtractEditText; + ExtractedText mExtractedText; + int mExtractedToken; + + View mInputView; + boolean mIsInputViewShown; + + int mStatusIcon; + + final Insets mTmpInsets = new Insets(); + final int[] mTmpLocation = new int[2]; + + final ViewTreeObserver.OnComputeInternalInsetsListener mInsetsComputer = + new ViewTreeObserver.OnComputeInternalInsetsListener() { + public void onComputeInternalInsets(ViewTreeObserver.InternalInsetsInfo info) { + if (isFullscreenMode()) { + // In fullscreen mode, we just say the window isn't covering + // any content so we don't impact whatever is behind. + View decor = getWindow().getWindow().getDecorView(); + info.contentInsets.top = info.visibleInsets.top + = decor.getHeight(); + info.setTouchableInsets(ViewTreeObserver.InternalInsetsInfo.TOUCHABLE_INSETS_FRAME); + } else { + onComputeInsets(mTmpInsets); + info.contentInsets.top = mTmpInsets.contentTopInsets; + info.visibleInsets.top = mTmpInsets.visibleTopInsets; + info.setTouchableInsets(mTmpInsets.touchableInsets); + } + } + }; + + /** + * Concrete implementation of + * {@link AbstractInputMethodService.AbstractInputMethodImpl} that provides + * all of the standard behavior for an input method. + */ + public class InputMethodImpl extends AbstractInputMethodImpl { + /** + * Take care of attaching the given window token provided by the system. + */ + public void attachToken(IBinder token) { + if (mToken == null) { + mToken = token; + mWindow.setToken(token); + } + } + + /** + * Handle a new input binding, calling + * {@link InputMethodService#onBindInput InputMethodService.onBindInput()} + * when done. + */ + public void bindInput(InputBinding binding) { + mInputBinding = binding; + mInputConnection = binding.getConnection(); + onBindInput(); + } + + /** + * Clear the current input binding. + */ + public void unbindInput() { + mInputStarted = false; + mInputBinding = null; + mInputConnection = null; + } + + public void startInput(EditorInfo attribute) { + doStartInput(attribute, false); + } + + public void restartInput(EditorInfo attribute) { + doStartInput(attribute, false); + } + + /** + * Handle a request by the system to hide the soft input area. + */ + public void hideSoftInput() { + if (DEBUG) Log.v(TAG, "hideSoftInput()"); + mShowInputRequested = false; + hideWindow(); + } + + /** + * Handle a request by the system to show the soft input area. + */ + public void showSoftInput() { + if (DEBUG) Log.v(TAG, "showSoftInput()"); + showWindow(true); + } + } + + /** + * Concrete implementation of + * {@link AbstractInputMethodService.AbstractInputMethodSessionImpl} that provides + * all of the standard behavior for an input method session. + */ + public class InputMethodSessionImpl extends AbstractInputMethodSessionImpl { + public void finishInput() { + if (!isEnabled()) { + return; + } + onFinishInput(); + mInputStarted = false; + } + + /** + * Call {@link InputMethodService#onDisplayCompletions + * InputMethodService.onDisplayCompletions()}. + */ + public void displayCompletions(CompletionInfo[] completions) { + if (!isEnabled()) { + return; + } + onDisplayCompletions(completions); + } + + /** + * Call {@link InputMethodService#onUpdateExtractedText + * InputMethodService.onUpdateExtractedText()}. + */ + public void updateExtractedText(int token, ExtractedText text) { + if (!isEnabled()) { + return; + } + onUpdateExtractedText(token, text); + } + + /** + * Call {@link InputMethodService#onUpdateSelection + * InputMethodService.onUpdateSelection()}. + */ + public void updateSelection(int oldSelStart, int oldSelEnd, + int newSelStart, int newSelEnd) { + if (!isEnabled()) { + return; + } + InputMethodService.this.onUpdateSelection(oldSelStart, oldSelEnd, + newSelStart, newSelEnd); + } + + /** + * Call {@link InputMethodService#onUpdateCursor + * InputMethodService.onUpdateCursor()}. + */ + public void updateCursor(Rect newCursor) { + if (!isEnabled()) { + return; + } + InputMethodService.this.onUpdateCursor(newCursor); + } + + /** + * Call {@link InputMethodService#onAppPrivateCommand + * InputMethodService.onAppPrivateCommand()}. + */ + public void appPrivateCommand(String action, Bundle data) { + if (!isEnabled()) { + return; + } + InputMethodService.this.onAppPrivateCommand(action, data); + } + } + + /** + * Information about where interesting parts of the input method UI appear. + */ + public static final class Insets { + /** + * This is the top part of the UI that is the main content. It is + * used to determine the basic space needed, to resize/pan the + * application behind. It is assumed that this inset does not + * change very much, since any change will cause a full resize/pan + * of the application behind. This value is relative to the top edge + * of the input method window. + */ + int contentTopInsets; + + /** + * This is the top part of the UI that is visibly covering the + * application behind it. This provides finer-grained control over + * visibility, allowing you to change it relatively frequently (such + * as hiding or showing candidates) without disrupting the underlying + * UI too much. For example, this will never resize the application + * UI, will only pan if needed to make the current focus visible, and + * will not aggressively move the pan position when this changes unless + * needed to make the focus visible. This value is relative to the top edge + * of the input method window. + */ + int visibleTopInsets; + + /** + * Option for {@link #touchableInsets}: the entire window frame + * can be touched. + */ + public static final int TOUCHABLE_INSETS_FRAME + = ViewTreeObserver.InternalInsetsInfo.TOUCHABLE_INSETS_FRAME; + + /** + * Option for {@link #touchableInsets}: the area inside of + * the content insets can be touched. + */ + public static final int TOUCHABLE_INSETS_CONTENT + = ViewTreeObserver.InternalInsetsInfo.TOUCHABLE_INSETS_CONTENT; + + /** + * Option for {@link #touchableInsets}: the area inside of + * the visible insets can be touched. + */ + public static final int TOUCHABLE_INSETS_VISIBLE + = ViewTreeObserver.InternalInsetsInfo.TOUCHABLE_INSETS_VISIBLE; + + /** + * Determine which area of the window is touchable by the user. May + * be one of: {@link #TOUCHABLE_INSETS_FRAME}, + * {@link #TOUCHABLE_INSETS_CONTENT}, or {@link #TOUCHABLE_INSETS_VISIBLE}. + */ + public int touchableInsets; + } + + @Override public void onCreate() { + super.onCreate(); + mInflater = (LayoutInflater)getSystemService( + Context.LAYOUT_INFLATER_SERVICE); + mWindow = new SoftInputWindow(this); + initViews(); + } + + void initViews() { + mWindowVisible = false; + mWindowCreated = false; + mShowInputRequested = false; + mShowCandidatesRequested = false; + + mRootView = mInflater.inflate( + com.android.internal.R.layout.input_method, null); + mWindow.setContentView(mRootView); + mRootView.getViewTreeObserver().addOnComputeInternalInsetsListener(mInsetsComputer); + + mExtractFrame = (FrameLayout)mRootView.findViewById(android.R.id.extractArea); + mExtractView = null; + mExtractEditText = null; + mFullscreenApplied = false; + + mCandidatesFrame = (FrameLayout)mRootView.findViewById(android.R.id.candidatesArea); + mInputFrame = (FrameLayout)mRootView.findViewById(android.R.id.inputArea); + mInputView = null; + mIsInputViewShown = false; + + mExtractFrame.setVisibility(View.GONE); + mCandidatesFrame.setVisibility(View.GONE); + mInputFrame.setVisibility(View.GONE); + } + + @Override public void onDestroy() { + super.onDestroy(); + mRootView.getViewTreeObserver().removeOnComputeInternalInsetsListener( + mInsetsComputer); + if (mWindowAdded) { + mWindow.dismiss(); + } + } + + /** + * Implement to return our standard {@link InputMethodImpl}. Subclasses + * can override to provide their own customized version. + */ + public AbstractInputMethodImpl onCreateInputMethodInterface() { + return new InputMethodImpl(); + } + + /** + * Implement to return our standard {@link InputMethodSessionImpl}. Subclasses + * can override to provide their own customized version. + */ + public AbstractInputMethodSessionImpl onCreateInputMethodSessionInterface() { + return new InputMethodSessionImpl(); + } + + public LayoutInflater getLayoutInflater() { + return mInflater; + } + + public Dialog getWindow() { + return mWindow; + } + + /** + * Return the currently active InputBinding for the input method, or + * null if there is none. + */ + public InputBinding getCurrentInputBinding() { + return mInputBinding; + } + + /** + * Retrieve the currently active InputConnection that is bound to + * the input method, or null if there is none. + */ + public InputConnection getCurrentInputConnection() { + return mInputConnection; + } + + public boolean getCurrentInputStarted() { + return mInputStarted; + } + + public EditorInfo getCurrentInputInfo() { + return mInputInfo; + } + + /** + * Re-evaluate whether the input method should be running in fullscreen + * mode, and update its UI if this has changed since the last time it + * was evaluated. This will call {@link #onEvaluateFullscreenMode()} to + * determine whether it should currently run in fullscreen mode. You + * can use {@link #isFullscreenMode()} to determine if the input method + * is currently running in fullscreen mode. + */ + public void updateFullscreenMode() { + boolean isFullscreen = onEvaluateFullscreenMode(); + if (mIsFullscreen != isFullscreen || !mFullscreenApplied) { + mIsFullscreen = isFullscreen; + mFullscreenApplied = true; + mWindow.getWindow().setBackgroundDrawable( + onCreateBackgroundDrawable()); + mExtractFrame.setVisibility(isFullscreen ? View.VISIBLE : View.GONE); + if (isFullscreen) { + if (mExtractView == null) { + View v = onCreateExtractTextView(); + if (v != null) { + setExtractView(v); + } + } + startExtractingText(); + mWindow.getWindow().setLayout(FILL_PARENT, FILL_PARENT); + } else { + mWindow.getWindow().setLayout(WRAP_CONTENT, WRAP_CONTENT); + } + } + } + + /** + * Return whether the input method is currently running in + * fullscreen mode. This is the mode that was last determined and + * applied by {@link #updateFullscreenMode()}. + */ + public boolean isFullscreenMode() { + return mIsFullscreen; + } + + /** + * Override this to control when the input method should run in + * fullscreen mode. The default implementation runs in fullsceen only + * when the screen is in landscape mode and the input view is being + * shown ({@link #onEvaluateInputViewShown} returns true). If you change what + * this returns, you will need to call {@link #updateFullscreenMode()} + * yourself whenever the returned value may have changed to have it + * re-evaluated and applied. + */ + public boolean onEvaluateFullscreenMode() { + Configuration config = getResources().getConfiguration(); + return config.orientation == Configuration.ORIENTATION_LANDSCAPE + && onEvaluateInputViewShown(); + } + + /** + * Compute the interesting insets into your UI. The default implementation + * uses the top of the candidates frame for the visible insets, and the + * top of the input frame for the content insets. The default touchable + * insets are {@link Insets#TOUCHABLE_INSETS_VISIBLE}. + * + *

    Note that this method is not called when in fullscreen mode, since + * in that case the application is left as-is behind the input method and + * not impacted by anything in its UI. + * + * @param outInsets Fill in with the current UI insets. + */ + public void onComputeInsets(Insets outInsets) { + int[] loc = mTmpLocation; + if (mInputFrame.getVisibility() == View.VISIBLE) { + mInputFrame.getLocationInWindow(loc); + outInsets.contentTopInsets = loc[1]; + } + if (mCandidatesFrame.getVisibility() == View.VISIBLE) { + mCandidatesFrame.getLocationInWindow(loc); + outInsets.visibleTopInsets = loc[1]; + } else { + outInsets.visibleTopInsets = loc[1]; + } + outInsets.touchableInsets = Insets.TOUCHABLE_INSETS_VISIBLE; + } + + /** + * Re-evaluate whether the soft input area should currently be shown, and + * update its UI if this has changed since the last time it + * was evaluated. This will call {@link #onEvaluateInputViewShown()} to + * determine whether the input view should currently be shown. You + * can use {@link #isInputViewShown()} to determine if the input view + * is currently shown. + */ + public void updateInputViewShown() { + boolean isShown = onEvaluateInputViewShown(); + if (mIsInputViewShown != isShown && mWindowVisible) { + mIsInputViewShown = isShown; + mInputFrame.setVisibility(isShown ? View.VISIBLE : View.GONE); + if (mInputView == null) { + View v = onCreateInputView(); + if (v != null) { + setInputView(v); + } + } + } + } + + /** + * Return whether the soft input view is currently shown to the + * user. This is the state that was last determined and + * applied by {@link #updateInputViewShown()}. + */ + public boolean isInputViewShown() { + return mIsInputViewShown; + } + + /** + * Override this to control when the soft input area should be shown to + * the user. The default implementation only shows the input view when + * there is no hard keyboard or the keyboard is hidden. If you change what + * this returns, you will need to call {@link #updateInputViewShown()} + * yourself whenever the returned value may have changed to have it + * re-evalauted and applied. + */ + public boolean onEvaluateInputViewShown() { + Configuration config = getResources().getConfiguration(); + return config.keyboard == Configuration.KEYBOARD_NOKEYS + || config.hardKeyboardHidden == Configuration.KEYBOARDHIDDEN_YES; + } + + /** + * Controls the visibility of the candidates display area. By default + * it is hidden. + */ + public void setCandidatesViewShown(boolean shown) { + if (mShowCandidatesRequested != shown) { + mCandidatesFrame.setVisibility(shown ? View.VISIBLE : View.INVISIBLE); + if (!mShowInputRequested) { + // If we are being asked to show the candidates view while the app + // has not asked for the input view to be shown, then we need + // to update whether the window is shown. + if (shown) { + showWindow(false); + } else { + hideWindow(); + } + } + mShowCandidatesRequested = shown; + } + } + + public void setStatusIcon(int iconResId) { + mStatusIcon = iconResId; + if (mInputConnection != null && mWindowVisible) { + mInputConnection.showStatusIcon(getPackageName(), iconResId); + } + } + + /** + * Force switch to a new input method, as identified by id. This + * input method will be destroyed, and the requested one started on the + * current input field. + * + * @param id Unique identifier of the new input method ot start. + */ + public void switchInputMethod(String id) { + ((InputMethodManager)getSystemService(INPUT_METHOD_SERVICE)) + .setInputMethod(mToken, id); + } + + public void setExtractView(View view) { + mExtractFrame.removeAllViews(); + mExtractFrame.addView(view, new FrameLayout.LayoutParams( + ViewGroup.LayoutParams.FILL_PARENT, + ViewGroup.LayoutParams.WRAP_CONTENT)); + mExtractView = view; + if (view != null) { + mExtractEditText = (ExtractEditText)view.findViewById( + com.android.internal.R.id.inputExtractEditText); + startExtractingText(); + } else { + mExtractEditText = null; + } + } + + /** + * Replaces the current candidates view with a new one. You only need to + * call this when dynamically changing the view; normally, you should + * implement {@link #onCreateCandidatesView()} and create your view when + * first needed by the input method. + */ + public void setCandidatesView(View view) { + mCandidatesFrame.removeAllViews(); + mCandidatesFrame.addView(view, new FrameLayout.LayoutParams( + ViewGroup.LayoutParams.FILL_PARENT, + ViewGroup.LayoutParams.WRAP_CONTENT)); + } + + /** + * Replaces the current input view with a new one. You only need to + * call this when dynamically changing the view; normally, you should + * implement {@link #onCreateInputView()} and create your view when + * first needed by the input method. + */ + public void setInputView(View view) { + mInputFrame.removeAllViews(); + mInputFrame.addView(view, new FrameLayout.LayoutParams( + ViewGroup.LayoutParams.FILL_PARENT, + ViewGroup.LayoutParams.WRAP_CONTENT)); + mInputView = view; + } + + /** + * Called by the framework to create a Drawable for the background of + * the input method window. May return null for no background. The default + * implementation returns a non-null standard background only when in + * fullscreen mode. + */ + public Drawable onCreateBackgroundDrawable() { + if (isFullscreenMode()) { + return getResources().getDrawable( + com.android.internal.R.drawable.input_method_fullscreen_background); + } + return null; + } + + /** + * Called by the framework to create the layout for showing extacted text. + * Only called when in fullscreen mode. The returned view hierarchy must + * have an {@link ExtractEditText} whose ID is + * {@link android.R.id#inputExtractEditText}. + */ + public View onCreateExtractTextView() { + return mInflater.inflate( + com.android.internal.R.layout.input_method_extract_view, null); + } + + /** + * Create and return the view hierarchy used to show candidates. This will + * be called once, when the candidates are first displayed. You can return + * null to have no candidates view; the default implementation returns null. + * + *

    To control when the candidates view is displayed, use + * {@link #setCandidatesViewShown(boolean)}. + * To change the candidates view after the first one is created by this + * function, use {@link #setCandidatesView(View)}. + */ + public View onCreateCandidatesView() { + return null; + } + + /** + * Create and return the view hierarchy used for the input area (such as + * a soft keyboard). This will be called once, when the input area is + * first displayed. You can return null to have no input area; the default + * implementation returns null. + * + *

    To control when the input view is displayed, implement + * {@link #onEvaluateInputViewShown()}. + * To change the input view after the first one is created by this + * function, use {@link #setInputView(View)}. + */ + public View onCreateInputView() { + return null; + } + + /** + * Called when an input session is starting or restarting. + * + * @param info Description of the type of text being edited. + * @param restarting Set to true if we are restarting input on the + * same text field as before. + */ + public void onStartInputView(EditorInfo info, boolean restarting) { + } + + @Override + public void onConfigurationChanged(Configuration newConfig) { + super.onConfigurationChanged(newConfig); + + boolean visible = mWindowVisible; + boolean showingInput = mShowInputRequested; + boolean showingCandidates = mShowCandidatesRequested; + initViews(); + if (visible) { + if (showingCandidates) { + setCandidatesViewShown(true); + } + showWindow(showingInput); + } + } + + public void showWindow(boolean showInput) { + if (DEBUG) Log.v(TAG, "Showing window: showInput=" + showInput + + " mShowInputRequested=" + mShowInputRequested + + " mWindowAdded=" + mWindowAdded + + " mWindowCreated=" + mWindowCreated + + " mWindowVisible=" + mWindowVisible + + " mInputStarted=" + mInputStarted); + boolean doShowInput = false; + boolean wasVisible = mWindowVisible; + mWindowVisible = true; + if (!mShowInputRequested) { + doShowInput = true; + mShowInputRequested = true; + } else { + showInput = true; + } + + if (doShowInput) { + if (DEBUG) Log.v(TAG, "showWindow: updating UI"); + updateFullscreenMode(); + updateInputViewShown(); + } + + if (!mWindowAdded || !mWindowCreated) { + mWindowAdded = true; + mWindowCreated = true; + View v = onCreateCandidatesView(); + if (DEBUG) Log.v(TAG, "showWindow: candidates=" + v); + if (v != null) { + setCandidatesView(v); + } + } + if (doShowInput) { + if (mInputStarted) { + if (DEBUG) Log.v(TAG, "showWindow: starting input view"); + onStartInputView(mInputInfo, false); + } + startExtractingText(); + } + + if (!wasVisible) { + if (DEBUG) Log.v(TAG, "showWindow: showing!"); + mWindow.show(); + if (mInputConnection != null) { + mInputConnection.showStatusIcon(getPackageName(), mStatusIcon); + } + } + } + + public void hideWindow() { + if (mWindowVisible) { + mWindow.hide(); + mWindowVisible = false; + if (mInputConnection != null) { + mInputConnection.hideStatusIcon(); + } + } + } + + public void onBindInput() { + } + + public void onStartInput(EditorInfo attribute, boolean restarting) { + } + + void doStartInput(EditorInfo attribute, boolean restarting) { + mInputStarted = true; + mInputInfo = attribute; + onStartInput(attribute, restarting); + if (mWindowVisible) { + if (mWindowCreated) { + onStartInputView(mInputInfo, restarting); + } + startExtractingText(); + } + } + + public void onFinishInput() { + } + + /** + * Called when the application has reported auto-completion candidates that + * it would like to have the input method displayed. Typically these are + * only used when an input method is running in full-screen mode, since + * otherwise the user can see and interact with the pop-up window of + * completions shown by the application. + * + *

    The default implementation here does nothing. + */ + public void onDisplayCompletions(CompletionInfo[] completions) { + } + + /** + * Called when the application has reported new extracted text to be shown + * due to changes in its current text state. The default implementation + * here places the new text in the extract edit text, when the input + * method is running in fullscreen mode. + */ + public void onUpdateExtractedText(int token, ExtractedText text) { + if (mExtractedToken != token) { + return; + } + if (mExtractEditText != null && text != null) { + mExtractedText = text; + mExtractEditText.setExtractedText(text); + } + } + + /** + * Called when the application has reported a new selection region of + * the text. This is called whether or not the input method has requested + * extracted text updates, although if so it will not receive this call + * if the extracted text has changed as well. + * + *

    The default implementation takes care of updating the cursor in + * the extract text, if it is being shown. + */ + public void onUpdateSelection(int oldSelStart, int oldSelEnd, + int newSelStart, int newSelEnd) { + if (mExtractEditText != null && mExtractedText != null) { + final int off = mExtractedText.startOffset; + mExtractEditText.setSelection(newSelStart-off, newSelEnd-off); + } + } + + /** + * Called when the application has reported a new location of its text + * cursor. This is only called if explicitly requested by the input method. + * The default implementation does nothing. + */ + public void onUpdateCursor(Rect newCursor) { + } + + /** + * Close this input method's soft input area, removing it from the display. + * The input method will continue running, but the user can no longer use + * it to generate input by touching the screen. + */ + public void dismissSoftInput() { + ((InputMethodManager)getSystemService(INPUT_METHOD_SERVICE)) + .hideSoftInputFromInputMethod(mToken); + } + + public boolean onKeyDown(int keyCode, KeyEvent event) { + if (mWindowVisible && event.getKeyCode() == KeyEvent.KEYCODE_BACK + && event.getRepeatCount() == 0) { + dismissSoftInput(); + return true; + } + return false; + } + + public boolean onKeyMultiple(int keyCode, int count, KeyEvent event) { + return false; + } + + public boolean onKeyUp(int keyCode, KeyEvent event) { + return false; + } + + public boolean onTrackballEvent(MotionEvent event) { + return false; + } + + public void onAppPrivateCommand(String action, Bundle data) { + } + + void startExtractingText() { + if (mExtractEditText != null && getCurrentInputStarted() + && isFullscreenMode()) { + mExtractedToken++; + ExtractedTextRequest req = new ExtractedTextRequest(); + req.token = mExtractedToken; + req.hintMaxLines = 10; + req.hintMaxChars = 10000; + mExtractedText = mInputConnection.getExtractedText(req, + InputConnection.EXTRACTED_TEXT_MONITOR); + if (mExtractedText != null) { + mExtractEditText.setExtractedText(mExtractedText); + } + mExtractEditText.setInputType(getCurrentInputInfo().inputType); + mExtractEditText.setHint(mInputInfo.hintText); + } + } +} diff --git a/core/java/android/inputmethodservice/Keyboard.java b/core/java/android/inputmethodservice/Keyboard.java new file mode 100755 index 0000000000000..75a2911bcaea6 --- /dev/null +++ b/core/java/android/inputmethodservice/Keyboard.java @@ -0,0 +1,756 @@ +/* + * Copyright (C) 2008-2009 Google Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ + +package android.inputmethodservice; + +import org.xmlpull.v1.XmlPullParserException; + +import android.content.Context; +import android.content.res.Resources; +import android.content.res.TypedArray; +import android.content.res.XmlResourceParser; +import android.graphics.drawable.Drawable; +import android.text.TextUtils; +import android.util.Log; +import android.util.TypedValue; +import android.util.Xml; +import android.view.Display; +import android.view.WindowManager; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import java.util.StringTokenizer; + + +/** + * Loads an XML description of a keyboard and stores the attributes of the keys. A keyboard + * consists of rows of keys. + *

    The layout file for a keyboard contains XML that looks like the following snippet:

    + *
    + * <Keyboard
    + *         android:keyWidth="%10p"
    + *         android:keyHeight="50px"
    + *         android:horizontalGap="2px"
    + *         android:verticalGap="2px" >
    + *     <Row android:keyWidth="32px" >
    + *         <Key android:keyLabel="A" />
    + *         ...
    + *     </Row>
    + *     ...
    + * </Keyboard>
    + * 
    + * @attr ref android.R.styleable#Keyboard_keyWidth + * @attr ref android.R.styleable#Keyboard_keyHeight + * @attr ref android.R.styleable#Keyboard_horizontalGap + * @attr ref android.R.styleable#Keyboard_verticalGap + */ +public class Keyboard { + + static final String TAG = "Keyboard"; + + // Keyboard XML Tags + private static final String TAG_KEYBOARD = "Keyboard"; + private static final String TAG_ROW = "Row"; + private static final String TAG_KEY = "Key"; + + public static final int EDGE_LEFT = 0x01; + public static final int EDGE_RIGHT = 0x02; + public static final int EDGE_TOP = 0x04; + public static final int EDGE_BOTTOM = 0x08; + + public static final int KEYCODE_SHIFT = -1; + public static final int KEYCODE_MODE_CHANGE = -2; + public static final int KEYCODE_CANCEL = -3; + public static final int KEYCODE_DONE = -4; + public static final int KEYCODE_DELETE = -5; + public static final int KEYCODE_ALT = -6; + + /** Keyboard label **/ + private CharSequence mLabel; + + /** Horizontal gap default for all rows */ + private int mDefaultHorizontalGap; + + /** Default key width */ + private int mDefaultWidth; + + /** Default key height */ + private int mDefaultHeight; + + /** Default gap between rows */ + private int mDefaultVerticalGap; + + /** Is the keyboard in the shifted state */ + private boolean mShifted; + + /** Key instance for the shift key, if present */ + private Key mShiftKey; + + /** Key index for the shift key, if present */ + private int mShiftKeyIndex = -1; + + /** Current key width, while loading the keyboard */ + private int mKeyWidth; + + /** Current key height, while loading the keyboard */ + private int mKeyHeight; + + /** Total height of the keyboard, including the padding and keys */ + private int mTotalHeight; + + /** + * Total width of the keyboard, including left side gaps and keys, but not any gaps on the + * right side. + */ + private int mTotalWidth; + + /** List of keys in this keyboard */ + private List mKeys; + + /** List of modifier keys such as Shift & Alt, if any */ + private List mModifierKeys; + + /** Width of the screen available to fit the keyboard */ + private int mDisplayWidth; + + /** Height of the screen */ + private int mDisplayHeight; + + /** Keyboard mode, or zero, if none. */ + private int mKeyboardMode; + + /** + * Container for keys in the keyboard. All keys in a row are at the same Y-coordinate. + * Some of the key size defaults can be overridden per row from what the {@link Keyboard} + * defines. + * @attr ref android.R.styleable#Keyboard_keyWidth + * @attr ref android.R.styleable#Keyboard_keyHeight + * @attr ref android.R.styleable#Keyboard_horizontalGap + * @attr ref android.R.styleable#Keyboard_verticalGap + * @attr ref android.R.styleable#Keyboard_Row_rowEdgeFlags + * @attr ref android.R.styleable#Keyboard_Row_keyboardMode + */ + public static class Row { + /** Default width of a key in this row. */ + public int defaultWidth; + /** Default height of a key in this row. */ + public int defaultHeight; + /** Default horizontal gap between keys in this row. */ + public int defaultHorizontalGap; + /** Vertical gap following this row. */ + public int verticalGap; + /** + * Edge flags for this row of keys. Possible values that can be assigned are + * {@link Keyboard#EDGE_TOP EDGE_TOP} and {@link Keyboard#EDGE_BOTTOM EDGE_BOTTOM} + */ + public int rowEdgeFlags; + + /** The keyboard mode for this row */ + public int mode; + + private Keyboard parent; + + public Row(Keyboard parent) { + this.parent = parent; + } + + public Row(Resources res, Keyboard parent, XmlResourceParser parser) { + this.parent = parent; + TypedArray a = res.obtainAttributes(Xml.asAttributeSet(parser), + com.android.internal.R.styleable.Keyboard); + defaultWidth = getDimensionOrFraction(a, + com.android.internal.R.styleable.Keyboard_keyWidth, + parent.mDisplayWidth, parent.mDefaultWidth); + defaultHeight = getDimensionOrFraction(a, + com.android.internal.R.styleable.Keyboard_keyHeight, + parent.mDisplayWidth, parent.mDefaultHeight); + defaultHorizontalGap = getDimensionOrFraction(a, + com.android.internal.R.styleable.Keyboard_horizontalGap, + parent.mDisplayWidth, parent.mDefaultHorizontalGap); + verticalGap = getDimensionOrFraction(a, + com.android.internal.R.styleable.Keyboard_verticalGap, + parent.mDisplayWidth, parent.mDefaultVerticalGap); + a.recycle(); + a = res.obtainAttributes(Xml.asAttributeSet(parser), + com.android.internal.R.styleable.Keyboard_Row); + rowEdgeFlags = a.getInt(com.android.internal.R.styleable.Keyboard_Row_rowEdgeFlags, 0); + mode = a.getResourceId(com.android.internal.R.styleable.Keyboard_Row_keyboardMode, + 0); + } + } + + /** + * Class for describing the position and characteristics of a single key in the keyboard. + * + * @attr ref android.R.styleable#Keyboard_keyWidth + * @attr ref android.R.styleable#Keyboard_keyHeight + * @attr ref android.R.styleable#Keyboard_horizontalGap + * @attr ref android.R.styleable#Keyboard_Key_codes + * @attr ref android.R.styleable#Keyboard_Key_keyIcon + * @attr ref android.R.styleable#Keyboard_Key_keyLabel + * @attr ref android.R.styleable#Keyboard_Key_iconPreview + * @attr ref android.R.styleable#Keyboard_Key_isSticky + * @attr ref android.R.styleable#Keyboard_Key_isRepeatable + * @attr ref android.R.styleable#Keyboard_Key_isModifier + * @attr ref android.R.styleable#Keyboard_Key_popupKeyboard + * @attr ref android.R.styleable#Keyboard_Key_popupCharacters + * @attr ref android.R.styleable#Keyboard_Key_keyOutputText + * @attr ref android.R.styleable#Keyboard_Key_keyEdgeFlags + */ + public static class Key { + /** + * All the key codes (unicode or custom code) that this key could generate, zero'th + * being the most important. + */ + public int[] codes; + + /** Label to display */ + public CharSequence label; + + /** Icon to display instead of a label. Icon takes precedence over a label */ + public Drawable icon; + /** Preview version of the icon, for the preview popup */ + public Drawable iconPreview; + /** Width of the key, not including the gap */ + public int width; + /** Height of the key, not including the gap */ + public int height; + /** The horizontal gap before this key */ + public int gap; + /** Whether this key is sticky, i.e., a toggle key */ + public boolean sticky; + /** X coordinate of the key in the keyboard layout */ + public int x; + /** Y coordinate of the key in the keyboard layout */ + public int y; + /** The current pressed state of this key */ + public boolean pressed; + /** If this is a sticky key, is it on? */ + public boolean on; + /** Text to output when pressed. This can be multiple characters, like ".com" */ + public CharSequence text; + /** Popup characters */ + public CharSequence popupCharacters; + + /** + * Flags that specify the anchoring to edges of the keyboard for detecting touch events + * that are just out of the boundary of the key. This is a bit mask of + * {@link Keyboard#EDGE_LEFT}, {@link Keyboard#EDGE_RIGHT}, {@link Keyboard#EDGE_TOP} and + * {@link Keyboard#EDGE_BOTTOM}. + */ + public int edgeFlags; + /** Whether this is a modifier key, such as Shift or Alt */ + public boolean modifier; + /** The keyboard that this key belongs to */ + private Keyboard keyboard; + /** + * If this key pops up a mini keyboard, this is the resource id for the XML layout for that + * keyboard. + */ + public int popupResId; + /** Whether this key repeats itself when held down */ + public boolean repeatable; + + + private final static int[] KEY_STATE_NORMAL_ON = { + android.R.attr.state_checkable, + android.R.attr.state_checked + }; + + private final static int[] KEY_STATE_PRESSED_ON = { + android.R.attr.state_pressed, + android.R.attr.state_checkable, + android.R.attr.state_checked + }; + + private final static int[] KEY_STATE_NORMAL_OFF = { + android.R.attr.state_checkable + }; + + private final static int[] KEY_STATE_PRESSED_OFF = { + android.R.attr.state_pressed, + android.R.attr.state_checkable + }; + + private final static int[] KEY_STATE_NORMAL = { + }; + + private final static int[] KEY_STATE_PRESSED = { + android.R.attr.state_pressed + }; + + /** Create an empty key with no attributes. */ + public Key(Row parent) { + keyboard = parent.parent; + } + + /** Create a key with the given top-left coordinate and extract its attributes from + * the XML parser. + * @param res resources associated with the caller's context + * @param parent the row that this key belongs to. The row must already be attached to + * a {@link Keyboard}. + * @param x the x coordinate of the top-left + * @param y the y coordinate of the top-left + * @param parser the XML parser containing the attributes for this key + */ + public Key(Resources res, Row parent, int x, int y, XmlResourceParser parser) { + this(parent); + + this.x = x; + this.y = y; + + TypedArray a = res.obtainAttributes(Xml.asAttributeSet(parser), + com.android.internal.R.styleable.Keyboard); + + width = getDimensionOrFraction(a, + com.android.internal.R.styleable.Keyboard_keyWidth, + keyboard.mDisplayWidth, parent.defaultWidth); + height = getDimensionOrFraction(a, + com.android.internal.R.styleable.Keyboard_keyHeight, + keyboard.mDisplayHeight, parent.defaultHeight); + gap = getDimensionOrFraction(a, + com.android.internal.R.styleable.Keyboard_horizontalGap, + keyboard.mDisplayWidth, parent.defaultHorizontalGap); + a.recycle(); + a = res.obtainAttributes(Xml.asAttributeSet(parser), + com.android.internal.R.styleable.Keyboard_Key); + this.x += gap; + TypedValue codesValue = new TypedValue(); + a.getValue(com.android.internal.R.styleable.Keyboard_Key_codes, + codesValue); + if (codesValue.type == TypedValue.TYPE_INT_DEC + || codesValue.type == TypedValue.TYPE_INT_HEX) { + codes = new int[] { codesValue.data }; + } else if (codesValue.type == TypedValue.TYPE_STRING) { + codes = parseCSV(codesValue.string.toString()); + } + + iconPreview = a.getDrawable(com.android.internal.R.styleable.Keyboard_Key_iconPreview); + if (iconPreview != null) { + iconPreview.setBounds(0, 0, iconPreview.getIntrinsicWidth(), + iconPreview.getIntrinsicHeight()); + } + popupCharacters = a.getText( + com.android.internal.R.styleable.Keyboard_Key_popupCharacters); + popupResId = a.getResourceId( + com.android.internal.R.styleable.Keyboard_Key_popupKeyboard, 0); + repeatable = a.getBoolean( + com.android.internal.R.styleable.Keyboard_Key_isRepeatable, false); + modifier = a.getBoolean( + com.android.internal.R.styleable.Keyboard_Key_isModifier, false); + sticky = a.getBoolean( + com.android.internal.R.styleable.Keyboard_Key_isSticky, false); + edgeFlags = a.getInt(com.android.internal.R.styleable.Keyboard_Key_keyEdgeFlags, 0); + edgeFlags |= parent.rowEdgeFlags; + + icon = a.getDrawable( + com.android.internal.R.styleable.Keyboard_Key_keyIcon); + if (icon != null) { + icon.setBounds(0, 0, icon.getIntrinsicWidth(), icon.getIntrinsicHeight()); + } + label = a.getText(com.android.internal.R.styleable.Keyboard_Key_keyLabel); + text = a.getText(com.android.internal.R.styleable.Keyboard_Key_keyOutputText); + + if (codes == null && !TextUtils.isEmpty(label)) { + codes = new int[] { label.charAt(0) }; + } + a.recycle(); + } + + /** + * Informs the key that it has been pressed, in case it needs to change its appearance or + * state. + * @see #onReleased(boolean) + */ + public void onPressed() { + pressed = !pressed; + } + + /** + * Changes the pressed state of the key. If it is a sticky key, it will also change the + * toggled state of the key if the finger was release inside. + * @param inside whether the finger was released inside the key + * @see #onPressed() + */ + public void onReleased(boolean inside) { + pressed = !pressed; + if (sticky) { + on = !on; + } + } + + int[] parseCSV(String value) { + int count = 0; + int lastIndex = 0; + if (value.length() > 0) { + count++; + while ((lastIndex = value.indexOf(",", lastIndex + 1)) > 0) { + count++; + } + } + int[] values = new int[count]; + count = 0; + StringTokenizer st = new StringTokenizer(value, ","); + while (st.hasMoreTokens()) { + try { + values[count++] = Integer.parseInt(st.nextToken()); + } catch (NumberFormatException nfe) { + Log.e(TAG, "Error parsing keycodes " + value); + } + } + return values; + } + + /** + * Detects if a point falls inside this key. + * @param x the x-coordinate of the point + * @param y the y-coordinate of the point + * @return whether or not the point falls inside the key. If the key is attached to an edge, + * it will assume that all points between the key and the edge are considered to be inside + * the key. + */ + public boolean isInside(int x, int y) { + boolean leftEdge = (edgeFlags & EDGE_LEFT) > 0; + boolean rightEdge = (edgeFlags & EDGE_RIGHT) > 0; + boolean topEdge = (edgeFlags & EDGE_TOP) > 0; + boolean bottomEdge = (edgeFlags & EDGE_BOTTOM) > 0; + if ((x >= this.x || (leftEdge && x <= this.x + this.width)) + && (x < this.x + this.width || (rightEdge && x >= this.x)) + && (y >= this.y || (topEdge && y <= this.y + this.height)) + && (y < this.y + this.height || (bottomEdge && y >= this.y))) { + return true; + } else { + return false; + } + } + + + /** + * Returns the square of the distance between the center of the key and the given point. + * @param x the x-coordinate of the point + * @param y the y-coordinate of the point + * @return the square of the distance of the point from the center of the key + */ + public int squaredDistanceFrom(int x, int y) { + float xDist = Math.abs((this.x + this.x + width) / 2f - x); + float yDist = Math.abs((this.y + this.y + height) / 2f - y); + return (int) (xDist * xDist + yDist * yDist); + } + + /** + * Returns the drawable state for the key, based on the current state and type of the key. + * @return the drawable state of the key. + * @see android.graphics.drawable.StateListDrawable#setState(int[]) + */ + public int[] getCurrentDrawableState() { + int[] states = KEY_STATE_NORMAL; + + if (on) { + if (pressed) { + states = KEY_STATE_PRESSED_ON; + } else { + states = KEY_STATE_NORMAL_ON; + } + } else { + if (sticky) { + if (pressed) { + states = KEY_STATE_PRESSED_OFF; + } else { + states = KEY_STATE_NORMAL_OFF; + } + } else { + if (pressed) { + states = KEY_STATE_PRESSED; + } + } + } + return states; + } + } + + /** + * Creates a keyboard from the given xml key layout file. + * @param context the application or service context + * @param xmlLayoutResId the resource file that contains the keyboard layout and keys. + */ + public Keyboard(Context context, int xmlLayoutResId) { + this(context, xmlLayoutResId, 0); + } + + /** + * Creates a keyboard from the given xml key layout file. Weeds out rows + * that have a keyboard mode defined but don't match the specified mode. + * @param context the application or service context + * @param xmlLayoutResId the resource file that contains the keyboard layout and keys. + * @param modeId keyboard mode identifier + */ + public Keyboard(Context context, int xmlLayoutResId, int modeId) { + WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); + final Display display = wm.getDefaultDisplay(); + mDisplayWidth = display.getWidth(); + mDisplayHeight = display.getHeight(); + mDefaultHorizontalGap = 0; + mDefaultWidth = mDisplayWidth / 10; + mDefaultVerticalGap = 0; + mDefaultHeight = mDefaultWidth; + mKeys = new ArrayList(); + mModifierKeys = new ArrayList(); + mKeyboardMode = modeId; + loadKeyboard(context, context.getResources().getXml(xmlLayoutResId)); + } + + /** + *

    Creates a blank keyboard from the given resource file and populates it with the specified + * characters in left-to-right, top-to-bottom fashion, using the specified number of columns. + *

    + *

    If the specified number of columns is -1, then the keyboard will fit as many keys as + * possible in each row.

    + * @param context the application or service context + * @param layoutTemplateResId the layout template file, containing no keys. + * @param characters the list of characters to display on the keyboard. One key will be created + * for each character. + * @param columns the number of columns of keys to display. If this number is greater than the + * number of keys that can fit in a row, it will be ignored. If this number is -1, the + * keyboard will fit as many keys as possible in each row. + */ + public Keyboard(Context context, int layoutTemplateResId, + CharSequence characters, int columns, int horizontalPadding) { + this(context, layoutTemplateResId); + int x = 0; + int y = 0; + int column = 0; + mTotalWidth = 0; + + Row row = new Row(this); + row.defaultHeight = mDefaultHeight; + row.defaultWidth = mDefaultWidth; + row.defaultHorizontalGap = mDefaultHorizontalGap; + row.verticalGap = mDefaultVerticalGap; + row.rowEdgeFlags = EDGE_TOP | EDGE_BOTTOM; + + final int maxColumns = columns == -1 ? Integer.MAX_VALUE : columns; + for (int i = 0; i < characters.length(); i++) { + char c = characters.charAt(i); + if (column >= maxColumns + || x + mDefaultWidth + horizontalPadding > mDisplayWidth) { + x = 0; + y += mDefaultVerticalGap + mDefaultHeight; + column = 0; + } + final Key key = new Key(row); + key.x = x; + key.y = y; + key.width = mDefaultWidth; + key.height = mDefaultHeight; + key.gap = mDefaultHorizontalGap; + key.label = String.valueOf(c); + key.codes = new int[] { c }; + column++; + x += key.width + key.gap; + mKeys.add(key); + if (x > mTotalWidth) { + mTotalWidth = x; + } + } + mTotalHeight = y + mDefaultHeight; + } + + public List getKeys() { + return mKeys; + } + + public List getModifierKeys() { + return mModifierKeys; + } + + protected int getHorizontalGap() { + return mDefaultHorizontalGap; + } + + protected void setHorizontalGap(int gap) { + mDefaultHorizontalGap = gap; + } + + protected int getVerticalGap() { + return mDefaultVerticalGap; + } + + protected void setVerticalGap(int gap) { + mDefaultVerticalGap = gap; + } + + protected int getKeyHeight() { + return mDefaultHeight; + } + + protected void setKeyHeight(int height) { + mDefaultHeight = height; + } + + protected int getKeyWidth() { + return mDefaultWidth; + } + + protected void setKeyWidth(int width) { + mDefaultWidth = width; + } + + /** + * Returns the total height of the keyboard + * @return the total height of the keyboard + */ + public int getHeight() { + return mTotalHeight; + } + + public int getMinWidth() { + return mTotalWidth; + } + + public boolean setShifted(boolean shiftState) { + if (mShiftKey != null) { + mShiftKey.on = shiftState; + } + if (mShifted != shiftState) { + mShifted = shiftState; + return true; + } + return false; + } + + public boolean isShifted() { + return mShifted; + } + + public int getShiftKeyIndex() { + return mShiftKeyIndex; + } + + protected Row createRowFromXml(Resources res, XmlResourceParser parser) { + return new Row(res, this, parser); + } + + protected Key createKeyFromXml(Resources res, Row parent, int x, int y, + XmlResourceParser parser) { + return new Key(res, parent, x, y, parser); + } + + private void loadKeyboard(Context context, XmlResourceParser parser) { + boolean inKey = false; + boolean inRow = false; + boolean leftMostKey = false; + int row = 0; + int x = 0; + int y = 0; + Key key = null; + Row currentRow = null; + Resources res = context.getResources(); + boolean skipRow = false; + + try { + int event; + while ((event = parser.next()) != XmlResourceParser.END_DOCUMENT) { + if (event == XmlResourceParser.START_TAG) { + String tag = parser.getName(); + if (TAG_ROW.equals(tag)) { + inRow = true; + x = 0; + currentRow = createRowFromXml(res, parser); + skipRow = currentRow.mode != 0 && currentRow.mode != mKeyboardMode; + if (skipRow) { + skipToEndOfRow(parser); + inRow = false; + } + } else if (TAG_KEY.equals(tag)) { + inKey = true; + key = createKeyFromXml(res, currentRow, x, y, parser); + mKeys.add(key); + if (key.codes[0] == KEYCODE_SHIFT) { + mShiftKey = key; + mShiftKeyIndex = mKeys.size()-1; + mModifierKeys.add(key); + } else if (key.codes[0] == KEYCODE_ALT) { + mModifierKeys.add(key); + } + } else if (TAG_KEYBOARD.equals(tag)) { + parseKeyboardAttributes(res, parser); + } + } else if (event == XmlResourceParser.END_TAG) { + if (inKey) { + inKey = false; + x += key.gap + key.width; + if (x > mTotalWidth) { + mTotalWidth = x; + } + } else if (inRow) { + inRow = false; + y += currentRow.verticalGap; + y += currentRow.defaultHeight; + row++; + } else { + // TODO: error or extend? + } + } + } + } catch (Exception e) { + Log.e(TAG, "Parse error:" + e); + e.printStackTrace(); + } + mTotalHeight = y - mDefaultVerticalGap; + } + + private void skipToEndOfRow(XmlResourceParser parser) + throws XmlPullParserException, IOException { + int event; + while ((event = parser.next()) != XmlResourceParser.END_DOCUMENT) { + if (event == XmlResourceParser.END_TAG + && parser.getName().equals(TAG_ROW)) { + break; + } + } + } + + private void parseKeyboardAttributes(Resources res, XmlResourceParser parser) { + TypedArray a = res.obtainAttributes(Xml.asAttributeSet(parser), + com.android.internal.R.styleable.Keyboard); + + mDefaultWidth = getDimensionOrFraction(a, + com.android.internal.R.styleable.Keyboard_keyWidth, + mDisplayWidth, mDisplayWidth / 10); + mDefaultHeight = getDimensionOrFraction(a, + com.android.internal.R.styleable.Keyboard_keyHeight, + mDisplayHeight, 50); + mDefaultHorizontalGap = getDimensionOrFraction(a, + com.android.internal.R.styleable.Keyboard_horizontalGap, + mDisplayWidth, 0); + mDefaultVerticalGap = getDimensionOrFraction(a, + com.android.internal.R.styleable.Keyboard_verticalGap, + mDisplayHeight, 0); + a.recycle(); + } + + static int getDimensionOrFraction(TypedArray a, int index, int base, int defValue) { + TypedValue value = a.peekValue(index); + if (value == null) return defValue; + if (value.type == TypedValue.TYPE_DIMENSION) { + return a.getDimensionPixelOffset(index, defValue); + } else if (value.type == TypedValue.TYPE_FRACTION) { + return (int) a.getFraction(index, base, base, defValue); + } + return defValue; + } +} diff --git a/core/java/android/inputmethodservice/KeyboardView.java b/core/java/android/inputmethodservice/KeyboardView.java new file mode 100755 index 0000000000000..56473da358995 --- /dev/null +++ b/core/java/android/inputmethodservice/KeyboardView.java @@ -0,0 +1,1049 @@ +/* + * Copyright (C) 2008-2009 Google Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ + +package android.inputmethodservice; + +import com.android.internal.R; + +import android.content.Context; +import android.content.SharedPreferences; +import android.content.res.TypedArray; +import android.graphics.Canvas; +import android.graphics.Paint; +import android.graphics.Rect; +import android.graphics.Paint.Align; +import android.graphics.drawable.Drawable; +import android.inputmethodservice.Keyboard.Key; +import android.os.Handler; +import android.os.Message; +import android.os.Vibrator; +import android.preference.PreferenceManager; +import android.util.AttributeSet; +import android.view.GestureDetector; +import android.view.Gravity; +import android.view.LayoutInflater; +import android.view.MotionEvent; +import android.view.View; +import android.view.ViewGroup.LayoutParams; +import android.widget.Button; +import android.widget.PopupWindow; +import android.widget.TextView; + +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * A view that renders a virtual {@link Keyboard}. It handles rendering of keys and + * detecting key presses and touch movements. + * + * @attr ref android.R.styleable#KeyboardView_keyBackground + * @attr ref android.R.styleable#KeyboardView_keyPreviewLayout + * @attr ref android.R.styleable#KeyboardView_keyPreviewOffset + * @attr ref android.R.styleable#KeyboardView_labelTextSize + * @attr ref android.R.styleable#KeyboardView_keyTextSize + * @attr ref android.R.styleable#KeyboardView_keyTextColor + * @attr ref android.R.styleable#KeyboardView_verticalCorrection + * @attr ref android.R.styleable#KeyboardView_popupLayout + */ +public class KeyboardView extends View implements View.OnClickListener { + + /** + * Listener for virtual keyboard events. + */ + public interface OnKeyboardActionListener { + /** + * Send a key press to the listener. + * @param primaryCode this is the key that was pressed + * @param keyCodes the codes for all the possible alternative keys + * with the primary code being the first. If the primary key code is + * a single character such as an alphabet or number or symbol, the alternatives + * will include other characters that may be on the same key or adjacent keys. + * These codes are useful to correct for accidental presses of a key adjacent to + * the intended key. + */ + void onKey(int primaryCode, int[] keyCodes); + + /** + * Called when the user quickly moves the finger from right to left. + */ + void swipeLeft(); + + /** + * Called when the user quickly moves the finger from left to right. + */ + void swipeRight(); + + /** + * Called when the user quickly moves the finger from up to down. + */ + void swipeDown(); + + /** + * Called when the user quickly moves the finger from down to up. + */ + void swipeUp(); + } + + private static final boolean DEBUG = false; + private static final int NOT_A_KEY = -1; + private static final int[] KEY_DELETE = { Keyboard.KEYCODE_DELETE }; + private static final int[] LONG_PRESSABLE_STATE_SET = { R.attr.state_long_pressable }; + + private Keyboard mKeyboard; + private int mCurrentKeyIndex = NOT_A_KEY; + private int mLabelTextSize; + private int mKeyTextSize; + private int mKeyTextColor; + + private TextView mPreviewText; + private PopupWindow mPreviewPopup; + private int mPreviewTextSizeLarge; + private int mPreviewOffset; + private int mPreviewHeight; + private int[] mOffsetInWindow; + + private PopupWindow mPopupKeyboard; + private View mMiniKeyboardContainer; + private KeyboardView mMiniKeyboard; + private boolean mMiniKeyboardOnScreen; + private View mPopupParent; + private int mMiniKeyboardOffsetX; + private int mMiniKeyboardOffsetY; + private Map mMiniKeyboardCache; + private int[] mWindowOffset; + + /** Listener for {@link OnKeyboardActionListener}. */ + private OnKeyboardActionListener mKeyboardActionListener; + + private static final int MSG_REMOVE_PREVIEW = 1; + private static final int MSG_REPEAT = 2; + + private int mVerticalCorrection; + private int mProximityThreshold; + + private boolean mPreviewCentered = false; + private boolean mShowPreview = true; + private boolean mShowTouchPoints = false; + private int mPopupPreviewX; + private int mPopupPreviewY; + + private int mLastX; + private int mLastY; + private int mStartX; + private int mStartY; + + private boolean mVibrateOn; + private boolean mSoundOn; + private boolean mProximityCorrectOn; + + private Paint mPaint; + private Rect mPadding; + + private long mDownTime; + private long mLastMoveTime; + private int mLastKey; + private int mLastCodeX; + private int mLastCodeY; + private int mCurrentKey = NOT_A_KEY; + private long mLastKeyTime; + private long mCurrentKeyTime; + private int[] mKeyIndices = new int[12]; + private GestureDetector mGestureDetector; + private int mPopupX; + private int mPopupY; + private int mRepeatKeyIndex = NOT_A_KEY; + private int mPopupLayout; + private boolean mAbortKey; + + private Drawable mKeyBackground; + + private static final String PREF_VIBRATE_ON = "vibrate_on"; + private static final String PREF_SOUND_ON = "sound_on"; + private static final String PREF_PROXIMITY_CORRECTION = "hit_correction"; + + private static final int REPEAT_INTERVAL = 50; // ~20 keys per second + private static final int REPEAT_START_DELAY = 400; + + private Vibrator mVibrator; + private long[] mVibratePattern = new long[] {1, 20}; + + private static int MAX_NEARBY_KEYS = 12; + private int[] mDistances = new int[MAX_NEARBY_KEYS]; + + // For multi-tap + private int mLastSentIndex; + private int mTapCount; + private long mLastTapTime; + private boolean mInMultiTap; + private static final int MULTITAP_INTERVAL = 800; // milliseconds + private StringBuilder mPreviewLabel = new StringBuilder(1); + + Handler mHandler = new Handler() { + @Override + public void handleMessage(Message msg) { + switch (msg.what) { + case MSG_REMOVE_PREVIEW: + mPreviewText.setVisibility(INVISIBLE); + break; + case MSG_REPEAT: + if (repeatKey()) { + Message repeat = Message.obtain(this, MSG_REPEAT); + sendMessageDelayed(repeat, REPEAT_INTERVAL); + } + break; + } + + } + }; + + public KeyboardView(Context context, AttributeSet attrs) { + this(context, attrs, com.android.internal.R.attr.keyboardViewStyle); + } + + public KeyboardView(Context context, AttributeSet attrs, int defStyle) { + super(context, attrs, defStyle); + + TypedArray a = + context.obtainStyledAttributes( + attrs, android.R.styleable.KeyboardView, defStyle, 0); + + LayoutInflater inflate = + (LayoutInflater) context + .getSystemService(Context.LAYOUT_INFLATER_SERVICE); + + int previewLayout = 0; + int keyTextSize = 0; + + int n = a.getIndexCount(); + + for (int i = 0; i < n; i++) { + int attr = a.getIndex(i); + + switch (attr) { + case com.android.internal.R.styleable.KeyboardView_keyBackground: + mKeyBackground = a.getDrawable(attr); + break; + case com.android.internal.R.styleable.KeyboardView_verticalCorrection: + mVerticalCorrection = a.getDimensionPixelOffset(attr, 0); + break; + case com.android.internal.R.styleable.KeyboardView_keyPreviewLayout: + previewLayout = a.getResourceId(attr, 0); + break; + case com.android.internal.R.styleable.KeyboardView_keyPreviewOffset: + mPreviewOffset = a.getDimensionPixelOffset(attr, 0); + break; + case com.android.internal.R.styleable.KeyboardView_keyPreviewHeight: + mPreviewHeight = a.getDimensionPixelSize(attr, 80); + break; + case com.android.internal.R.styleable.KeyboardView_keyTextSize: + mKeyTextSize = a.getDimensionPixelSize(attr, 18); + break; + case com.android.internal.R.styleable.KeyboardView_keyTextColor: + mKeyTextColor = a.getColor(attr, 0xFF000000); + break; + case com.android.internal.R.styleable.KeyboardView_labelTextSize: + mLabelTextSize = a.getDimensionPixelSize(attr, 14); + break; + case com.android.internal.R.styleable.KeyboardView_popupLayout: + mPopupLayout = a.getResourceId(attr, 0); + break; + } + } + + // Get the settings preferences + SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context); + mVibrateOn = sp.getBoolean(PREF_VIBRATE_ON, mVibrateOn); + mSoundOn = sp.getBoolean(PREF_SOUND_ON, mSoundOn); + mProximityCorrectOn = sp.getBoolean(PREF_PROXIMITY_CORRECTION, true); + + mPreviewPopup = new PopupWindow(context); + if (previewLayout != 0) { + mPreviewText = (TextView) inflate.inflate(previewLayout, null); + mPreviewTextSizeLarge = (int) mPreviewText.getTextSize(); + mPreviewPopup.setContentView(mPreviewText); + mPreviewPopup.setBackgroundDrawable(null); + } else { + mShowPreview = false; + } + + mPreviewPopup.setTouchable(false); + + mPopupKeyboard = new PopupWindow(context); + mPopupKeyboard.setBackgroundDrawable(null); + //mPopupKeyboard.setClippingEnabled(false); + + mPopupParent = this; + //mPredicting = true; + + mPaint = new Paint(); + mPaint.setAntiAlias(true); + mPaint.setTextSize(keyTextSize); + mPaint.setTextAlign(Align.CENTER); + + mPadding = new Rect(0, 0, 0, 0); + mMiniKeyboardCache = new HashMap(); + mKeyBackground.getPadding(mPadding); + + resetMultiTap(); + initGestureDetector(); + } + + private void initGestureDetector() { + mGestureDetector = new GestureDetector(new GestureDetector.SimpleOnGestureListener() { + @Override + public boolean onFling(MotionEvent me1, MotionEvent me2, + float velocityX, float velocityY) { + if (velocityX > 400 && Math.abs(velocityY) < 400) { + swipeRight(); + return true; + } else if (velocityX < -400 && Math.abs(velocityY) < 400) { + swipeLeft(); + return true; + } else if (velocityY < -400 && Math.abs(velocityX) < 400) { + swipeUp(); + return true; + } else if (velocityY > 400 && Math.abs(velocityX) < 400) { + swipeDown(); + return true; + } + return false; + } + + @Override + public void onLongPress(MotionEvent me) { + openPopupIfRequired(me); + } + }); + } + + public void setOnKeyboardActionListener(OnKeyboardActionListener listener) { + mKeyboardActionListener = listener; + } + + /** + * Returns the {@link OnKeyboardActionListener} object. + * @return the listener attached to this keyboard + */ + protected OnKeyboardActionListener getOnKeyboardActionListener() { + return mKeyboardActionListener; + } + + /** + * Attaches a keyboard to this view. The keyboard can be switched at any time and the + * view will re-layout itself to accommodate the keyboard. + * @see Keyboard + * @see #getKeyboard() + * @param keyboard the keyboard to display in this view + */ + public void setKeyboard(Keyboard keyboard) { + mKeyboard = keyboard; + requestLayout(); + invalidate(); + computeProximityThreshold(keyboard); + } + + /** + * Returns the current keyboard being displayed by this view. + * @return the currently attached keyboard + * @see #setKeyboard(Keyboard) + */ + public Keyboard getKeyboard() { + return mKeyboard; + } + + /** + * Sets the state of the shift key of the keyboard, if any. + * @param shifted whether or not to enable the state of the shift key + * @return true if the shift key state changed, false if there was no change + * @see KeyboardView#isShifted() + */ + public boolean setShifted(boolean shifted) { + if (mKeyboard != null) { + if (mKeyboard.setShifted(shifted)) { + // The whole keyboard probably needs to be redrawn + invalidate(); + return true; + } + } + return false; + } + + /** + * Returns the state of the shift key of the keyboard, if any. + * @return true if the shift is in a pressed state, false otherwise. If there is + * no shift key on the keyboard or there is no keyboard attached, it returns false. + * @see KeyboardView#setShifted(boolean) + */ + public boolean isShifted() { + if (mKeyboard != null) { + return mKeyboard.isShifted(); + } + return false; + } + + /** + * Enables or disables the key feedback popup. This is a popup that shows a magnified + * version of the depressed key. By default the preview is enabled. + * @param previewEnabled whether or not to enable the key feedback popup + * @see #isPreviewEnabled() + */ + public void setPreviewEnabled(boolean previewEnabled) { + mShowPreview = previewEnabled; + } + + /** + * Returns the enabled state of the key feedback popup. + * @return whether or not the key feedback popup is enabled + * @see #setPreviewEnabled(boolean) + */ + public boolean isPreviewEnabled() { + return mShowPreview; + } + + public void setVerticalCorrection(int verticalOffset) { + + } + public void setPopupParent(View v) { + mPopupParent = v; + } + + public void setPopupOffset(int x, int y) { + mMiniKeyboardOffsetX = x; + mMiniKeyboardOffsetY = y; + if (mPreviewPopup.isShowing()) { + mPreviewPopup.dismiss(); + } + } + + /** + * Popup keyboard close button clicked. + * @hide + */ + public void onClick(View v) { + dismissPopupKeyboard(); + } + + private CharSequence adjustCase(CharSequence label) { + if (mKeyboard.isShifted() && label != null && label.length() == 1 + && Character.isLowerCase(label.charAt(0))) { + label = label.toString().toUpperCase(); + } + return label; + } + + @Override + public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { + // Round up a little + if (mKeyboard == null) { + setMeasuredDimension(mPaddingLeft + mPaddingRight, mPaddingTop + mPaddingBottom); + } else { + int width = mKeyboard.getMinWidth() + mPaddingLeft + mPaddingRight; + if (MeasureSpec.getSize(widthMeasureSpec) < width + 10) { + width = MeasureSpec.getSize(widthMeasureSpec); + } + setMeasuredDimension(width, mKeyboard.getHeight() + mPaddingTop + mPaddingBottom); + } + } + + /** + * Compute the average distance between adjacent keys (horizontally and vertically) + * and square it to get the proximity threshold. We use a square here and in computing + * the touch distance from a key's center to avoid taking a square root. + * @param keyboard + */ + private void computeProximityThreshold(Keyboard keyboard) { + if (keyboard == null) return; + List keys = keyboard.getKeys(); + if (keys == null) return; + int length = keys.size(); + int dimensionSum = 0; + for (int i = 0; i < length; i++) { + Key key = keys.get(i); + dimensionSum += key.width + key.gap + key.height; + } + if (dimensionSum < 0 || length == 0) return; + mProximityThreshold = dimensionSum / (length * 2); + mProximityThreshold *= mProximityThreshold; // Square it + } + + @Override + public void onDraw(Canvas canvas) { + super.onDraw(canvas); + if (mKeyboard == null) return; + + final Paint paint = mPaint; + //final int descent = (int) paint.descent(); + final Drawable keyBackground = mKeyBackground; + final Rect padding = mPadding; + final int kbdPaddingLeft = mPaddingLeft; + final int kbdPaddingTop = mPaddingTop; + List keys = mKeyboard.getKeys(); + //canvas.translate(0, mKeyboardPaddingTop); + paint.setAlpha(255); + paint.setColor(mKeyTextColor); + + final int keyCount = keys.size(); + for (int i = 0; i < keyCount; i++) { + final Key key = keys.get(i); + int[] drawableState = key.getCurrentDrawableState(); + keyBackground.setState(drawableState); + + // Switch the character to uppercase if shift is pressed + String label = key.label == null? null : adjustCase(key.label).toString(); + + final Rect bounds = keyBackground.getBounds(); + if (key.width != bounds.right || + key.height != bounds.bottom) { + keyBackground.setBounds(0, 0, key.width, key.height); + } + canvas.translate(key.x + kbdPaddingLeft, key.y + kbdPaddingTop); + keyBackground.draw(canvas); + + if (label != null) { + // For characters, use large font. For labels like "Done", use small font. + if (label.length() > 1 && key.codes.length < 2) { + paint.setTextSize(mLabelTextSize); + paint.setFakeBoldText(true); + } else { + paint.setTextSize(mKeyTextSize); + paint.setFakeBoldText(false); + } + // Draw a drop shadow for the text + paint.setShadowLayer(3f, 0, 0, 0xCC000000); + // Draw the text + canvas.drawText(label, + (key.width - padding.left - padding.right) / 2 + + padding.left, + (key.height - padding.top - padding.bottom) / 2 + + (paint.getTextSize() - paint.descent()) / 2 + padding.top, + paint); + // Turn off drop shadow + paint.setShadowLayer(0, 0, 0, 0); + } else if (key.icon != null) { + final int drawableX = (key.width - padding.left - padding.right + - key.icon.getIntrinsicWidth()) / 2 + padding.left; + final int drawableY = (key.height - padding.top - padding.bottom + - key.icon.getIntrinsicHeight()) / 2 + padding.top; + canvas.translate(drawableX, drawableY); + key.icon.setBounds(0, 0, + key.icon.getIntrinsicWidth(), key.icon.getIntrinsicHeight()); + key.icon.draw(canvas); + canvas.translate(-drawableX, -drawableY); + } + canvas.translate(-key.x - kbdPaddingLeft, -key.y - kbdPaddingTop); + } + + // Overlay a dark rectangle to dim the keyboard + if (mMiniKeyboardOnScreen) { + paint.setColor(0xA0000000); + canvas.drawRect(0, 0, getWidth(), getHeight(), paint); + } + + if (DEBUG && mShowTouchPoints) { + paint.setAlpha(128); + paint.setColor(0xFFFF0000); + canvas.drawCircle(mStartX, mStartY, 3, paint); + canvas.drawLine(mStartX, mStartY, mLastX, mLastY, paint); + paint.setColor(0xFF0000FF); + canvas.drawCircle(mLastX, mLastY, 3, paint); + paint.setColor(0xFF00FF00); + canvas.drawCircle((mStartX + mLastX) / 2, (mStartY + mLastY) / 2, 2, paint); + } + } + + private void playKeyClick() { + if (mSoundOn) { + playSoundEffect(0); + } + } + + private void vibrate() { + if (!mVibrateOn) { + return; + } + if (mVibrator == null) { + mVibrator = new Vibrator(); + } + mVibrator.vibrate(mVibratePattern, -1); + } + + private int getKeyIndices(int x, int y, int[] allKeys) { + final List keys = mKeyboard.getKeys(); + final boolean shifted = mKeyboard.isShifted(); + int primaryIndex = NOT_A_KEY; + int closestKey = NOT_A_KEY; + int closestKeyDist = mProximityThreshold + 1; + java.util.Arrays.fill(mDistances, Integer.MAX_VALUE); + final int keyCount = keys.size(); + for (int i = 0; i < keyCount; i++) { + final Key key = keys.get(i); + int dist = 0; + boolean isInside = key.isInside(x,y); + if (((mProximityCorrectOn + && (dist = key.squaredDistanceFrom(x, y)) < mProximityThreshold) + || isInside) + && key.codes[0] > 32) { + // Find insertion point + final int nCodes = key.codes.length; + if (dist < closestKeyDist) { + closestKeyDist = dist; + closestKey = i; + } + + if (allKeys == null) continue; + + for (int j = 0; j < mDistances.length; j++) { + if (mDistances[j] > dist) { + // Make space for nCodes codes + System.arraycopy(mDistances, j, mDistances, j + nCodes, + mDistances.length - j - nCodes); + System.arraycopy(allKeys, j, allKeys, j + nCodes, + allKeys.length - j - nCodes); + for (int c = 0; c < nCodes; c++) { + allKeys[j + c] = key.codes[c]; + if (shifted) { + //allKeys[j + c] = Character.toUpperCase(key.codes[c]); + } + mDistances[j + c] = dist; + } + break; + } + } + } + + if (isInside) { + primaryIndex = i; + } + } + if (primaryIndex == NOT_A_KEY) { + primaryIndex = closestKey; + } + return primaryIndex; + } + + private void detectAndSendKey(int x, int y, long eventTime) { + int index = mCurrentKey; + if (index != NOT_A_KEY) { + vibrate(); + final Key key = mKeyboard.getKeys().get(index); + if (key.text != null) { + for (int i = 0; i < key.text.length(); i++) { + mKeyboardActionListener.onKey(key.text.charAt(i), key.codes); + } + } else { + int code = key.codes[0]; + //TextEntryState.keyPressedAt(key, x, y); + int[] codes = new int[MAX_NEARBY_KEYS]; + Arrays.fill(codes, NOT_A_KEY); + getKeyIndices(x, y, codes); + // Multi-tap + if (mInMultiTap) { + if (mTapCount != -1) { + mKeyboardActionListener.onKey(Keyboard.KEYCODE_DELETE, KEY_DELETE); + } else { + mTapCount = 0; + } + code = key.codes[mTapCount]; + } + mKeyboardActionListener.onKey(code, codes); + } + mLastSentIndex = index; + mLastTapTime = eventTime; + } + } + + /** + * Handle multi-tap keys by producing the key label for the current multi-tap state. + */ + private CharSequence getPreviewText(Key key) { + if (mInMultiTap) { + // Multi-tap + mPreviewLabel.setLength(0); + mPreviewLabel.append((char) key.codes[mTapCount < 0 ? 0 : mTapCount]); + return adjustCase(mPreviewLabel); + } else { + return adjustCase(key.label); + } + } + + private void showPreview(int keyIndex) { + int oldKeyIndex = mCurrentKeyIndex; + final PopupWindow previewPopup = mPreviewPopup; + + mCurrentKeyIndex = keyIndex; + // Release the old key and press the new key + final List keys = mKeyboard.getKeys(); + if (oldKeyIndex != mCurrentKeyIndex) { + if (oldKeyIndex != NOT_A_KEY && keys.size() > oldKeyIndex) { + keys.get(oldKeyIndex).onReleased(mCurrentKeyIndex == NOT_A_KEY); + invalidateKey(oldKeyIndex); + } + if (mCurrentKeyIndex != NOT_A_KEY && keys.size() > mCurrentKeyIndex) { + keys.get(mCurrentKeyIndex).onPressed(); + invalidateKey(mCurrentKeyIndex); + } + } + // If key changed and preview is on ... + if (oldKeyIndex != mCurrentKeyIndex && mShowPreview) { + if (previewPopup.isShowing()) { + if (keyIndex == NOT_A_KEY) { + mHandler.sendMessageDelayed(mHandler + .obtainMessage(MSG_REMOVE_PREVIEW), 60); + } + } + if (keyIndex != NOT_A_KEY) { + Key key = keys.get(keyIndex); + if (key.icon != null) { + mPreviewText.setCompoundDrawables(null, null, null, + key.iconPreview != null ? key.iconPreview : key.icon); + mPreviewText.setText(null); + } else { + mPreviewText.setCompoundDrawables(null, null, null, null); + mPreviewText.setText(getPreviewText(key)); + if (key.label.length() > 1 && key.codes.length < 2) { + mPreviewText.setTextSize(mLabelTextSize); + } else { + mPreviewText.setTextSize(mPreviewTextSizeLarge); + } + } + mPreviewText.measure(MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED), + MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED)); + int popupWidth = Math.max(mPreviewText.getMeasuredWidth(), key.width + + mPreviewText.getPaddingLeft() + mPreviewText.getPaddingRight()); + final int popupHeight = mPreviewHeight; + LayoutParams lp = mPreviewText.getLayoutParams(); + if (lp != null) { + lp.width = popupWidth; + lp.height = popupHeight; + } + previewPopup.setWidth(popupWidth); + previewPopup.setHeight(popupHeight); + if (!mPreviewCentered) { + mPopupPreviewX = key.x - mPreviewText.getPaddingLeft() + mPaddingLeft; + mPopupPreviewY = key.y - popupHeight + mPreviewOffset; + } else { + // TODO: Fix this if centering is brought back + mPopupPreviewX = 160 - mPreviewText.getMeasuredWidth() / 2; + mPopupPreviewY = - mPreviewText.getMeasuredHeight(); + } + mHandler.removeMessages(MSG_REMOVE_PREVIEW); + if (mOffsetInWindow == null) { + mOffsetInWindow = new int[2]; + getLocationInWindow(mOffsetInWindow); + mOffsetInWindow[0] += mMiniKeyboardOffsetX; // Offset may be zero + mOffsetInWindow[1] += mMiniKeyboardOffsetY; // Offset may be zero + } + // Set the preview background state + mPreviewText.getBackground().setState( + key.popupResId != 0 ? LONG_PRESSABLE_STATE_SET : EMPTY_STATE_SET); + if (previewPopup.isShowing()) { + previewPopup.update(mPopupPreviewX + mOffsetInWindow[0], + mPopupPreviewY + mOffsetInWindow[1], + popupWidth, popupHeight); + } else { + previewPopup.showAtLocation(mPopupParent, Gravity.NO_GRAVITY, + mPopupPreviewX + mOffsetInWindow[0], + mPopupPreviewY + mOffsetInWindow[1]); + } + mPreviewText.setVisibility(VISIBLE); + } + } + } + + private void invalidateKey(int keyIndex) { + if (keyIndex < 0 || keyIndex >= mKeyboard.getKeys().size()) { + return; + } + final Key key = mKeyboard.getKeys().get(keyIndex); + invalidate(key.x + mPaddingLeft, key.y + mPaddingTop, + key.x + key.width + mPaddingLeft, key.y + key.height + mPaddingTop); + } + + private boolean openPopupIfRequired(MotionEvent me) { + // Check if we have a popup layout specified first. + if (mPopupLayout == 0) { + return false; + } + if (mCurrentKey < 0 || mCurrentKey >= mKeyboard.getKeys().size()) { + return false; + } + + Key popupKey = mKeyboard.getKeys().get(mCurrentKey); + boolean result = onLongPress(popupKey); + if (result) { + mAbortKey = true; + showPreview(NOT_A_KEY); + } + return result; + } + + /** + * Called when a key is long pressed. By default this will open any popup keyboard associated + * with this key through the attributes popupLayout and popupCharacters. + * @param popupKey the key that was long pressed + * @return true if the long press is handled, false otherwise. Subclasses should call the + * method on the base class if the subclass doesn't wish to handle the call. + */ + protected boolean onLongPress(Key popupKey) { + int popupKeyboardId = popupKey.popupResId; + + if (popupKeyboardId != 0) { + mMiniKeyboardContainer = mMiniKeyboardCache.get(popupKey); + if (mMiniKeyboardContainer == null) { + LayoutInflater inflater = (LayoutInflater) getContext().getSystemService( + Context.LAYOUT_INFLATER_SERVICE); + mMiniKeyboardContainer = inflater.inflate(mPopupLayout, null); + mMiniKeyboard = (KeyboardView) mMiniKeyboardContainer.findViewById( + com.android.internal.R.id.keyboardView); + View closeButton = mMiniKeyboardContainer.findViewById( + com.android.internal.R.id.button_close); + if (closeButton != null) closeButton.setOnClickListener(this); + mMiniKeyboard.setOnKeyboardActionListener(new OnKeyboardActionListener() { + public void onKey(int primaryCode, int[] keyCodes) { + mKeyboardActionListener.onKey(primaryCode, keyCodes); + dismissPopupKeyboard(); + } + + public void swipeLeft() { } + public void swipeRight() { } + public void swipeUp() { } + public void swipeDown() { } + }); + //mInputView.setSuggest(mSuggest); + Keyboard keyboard; + if (popupKey.popupCharacters != null) { + keyboard = new Keyboard(getContext(), popupKeyboardId, + popupKey.popupCharacters, -1, getPaddingLeft() + getPaddingRight()); + } else { + keyboard = new Keyboard(getContext(), popupKeyboardId); + } + mMiniKeyboard.setKeyboard(keyboard); + mMiniKeyboard.setPopupParent(this); + mMiniKeyboardContainer.measure( + MeasureSpec.makeMeasureSpec(getWidth(), MeasureSpec.AT_MOST), + MeasureSpec.makeMeasureSpec(getHeight(), MeasureSpec.AT_MOST)); + + mMiniKeyboardCache.put(popupKey, mMiniKeyboardContainer); + } else { + mMiniKeyboard = (KeyboardView) mMiniKeyboardContainer.findViewById( + com.android.internal.R.id.keyboardView); + } + if (mWindowOffset == null) { + mWindowOffset = new int[2]; + getLocationInWindow(mWindowOffset); + } + mPopupX = popupKey.x + mPaddingLeft; + mPopupY = popupKey.y + mPaddingTop; + mPopupX = mPopupX + popupKey.width - mMiniKeyboardContainer.getMeasuredWidth(); + mPopupY = mPopupY - mMiniKeyboardContainer.getMeasuredHeight(); + final int x = mPopupX + mMiniKeyboardContainer.getPaddingRight() + mWindowOffset[0]; + final int y = mPopupY + mMiniKeyboardContainer.getPaddingBottom() + mWindowOffset[1]; + mMiniKeyboard.setPopupOffset(x < 0 ? 0 : x, y); + mMiniKeyboard.setShifted(isShifted()); + mPopupKeyboard.setContentView(mMiniKeyboardContainer); + mPopupKeyboard.setWidth(mMiniKeyboardContainer.getMeasuredWidth()); + mPopupKeyboard.setHeight(mMiniKeyboardContainer.getMeasuredHeight()); + mPopupKeyboard.showAtLocation(this, Gravity.NO_GRAVITY, x, y); + mMiniKeyboardOnScreen = true; + //mMiniKeyboard.onTouchEvent(getTranslatedEvent(me)); + invalidate(); + return true; + } + return false; + } + + @Override + public boolean onTouchEvent(MotionEvent me) { + int touchX = (int) me.getX() - mPaddingLeft; + int touchY = (int) me.getY() + mVerticalCorrection - mPaddingTop; + int action = me.getAction(); + long eventTime = me.getEventTime(); + int keyIndex = getKeyIndices(touchX, touchY, null); + + if (mGestureDetector.onTouchEvent(me)) { + showPreview(NOT_A_KEY); + mHandler.removeMessages(MSG_REPEAT); + return true; + } + + // Needs to be called after the gesture detector gets a turn, as it may have + // displayed the mini keyboard + if (mMiniKeyboardOnScreen) { + return true; + } + + switch (action) { + case MotionEvent.ACTION_DOWN: + mAbortKey = false; + mStartX = touchX; + mStartY = touchY; + mLastCodeX = touchX; + mLastCodeY = touchY; + mLastKeyTime = 0; + mCurrentKeyTime = 0; + mLastKey = NOT_A_KEY; + mCurrentKey = keyIndex; + mDownTime = me.getEventTime(); + mLastMoveTime = mDownTime; + checkMultiTap(eventTime, keyIndex); + if (mCurrentKey >= 0 && mKeyboard.getKeys().get(mCurrentKey).repeatable) { + mRepeatKeyIndex = mCurrentKey; + repeatKey(); + Message msg = mHandler.obtainMessage(MSG_REPEAT); + mHandler.sendMessageDelayed(msg, REPEAT_START_DELAY); + } + showPreview(keyIndex); + playKeyClick(); + vibrate(); + break; + + case MotionEvent.ACTION_MOVE: + if (keyIndex != NOT_A_KEY) { + if (mCurrentKey == NOT_A_KEY) { + mCurrentKey = keyIndex; + mCurrentKeyTime = eventTime - mDownTime; + } else { + if (keyIndex == mCurrentKey) { + mCurrentKeyTime += eventTime - mLastMoveTime; + } else { + resetMultiTap(); + mLastKey = mCurrentKey; + mLastCodeX = mLastX; + mLastCodeY = mLastY; + mLastKeyTime = + mCurrentKeyTime + eventTime - mLastMoveTime; + mCurrentKey = keyIndex; + mCurrentKeyTime = 0; + } + } + if (keyIndex != mRepeatKeyIndex) { + mHandler.removeMessages(MSG_REPEAT); + mRepeatKeyIndex = NOT_A_KEY; + } + } + showPreview(keyIndex); + break; + + case MotionEvent.ACTION_UP: + mHandler.removeMessages(MSG_REPEAT); + if (keyIndex == mCurrentKey) { + mCurrentKeyTime += eventTime - mLastMoveTime; + } else { + resetMultiTap(); + mLastKey = mCurrentKey; + mLastKeyTime = mCurrentKeyTime + eventTime - mLastMoveTime; + mCurrentKey = keyIndex; + mCurrentKeyTime = 0; + } + if (mCurrentKeyTime < mLastKeyTime && mLastKey != NOT_A_KEY) { + mCurrentKey = mLastKey; + touchX = mLastCodeX; + touchY = mLastCodeY; + } + showPreview(NOT_A_KEY); + Arrays.fill(mKeyIndices, NOT_A_KEY); + invalidateKey(keyIndex); + // If we're not on a repeating key (which sends on a DOWN event) + if (mRepeatKeyIndex == NOT_A_KEY && !mMiniKeyboardOnScreen && !mAbortKey) { + detectAndSendKey(touchX, touchY, eventTime); + } + mRepeatKeyIndex = NOT_A_KEY; + break; + } + mLastX = touchX; + mLastY = touchY; + return true; + } + + private boolean repeatKey() { + Key key = mKeyboard.getKeys().get(mRepeatKeyIndex); + detectAndSendKey(key.x, key.y, mLastTapTime); + return true; + } + + protected void swipeRight() { + mKeyboardActionListener.swipeRight(); + } + + protected void swipeLeft() { + mKeyboardActionListener.swipeLeft(); + } + + protected void swipeUp() { + mKeyboardActionListener.swipeUp(); + } + + protected void swipeDown() { + mKeyboardActionListener.swipeDown(); + } + + public void closing() { + if (mPreviewPopup.isShowing()) { + mPreviewPopup.dismiss(); + } + dismissPopupKeyboard(); + } + + @Override + public void onDetachedFromWindow() { + super.onDetachedFromWindow(); + closing(); + } + + private void dismissPopupKeyboard() { + if (mPopupKeyboard.isShowing()) { + mPopupKeyboard.dismiss(); + mMiniKeyboardOnScreen = false; + invalidate(); + } + } + + public boolean handleBack() { + if (mPopupKeyboard.isShowing()) { + dismissPopupKeyboard(); + return true; + } + return false; + } + + private void resetMultiTap() { + mLastSentIndex = NOT_A_KEY; + mTapCount = 0; + mLastTapTime = -1; + mInMultiTap = false; + } + + private void checkMultiTap(long eventTime, int keyIndex) { + if (keyIndex == NOT_A_KEY) return; + Key key = mKeyboard.getKeys().get(keyIndex); + if (key.codes.length > 1) { + mInMultiTap = true; + if (eventTime < mLastTapTime + MULTITAP_INTERVAL + && keyIndex == mLastSentIndex) { + mTapCount = (mTapCount + 1) % key.codes.length; + return; + } else { + mTapCount = -1; + return; + } + } + if (eventTime > mLastTapTime + MULTITAP_INTERVAL || keyIndex != mLastSentIndex) { + resetMultiTap(); + } + } +} diff --git a/core/java/android/inputmethodservice/SoftInputWindow.java b/core/java/android/inputmethodservice/SoftInputWindow.java new file mode 100644 index 0000000000000..9ff1665988dad --- /dev/null +++ b/core/java/android/inputmethodservice/SoftInputWindow.java @@ -0,0 +1,151 @@ +/* + * Copyright (C) 2007-2008 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ + +package android.inputmethodservice; + +import android.app.Dialog; +import android.content.Context; +import android.os.IBinder; +import android.view.Gravity; +import android.view.WindowManager; + +/** + * A SoftInputWindow is a Dialog that is intended to be used for a top-level input + * method window. It will be displayed along the edge of the screen, moving + * the application user interface away from it so that the focused item is + * always visible. + */ +class SoftInputWindow extends Dialog { + + /** + * Create a DockWindow that uses the default style. + * + * @param context The Context the DockWindow is to run it. In particular, it + * uses the window manager and theme in this context to present its + * UI. + */ + public SoftInputWindow(Context context) { + super(context, com.android.internal.R.style.Theme_InputMethod); + initDockWindow(); + } + + public void setToken(IBinder token) { + WindowManager.LayoutParams lp = getWindow().getAttributes(); + lp.token = token; + getWindow().setAttributes(lp); + } + + /** + * Create a DockWindow that uses a custom style. + * + * @param context The Context in which the DockWindow should run. In + * particular, it uses the window manager and theme from this context + * to present its UI. + * @param theme A style resource describing the theme to use for the window. + * See Style + * and Theme Resources for more information about defining and + * using styles. This theme is applied on top of the current theme in + * context. If 0, the default dialog theme will be used. + */ + public SoftInputWindow(Context context, int theme) { + super(context, theme); + initDockWindow(); + } + + /** + * Get the size of the DockWindow. + * + * @return If the DockWindow sticks to the top or bottom of the screen, the + * return value is the height of the DockWindow, and its width is + * equal to the width of the screen; If the DockWindow sticks to the + * left or right of the screen, the return value is the width of the + * DockWindow, and its height is equal to the height of the screen. + */ + public int getSize() { + WindowManager.LayoutParams lp = getWindow().getAttributes(); + + if (lp.gravity == Gravity.TOP || lp.gravity == Gravity.BOTTOM) { + return lp.height; + } else { + return lp.width; + } + } + + /** + * Set the size of the DockWindow. + * + * @param size If the DockWindow sticks to the top or bottom of the screen, + * size is the height of the DockWindow, and its width is + * equal to the width of the screen; If the DockWindow sticks to the + * left or right of the screen, size is the width of the + * DockWindow, and its height is equal to the height of the screen. + */ + public void setSize(int size) { + WindowManager.LayoutParams lp = getWindow().getAttributes(); + + if (lp.gravity == Gravity.TOP || lp.gravity == Gravity.BOTTOM) { + lp.width = -1; + lp.height = size; + } else { + lp.width = size; + lp.height = -1; + } + getWindow().setAttributes(lp); + } + + /** + * Set which boundary of the screen the DockWindow sticks to. + * + * @param gravity The boundary of the screen to stick. See {#link + * android.view.Gravity.LEFT}, {#link android.view.Gravity.TOP}, + * {#link android.view.Gravity.BOTTOM}, {#link + * android.view.Gravity.RIGHT}. + */ + public void setGravity(int gravity) { + WindowManager.LayoutParams lp = getWindow().getAttributes(); + + boolean oldIsVertical = (lp.gravity == Gravity.TOP || lp.gravity == Gravity.BOTTOM); + + lp.gravity = gravity; + + boolean newIsVertical = (lp.gravity == Gravity.TOP || lp.gravity == Gravity.BOTTOM); + + if (oldIsVertical != newIsVertical) { + int tmp = lp.width; + lp.width = lp.height; + lp.height = tmp; + getWindow().setAttributes(lp); + } + } + + private void initDockWindow() { + WindowManager.LayoutParams lp = getWindow().getAttributes(); + + lp.type = WindowManager.LayoutParams.TYPE_INPUT_METHOD; + lp.setTitle("InputMethod"); + + lp.gravity = Gravity.BOTTOM; + lp.width = -1; + + getWindow().setAttributes(lp); + getWindow().setFlags( + WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN | + WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE, + WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN | + WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | + WindowManager.LayoutParams.FLAG_DIM_BEHIND); + } +} diff --git a/core/java/android/inputmethodservice/package.html b/core/java/android/inputmethodservice/package.html new file mode 100644 index 0000000000000..164349ba9a3fa --- /dev/null +++ b/core/java/android/inputmethodservice/package.html @@ -0,0 +1,8 @@ + + +Base classes for writing input methods. These APIs are not for use by +normal applications, they are a framework specifically for writing input +method components. Implementations will typically derive from +{@link android.inputmethodservice.InputMethodService}. + + diff --git a/core/java/android/net/MobileDataStateTracker.java b/core/java/android/net/MobileDataStateTracker.java index ae74e6f24ca11..1d939e10068c3 100644 --- a/core/java/android/net/MobileDataStateTracker.java +++ b/core/java/android/net/MobileDataStateTracker.java @@ -30,7 +30,6 @@ import com.android.internal.telephony.TelephonyIntents; import android.net.NetworkInfo.DetailedState; import android.telephony.TelephonyManager; import android.util.Log; -import android.util.Config; import android.text.TextUtils; import java.util.List; @@ -71,7 +70,9 @@ public class MobileDataStateTracker extends NetworkStateTracker { * @param target a message handler for getting callbacks about state changes */ public MobileDataStateTracker(Context context, Handler target) { - super(context, target, ConnectivityManager.TYPE_MOBILE); + super(context, target, ConnectivityManager.TYPE_MOBILE, + TelephonyManager.getDefault().getNetworkType(), "MOBILE", + TelephonyManager.getDefault().getNetworkTypeName()); mPhoneService = null; mDnsServers = new ArrayList(); } @@ -80,9 +81,10 @@ public class MobileDataStateTracker extends NetworkStateTracker { * Begin monitoring mobile data connectivity. */ public void startMonitoring() { - - IntentFilter filter = new IntentFilter(TelephonyIntents.ACTION_ANY_DATA_CONNECTION_STATE_CHANGED); + IntentFilter filter = + new IntentFilter(TelephonyIntents.ACTION_ANY_DATA_CONNECTION_STATE_CHANGED); filter.addAction(TelephonyIntents.ACTION_DATA_CONNECTION_FAILED); + filter.addAction(TelephonyIntents.ACTION_SERVICE_STATE_CHANGED); Intent intent = mContext.registerReceiver(new MobileDataStateReceiver(), filter); if (intent != null) @@ -146,6 +148,9 @@ public class MobileDataStateTracker extends NetworkStateTracker { reason == null ? "" : "(" + reason + ")"); setDetailedState(DetailedState.FAILED, reason, apnName); } + TelephonyManager tm = TelephonyManager.getDefault(); + setRoamingStatus(tm.isNetworkRoaming()); + setSubtype(tm.getNetworkType(), tm.getNetworkTypeName()); } } @@ -222,6 +227,15 @@ public class MobileDataStateTracker extends NetworkStateTracker { return getNameServerList(sDnsPropNames); } + /** + * {@inheritDoc} + * The mobile data network subtype indicates what generation network technology is in effect, + * e.g., GPRS, EDGE, UMTS, etc. + */ + public int getNetworkSubtype() { + return TelephonyManager.getDefault().getNetworkType(); + } + /** * Return the system properties name associated with the tcp buffer sizes * for this network. @@ -358,8 +372,8 @@ public class MobileDataStateTracker extends NetworkStateTracker { } /** - * Tells the phone sub-system that the caller is finished is - * finished using the named feature. The only supported feature at + * Tells the phone sub-system that the caller is finished + * using the named feature. The only supported feature at * this time is {@code Phone.FEATURE_ENABLE_MMS}, which allows an application * to specify that it wants to send and/or receive MMS data. * @param feature the name of the feature that is no longer needed diff --git a/core/java/android/net/NetworkInfo.java b/core/java/android/net/NetworkInfo.java index f776abfb05bcb..8c82212f0d867 100644 --- a/core/java/android/net/NetworkInfo.java +++ b/core/java/android/net/NetworkInfo.java @@ -99,24 +99,38 @@ public class NetworkInfo implements Parcelable { } private int mNetworkType; + private int mSubtype; + private String mTypeName; + private String mSubtypeName; private State mState; private DetailedState mDetailedState; private String mReason; private String mExtraInfo; private boolean mIsFailover; + private boolean mIsRoaming; /** * Indicates whether network connectivity is possible: */ private boolean mIsAvailable; - public NetworkInfo(int type) { + /** + * TODO This is going away as soon as API council review happens. + * @param type network type + */ + public NetworkInfo(int type) {} + + NetworkInfo(int type, int subtype, String typeName, String subtypeName) { if (!ConnectivityManager.isNetworkTypeValid(type)) { throw new IllegalArgumentException("Invalid network type: " + type); } - this.mNetworkType = type; + mNetworkType = type; + mSubtype = subtype; + mTypeName = typeName; + mSubtypeName = subtypeName; setDetailedState(DetailedState.IDLE, null, null); mState = State.UNKNOWN; mIsAvailable = true; + mIsRoaming = false; } /** @@ -128,6 +142,41 @@ public class NetworkInfo implements Parcelable { return mNetworkType; } + /** + * Return a network-type-specific integer describing the subtype + * of the network. + * @return the network subtype + * + * @hide pending API council review + */ + public int getSubtype() { + return mSubtype; + } + + void setSubtype(int subtype, String subtypeName) { + mSubtype = subtype; + mSubtypeName = subtypeName; + } + + /** + * Return a human-readable name describe the type of the network, + * for example "WIFI" or "MOBILE". + * @return the name of the network type + */ + public String getTypeName() { + return mTypeName; + } + + /** + * Return a human-readable name describing the subtype of the network. + * @return the name of the network subtype + * + * @hide pending API council review + */ + public String getSubtypeName() { + return mSubtypeName; + } + /** * Indicates whether network connectivity exists or is in the process * of being established. This is good for applications that need to @@ -170,7 +219,7 @@ public class NetworkInfo implements Parcelable { * Sets if the network is available, ie, if the connectivity is possible. * @param isAvailable the new availability value. * - * {@hide} + * @hide */ public void setIsAvailable(boolean isAvailable) { mIsAvailable = isAvailable; @@ -187,11 +236,32 @@ public class NetworkInfo implements Parcelable { return mIsFailover; } - /** {@hide} */ + /** + * Set the failover boolean. + * @param isFailover {@code true} to mark the current connection attempt + * as a failover. + * @hide + */ public void setFailover(boolean isFailover) { mIsFailover = isFailover; } + /** + * Indicates whether the device is currently roaming on this network. + * When {@code true}, it suggests that use of data on this network + * may incur extra costs. + * @return {@code true} if roaming is in effect, {@code false} otherwise. + * + * @hide pending API council + */ + public boolean isRoaming() { + return mIsRoaming; + } + + void setRoaming(boolean isRoaming) { + mIsRoaming = isRoaming; + } + /** * Reports the current coarse-grained state of the network. * @return the coarse-grained state @@ -215,8 +285,6 @@ public class NetworkInfo implements Parcelable { * if one was supplied. May be {@code null}. * @param extraInfo an optional {@code String} providing addditional network state * information passed up from the lower networking layers. - * - * {@hide} */ void setDetailedState(DetailedState detailedState, String reason, String extraInfo) { this.mDetailedState = detailedState; @@ -247,52 +315,59 @@ public class NetworkInfo implements Parcelable { @Override public String toString() { StringBuilder builder = new StringBuilder("NetworkInfo: "); - builder.append("type: ").append(getTypeName()).append(", state: ").append(mState). - append("/").append(mDetailedState). + builder.append("type: ").append(getTypeName()).append("[").append(getSubtypeName()). + append("], state: ").append(mState).append("/").append(mDetailedState). append(", reason: ").append(mReason == null ? "(unspecified)" : mReason). append(", extra: ").append(mExtraInfo == null ? "(none)" : mExtraInfo). + append(", roaming: ").append(mIsRoaming). append(", failover: ").append(mIsFailover). append(", isAvailable: ").append(mIsAvailable); return builder.toString(); } - public String getTypeName() { - switch (mNetworkType) { - case ConnectivityManager.TYPE_WIFI: - return "WIFI"; - case ConnectivityManager.TYPE_MOBILE: - return "MOBILE"; - default: - return ""; - } - } - - /** Implement the Parcelable interface {@hide} */ + /** + * Implement the Parcelable interface + * @hide + */ public int describeContents() { return 0; } - /** Implement the Parcelable interface {@hide} */ + /** + * Implement the Parcelable interface. + * @hide + */ public void writeToParcel(Parcel dest, int flags) { dest.writeInt(mNetworkType); + dest.writeInt(mSubtype); + dest.writeString(mTypeName); + dest.writeString(mSubtypeName); dest.writeString(mState.name()); dest.writeString(mDetailedState.name()); dest.writeInt(mIsFailover ? 1 : 0); dest.writeInt(mIsAvailable ? 1 : 0); + dest.writeInt(mIsRoaming ? 1 : 0); dest.writeString(mReason); dest.writeString(mExtraInfo); } - /** Implement the Parcelable interface {@hide} */ + /** + * Implement the Parcelable interface. + * @hide + */ public static final Creator CREATOR = new Creator() { public NetworkInfo createFromParcel(Parcel in) { int netType = in.readInt(); - NetworkInfo netInfo = new NetworkInfo(netType); + int subtype = in.readInt(); + String typeName = in.readString(); + String subtypeName = in.readString(); + NetworkInfo netInfo = new NetworkInfo(netType, subtype, typeName, subtypeName); netInfo.mState = State.valueOf(in.readString()); netInfo.mDetailedState = DetailedState.valueOf(in.readString()); netInfo.mIsFailover = in.readInt() != 0; netInfo.mIsAvailable = in.readInt() != 0; + netInfo.mIsRoaming = in.readInt() != 0; netInfo.mReason = in.readString(); netInfo.mExtraInfo = in.readString(); return netInfo; diff --git a/core/java/android/net/NetworkStateTracker.java b/core/java/android/net/NetworkStateTracker.java index 4e1efa6d42933..37087aca23a91 100644 --- a/core/java/android/net/NetworkStateTracker.java +++ b/core/java/android/net/NetworkStateTracker.java @@ -22,7 +22,6 @@ import java.io.IOException; import android.os.Handler; import android.os.Message; import android.os.SystemProperties; -import android.os.PowerManager; import android.content.Context; import android.text.TextUtils; import android.util.Config; @@ -41,6 +40,7 @@ public abstract class NetworkStateTracker extends Handler { protected NetworkInfo mNetworkInfo; protected Context mContext; protected Handler mTarget; + private boolean mTeardownRequested; private static boolean DBG = Config.LOGV; private static final String TAG = "NetworkStateTracker"; @@ -54,12 +54,20 @@ public abstract class NetworkStateTracker extends Handler { */ public static final int EVENT_NOTIFICATION_CHANGED = 3; public static final int EVENT_CONFIGURATION_CHANGED = 4; - - public NetworkStateTracker(Context context, Handler target, int networkType) { + public static final int EVENT_ROAMING_CHANGED = 5; + public static final int EVENT_NETWORK_SUBTYPE_CHANGED = 6; + + public NetworkStateTracker(Context context, + Handler target, + int networkType, + int subType, + String typeName, + String subtypeName) { super(); mContext = context; mTarget = target; - this.mNetworkInfo = new NetworkInfo(networkType); + mTeardownRequested = false; + this.mNetworkInfo = new NetworkInfo(networkType, subType, typeName, subtypeName); } public NetworkInfo getNetworkInfo() { @@ -222,6 +230,14 @@ public abstract class NetworkStateTracker extends Handler { mNetworkInfo.setDetailedState(state, null, null); } + public void setTeardownRequested(boolean isRequested) { + mTeardownRequested = isRequested; + } + + public boolean isTeardownRequested() { + return mTeardownRequested; + } + /** * Send a notification that the results of a scan for network access * points has completed, and results are available. @@ -231,6 +247,32 @@ public abstract class NetworkStateTracker extends Handler { msg.sendToTarget(); } + /** + * Record the roaming status of the device, and if it is a change from the previous + * status, send a notification to any listeners. + * @param isRoaming {@code true} if the device is now roaming, {@code false} + * if it is no longer roaming. + */ + protected void setRoamingStatus(boolean isRoaming) { + if (isRoaming != mNetworkInfo.isRoaming()) { + mNetworkInfo.setRoaming(isRoaming); + Message msg = mTarget.obtainMessage(EVENT_ROAMING_CHANGED, mNetworkInfo); + msg.sendToTarget(); + } + } + + protected void setSubtype(int subtype, String subtypeName) { + if (mNetworkInfo.isConnected()) { + int oldSubtype = mNetworkInfo.getSubtype(); + if (subtype != oldSubtype) { + mNetworkInfo.setSubtype(subtype, subtypeName); + Message msg = mTarget.obtainMessage( + EVENT_NETWORK_SUBTYPE_CHANGED, oldSubtype, 0, mNetworkInfo); + msg.sendToTarget(); + } + } + } + public abstract void startMonitoring(); /** diff --git a/core/java/android/net/NetworkUtils.java b/core/java/android/net/NetworkUtils.java index 129248aebf10d..115364872955d 100644 --- a/core/java/android/net/NetworkUtils.java +++ b/core/java/android/net/NetworkUtils.java @@ -66,6 +66,14 @@ public class NetworkUtils { */ public native static boolean stopDhcp(String interfaceName); + /** + * Release the current DHCP lease. + * @param interfaceName the name of the interface for which the lease should + * be released + * @return {@code true} for success, {@code false} for failure + */ + public native static boolean releaseDhcpLease(String interfaceName); + /** * Return the last DHCP-related error message that was recorded. *

    NOTE: This string is not localized, but currently it is only diff --git a/core/java/android/net/Proxy.java b/core/java/android/net/Proxy.java index 86e1d5b64c6ff..9f07c0a2c5b04 100644 --- a/core/java/android/net/Proxy.java +++ b/core/java/android/net/Proxy.java @@ -43,9 +43,9 @@ final public class Proxy { static final public String getHost(Context ctx) { ContentResolver contentResolver = ctx.getContentResolver(); Assert.assertNotNull(contentResolver); - String host = Settings.System.getString( + String host = Settings.Secure.getString( contentResolver, - Settings.System.HTTP_PROXY); + Settings.Secure.HTTP_PROXY); if (host != null) { int i = host.indexOf(':'); if (i == -1) { @@ -67,9 +67,9 @@ final public class Proxy { static final public int getPort(Context ctx) { ContentResolver contentResolver = ctx.getContentResolver(); Assert.assertNotNull(contentResolver); - String host = Settings.System.getString( + String host = Settings.Secure.getString( contentResolver, - Settings.System.HTTP_PROXY); + Settings.Secure.HTTP_PROXY); if (host != null) { int i = host.indexOf(':'); if (i == -1) { diff --git a/core/java/android/net/http/Connection.java b/core/java/android/net/http/Connection.java index 2c82582c20425..563634fd4690a 100644 --- a/core/java/android/net/http/Connection.java +++ b/core/java/android/net/http/Connection.java @@ -375,6 +375,11 @@ abstract class Connection { if (HttpLog.LOGV) HttpLog.v("Failed to open connection"); error = EventHandler.ERROR_LOOKUP; exception = e; + } catch (IllegalArgumentException e) { + if (HttpLog.LOGV) HttpLog.v("Illegal argument exception"); + error = EventHandler.ERROR_CONNECT; + req.mFailCount = RETRY_REQUEST_LIMIT; + exception = e; } catch (SSLConnectionClosedByUserException e) { // hack: if we have an SSL connection failure, // we don't want to reconnect diff --git a/core/java/android/net/http/Headers.java b/core/java/android/net/http/Headers.java index 5d85ba4066232..b0923d1ce27ef 100644 --- a/core/java/android/net/http/Headers.java +++ b/core/java/android/net/http/Headers.java @@ -30,7 +30,7 @@ import org.apache.http.util.CharArrayBuffer; /** * Manages received headers - * + * * {@hide} */ public final class Headers { @@ -42,16 +42,16 @@ public final class Headers { */ public final static int CONN_CLOSE = 1; /** - * indicate HTTP 1.1 connection keep alive + * indicate HTTP 1.1 connection keep alive */ public final static int CONN_KEEP_ALIVE = 2; - + // initial values. public final static int NO_CONN_TYPE = 0; public final static long NO_TRANSFER_ENCODING = 0; public final static long NO_CONTENT_LENGTH = -1; - // header string + // header strings public final static String TRANSFER_ENCODING = "transfer-encoding"; public final static String CONTENT_LEN = "content-length"; public final static String CONTENT_TYPE = "content-type"; @@ -93,25 +93,61 @@ public final class Headers { private final static int HASH_PRAGMA = -980228804; private final static int HASH_REFRESH = 1085444827; + // keep any headers that require direct access in a presized + // string array + private final static int IDX_TRANSFER_ENCODING = 0; + private final static int IDX_CONTENT_LEN = 1; + private final static int IDX_CONTENT_TYPE = 2; + private final static int IDX_CONTENT_ENCODING = 3; + private final static int IDX_CONN_DIRECTIVE = 4; + private final static int IDX_LOCATION = 5; + private final static int IDX_PROXY_CONNECTION = 6; + private final static int IDX_WWW_AUTHENTICATE = 7; + private final static int IDX_PROXY_AUTHENTICATE = 8; + private final static int IDX_CONTENT_DISPOSITION = 9; + private final static int IDX_ACCEPT_RANGES = 10; + private final static int IDX_EXPIRES = 11; + private final static int IDX_CACHE_CONTROL = 12; + private final static int IDX_LAST_MODIFIED = 13; + private final static int IDX_ETAG = 14; + private final static int IDX_SET_COOKIE = 15; + private final static int IDX_PRAGMA = 16; + private final static int IDX_REFRESH = 17; + + private final static int HEADER_COUNT = 18; + + /* parsed values */ private long transferEncoding; private long contentLength; // Content length of the incoming data private int connectionType; - - private String contentType; - private String contentEncoding; - private String location; - private String wwwAuthenticate; - private String proxyAuthenticate; - private String contentDisposition; - private String acceptRanges; - private String expires; - private String cacheControl; - private String lastModified; - private String etag; - private String pragma; - private String refresh; private ArrayList cookies = new ArrayList(2); + private String[] mHeaders = new String[HEADER_COUNT]; + private final static String[] sHeaderNames = { + TRANSFER_ENCODING, + CONTENT_LEN, + CONTENT_TYPE, + CONTENT_ENCODING, + CONN_DIRECTIVE, + LOCATION, + PROXY_CONNECTION, + WWW_AUTHENTICATE, + PROXY_AUTHENTICATE, + CONTENT_DISPOSITION, + ACCEPT_RANGES, + EXPIRES, + CACHE_CONTROL, + LAST_MODIFIED, + ETAG, + SET_COOKIE, + PRAGMA, + REFRESH + }; + + // Catch-all for headers not explicitly handled + private ArrayList mExtraHeaderNames = new ArrayList(4); + private ArrayList mExtraHeaderValues = new ArrayList(4); + public Headers() { transferEncoding = NO_TRANSFER_ENCODING; contentLength = NO_CONTENT_LENGTH; @@ -129,23 +165,22 @@ public final class Headers { } pos++; + String val = buffer.substringTrimmed(pos, buffer.length()); if (HttpLog.LOGV) { - String val = buffer.substringTrimmed(pos, buffer.length()); HttpLog.v("hdr " + buffer.length() + " " + buffer); } switch (name.hashCode()) { case HASH_TRANSFER_ENCODING: if (name.equals(TRANSFER_ENCODING)) { - // headers.transferEncoding = + mHeaders[IDX_TRANSFER_ENCODING] = val; HeaderElement[] encodings = BasicHeaderValueParser.DEFAULT - .parseElements(buffer, new ParserCursor(pos, + .parseElements(buffer, new ParserCursor(pos, buffer.length())); // The chunked encoding must be the last one applied RFC2616, // 14.41 int len = encodings.length; - if (HTTP.IDENTITY_CODING.equalsIgnoreCase(buffer - .substringTrimmed(pos, buffer.length()))) { + if (HTTP.IDENTITY_CODING.equalsIgnoreCase(val)) { transferEncoding = ContentLengthStrategy.IDENTITY; } else if ((len > 0) && (HTTP.CHUNK_CODING @@ -158,9 +193,9 @@ public final class Headers { break; case HASH_CONTENT_LEN: if (name.equals(CONTENT_LEN)) { + mHeaders[IDX_CONTENT_LEN] = val; try { - contentLength = Long.parseLong(buffer.substringTrimmed(pos, - buffer.length())); + contentLength = Long.parseLong(val); } catch (NumberFormatException e) { if (Config.LOGV) { Log.v(LOGTAG, "Headers.headers(): error parsing" @@ -171,88 +206,90 @@ public final class Headers { break; case HASH_CONTENT_TYPE: if (name.equals(CONTENT_TYPE)) { - contentType = buffer.substringTrimmed(pos, buffer.length()); + mHeaders[IDX_CONTENT_TYPE] = val; } break; case HASH_CONTENT_ENCODING: if (name.equals(CONTENT_ENCODING)) { - contentEncoding = buffer.substringTrimmed(pos, buffer.length()); + mHeaders[IDX_CONTENT_ENCODING] = val; } break; case HASH_CONN_DIRECTIVE: if (name.equals(CONN_DIRECTIVE)) { + mHeaders[IDX_CONN_DIRECTIVE] = val; setConnectionType(buffer, pos); } break; case HASH_LOCATION: if (name.equals(LOCATION)) { - location = buffer.substringTrimmed(pos, buffer.length()); + mHeaders[IDX_LOCATION] = val; } break; case HASH_PROXY_CONNECTION: if (name.equals(PROXY_CONNECTION)) { + mHeaders[IDX_PROXY_CONNECTION] = val; setConnectionType(buffer, pos); } break; case HASH_WWW_AUTHENTICATE: if (name.equals(WWW_AUTHENTICATE)) { - wwwAuthenticate = buffer.substringTrimmed(pos, buffer.length()); + mHeaders[IDX_WWW_AUTHENTICATE] = val; } break; case HASH_PROXY_AUTHENTICATE: if (name.equals(PROXY_AUTHENTICATE)) { - proxyAuthenticate = buffer.substringTrimmed(pos, buffer - .length()); + mHeaders[IDX_PROXY_AUTHENTICATE] = val; } break; case HASH_CONTENT_DISPOSITION: if (name.equals(CONTENT_DISPOSITION)) { - contentDisposition = buffer.substringTrimmed(pos, buffer - .length()); + mHeaders[IDX_CONTENT_DISPOSITION] = val; } break; case HASH_ACCEPT_RANGES: if (name.equals(ACCEPT_RANGES)) { - acceptRanges = buffer.substringTrimmed(pos, buffer.length()); + mHeaders[IDX_ACCEPT_RANGES] = val; } break; case HASH_EXPIRES: if (name.equals(EXPIRES)) { - expires = buffer.substringTrimmed(pos, buffer.length()); + mHeaders[IDX_EXPIRES] = val; } break; case HASH_CACHE_CONTROL: if (name.equals(CACHE_CONTROL)) { - cacheControl = buffer.substringTrimmed(pos, buffer.length()); + mHeaders[IDX_CACHE_CONTROL] = val; } break; case HASH_LAST_MODIFIED: if (name.equals(LAST_MODIFIED)) { - lastModified = buffer.substringTrimmed(pos, buffer.length()); + mHeaders[IDX_LAST_MODIFIED] = val; } break; case HASH_ETAG: if (name.equals(ETAG)) { - etag = buffer.substringTrimmed(pos, buffer.length()); + mHeaders[IDX_ETAG] = val; } break; case HASH_SET_COOKIE: if (name.equals(SET_COOKIE)) { - cookies.add(buffer.substringTrimmed(pos, buffer.length())); + mHeaders[IDX_SET_COOKIE] = val; + cookies.add(val); } break; case HASH_PRAGMA: if (name.equals(PRAGMA)) { - pragma = buffer.substringTrimmed(pos, buffer.length()); + mHeaders[IDX_PRAGMA] = val; } break; case HASH_REFRESH: if (name.equals(REFRESH)) { - refresh = buffer.substringTrimmed(pos, buffer.length()); + mHeaders[IDX_REFRESH] = val; } break; default: - // ignore + mExtraHeaderNames.add(name); + mExtraHeaderValues.add(val); } } @@ -268,70 +305,60 @@ public final class Headers { return connectionType; } - private void setConnectionType(CharArrayBuffer buffer, int pos) { - if (CharArrayBuffers.containsIgnoreCaseTrimmed( - buffer, pos, HTTP.CONN_CLOSE)) { - connectionType = CONN_CLOSE; - } else if (CharArrayBuffers.containsIgnoreCaseTrimmed( - buffer, pos, HTTP.CONN_KEEP_ALIVE)) { - connectionType = CONN_KEEP_ALIVE; - } - } - public String getContentType() { - return this.contentType; + return mHeaders[IDX_CONTENT_TYPE]; } public String getContentEncoding() { - return this.contentEncoding; + return mHeaders[IDX_CONTENT_ENCODING]; } public String getLocation() { - return this.location; + return mHeaders[IDX_LOCATION]; } public String getWwwAuthenticate() { - return this.wwwAuthenticate; + return mHeaders[IDX_WWW_AUTHENTICATE]; } public String getProxyAuthenticate() { - return this.proxyAuthenticate; + return mHeaders[IDX_PROXY_AUTHENTICATE]; } public String getContentDisposition() { - return this.contentDisposition; + return mHeaders[IDX_CONTENT_DISPOSITION]; } public String getAcceptRanges() { - return this.acceptRanges; + return mHeaders[IDX_ACCEPT_RANGES]; } public String getExpires() { - return this.expires; + return mHeaders[IDX_EXPIRES]; } public String getCacheControl() { - return this.cacheControl; + return mHeaders[IDX_CACHE_CONTROL]; } public String getLastModified() { - return this.lastModified; + return mHeaders[IDX_LAST_MODIFIED]; } public String getEtag() { - return this.etag; + return mHeaders[IDX_ETAG]; } public ArrayList getSetCookie() { return this.cookies; } - + public String getPragma() { - return this.pragma; + return mHeaders[IDX_PRAGMA]; } - + public String getRefresh() { - return this.refresh; + return mHeaders[IDX_REFRESH]; } public void setContentLength(long value) { @@ -339,46 +366,82 @@ public final class Headers { } public void setContentType(String value) { - this.contentType = value; + mHeaders[IDX_CONTENT_TYPE] = value; } public void setContentEncoding(String value) { - this.contentEncoding = value; + mHeaders[IDX_CONTENT_ENCODING] = value; } public void setLocation(String value) { - this.location = value; + mHeaders[IDX_LOCATION] = value; } public void setWwwAuthenticate(String value) { - this.wwwAuthenticate = value; + mHeaders[IDX_WWW_AUTHENTICATE] = value; } public void setProxyAuthenticate(String value) { - this.proxyAuthenticate = value; + mHeaders[IDX_PROXY_AUTHENTICATE] = value; } public void setContentDisposition(String value) { - this.contentDisposition = value; + mHeaders[IDX_CONTENT_DISPOSITION] = value; } public void setAcceptRanges(String value) { - this.acceptRanges = value; + mHeaders[IDX_ACCEPT_RANGES] = value; } public void setExpires(String value) { - this.expires = value; + mHeaders[IDX_EXPIRES] = value; } public void setCacheControl(String value) { - this.cacheControl = value; + mHeaders[IDX_CACHE_CONTROL] = value; } public void setLastModified(String value) { - this.lastModified = value; + mHeaders[IDX_LAST_MODIFIED] = value; } public void setEtag(String value) { - this.etag = value; + mHeaders[IDX_ETAG] = value; + } + + public interface HeaderCallback { + public void header(String name, String value); + } + + /** + * Reports all non-null headers to the callback + */ + public void getHeaders(HeaderCallback hcb) { + for (int i = 0; i < HEADER_COUNT; i++) { + String h = mHeaders[i]; + if (h != null) { + hcb.header(sHeaderNames[i], h); + } + } + int extraLen = mExtraHeaderNames.size(); + for (int i = 0; i < extraLen; i++) { + if (Config.LOGV) { + HttpLog.v("Headers.getHeaders() extra: " + i + " " + + mExtraHeaderNames.get(i) + " " + mExtraHeaderValues.get(i)); + } + hcb.header(mExtraHeaderNames.get(i), + mExtraHeaderValues.get(i)); + } + + } + + private void setConnectionType(CharArrayBuffer buffer, int pos) { + if (CharArrayBuffers.containsIgnoreCaseTrimmed( + buffer, pos, HTTP.CONN_CLOSE)) { + connectionType = CONN_CLOSE; + } else if (CharArrayBuffers.containsIgnoreCaseTrimmed( + buffer, pos, HTTP.CONN_KEEP_ALIVE)) { + connectionType = CONN_KEEP_ALIVE; + } } } diff --git a/core/java/android/net/http/Request.java b/core/java/android/net/http/Request.java index bcbecf0a47d24..df4fff015dc0c 100644 --- a/core/java/android/net/http/Request.java +++ b/core/java/android/net/http/Request.java @@ -16,6 +16,7 @@ package android.net.http; +import java.io.EOFException; import java.io.InputStream; import java.io.IOException; import java.util.Iterator; @@ -279,6 +280,11 @@ class Request { count = 0; } } + } catch (EOFException e) { + /* InflaterInputStream throws an EOFException when the + server truncates gzipped content. Handle this case + as we do truncated non-gzipped content: no error */ + if (HttpLog.LOGV) HttpLog.v( "readResponse() handling " + e); } catch(IOException e) { // don't throw if we have a non-OK status code if (statusCode == HttpStatus.SC_OK) { diff --git a/core/java/android/net/http/RequestHandle.java b/core/java/android/net/http/RequestHandle.java index 5d8125092bddc..65e6117d2de0e 100644 --- a/core/java/android/net/http/RequestHandle.java +++ b/core/java/android/net/http/RequestHandle.java @@ -113,7 +113,7 @@ public class RequestHandle { * @param statusCode HTTP status code returned from original request * @param cacheHeaders Cache header for redirect URL * @return true if setup succeeds, false otherwise (redirect loop - * count exceeded) + * count exceeded, body provider unable to rewind on 307 redirect) */ public boolean setupRedirect(String redirectTo, int statusCode, Map cacheHeaders) { @@ -164,8 +164,22 @@ public class RequestHandle { } mMethod = "GET"; } - mHeaders.remove("Content-Type"); - mBodyProvider = null; + /* Only repost content on a 307. If 307, reset the body + provider so we can replay the body */ + if (statusCode == 307) { + try { + if (mBodyProvider != null) mBodyProvider.reset(); + } catch (java.io.IOException ex) { + if (HttpLog.LOGV) { + HttpLog.v("setupAuthResponse() failed to reset body provider"); + } + return false; + } + + } else { + mHeaders.remove("Content-Type"); + mBodyProvider = null; + } // Update the cache headers for this URL mHeaders.putAll(cacheHeaders); diff --git a/core/java/android/net/http/RequestQueue.java b/core/java/android/net/http/RequestQueue.java index d59299560f0af..66d572288f1cd 100644 --- a/core/java/android/net/http/RequestQueue.java +++ b/core/java/android/net/http/RequestQueue.java @@ -596,7 +596,7 @@ public class RequestQueue implements RequestFeeder { } protected synchronized void queueRequest(Request request, boolean head) { - HttpHost host = request.mHost; + HttpHost host = request.mProxyHost == null ? request.mHost : request.mProxyHost; LinkedList reqList; if (mPending.containsKey(host)) { reqList = mPending.get(host); diff --git a/core/java/android/os/AsyncTask.java b/core/java/android/os/AsyncTask.java new file mode 100644 index 0000000000000..ee4e8974b5c7c --- /dev/null +++ b/core/java/android/os/AsyncTask.java @@ -0,0 +1,454 @@ +/* + * Copyright (C) 2008 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.os; + +import java.util.concurrent.ThreadPoolExecutor; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.BlockingQueue; +import java.util.concurrent.LinkedBlockingQueue; +import java.util.concurrent.ThreadFactory; +import java.util.concurrent.Callable; +import java.util.concurrent.FutureTask; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.TimeoutException; +import java.util.concurrent.CancellationException; +import java.util.concurrent.atomic.AtomicInteger; + +/** + *

    AsyncTask enables proper and easy use of the UI thread. This class allows to + * perform background operations and publish results on the UI thread without + * having to manipulate threads and/or handlers.

    + * + *

    An asynchronous task is defined by a computation that runs on a background thread and + * whose result is published on the UI thread. An asynchronous task is defined by 3 generic + * types, called Params, Progress and Result, + * and 4 steps, called begin, doInBackground, + * processProgress and end.

    + * + *

    Usage

    + *

    AsyncTask must be subclassed to be used. The subclass will override at least + * one method ({@link #doInBackground}), and most often will override a + * second one ({@link #onPostExecute}.)

    + * + *

    Here is an example of subclassing:

    + *
    + * private class DownloadFilesTask extends AsyncTask<URL, Integer, Long> {
    + *     protected Long doInBackground(URL... urls) {
    + *         int count = urls.length;
    + *         long totalSize = 0;
    + *         for (int i = 0; i < count; i++) {
    + *             totalSize += Downloader.downloadFile(urls[i]);
    + *             publishProgress((int) ((i / (float) count) * 100));
    + *         }
    + *         return totalSize;
    + *     }
    + *
    + *     protected void onProgressUpdate(Integer... progress) {
    + *         setProgressPercent(progress[0]);
    + *     }
    + *
    + *     protected void onPostExecute(Long result) {
    + *         showDialog("Downloaded " + result + " bytes");
    + *     }
    + * }
    + * 
    + * + *

    Once created, a task is executed very simply:

    + *
    + * new DownloadFilesTask().execute(url1, url2, url3);
    + * 
    + * + *

    AsyncTask's generic types

    + *

    The three types used by an asynchronous task are the following:

    + *
      + *
    1. Params, the type of the parameters sent to the task upon + * execution.
    2. + *
    3. Progress, the type of the progress units published during + * the background computation.
    4. + *
    5. Result, the type of the result of the background + * computation.
    6. + *
    + *

    Not all types are always used by am asynchronous task. To mark a type as unused, + * simply use the type {@link Void}:

    + *
    + * private class MyTask extends AsyncTask
    + *
    + * 

    The 4 steps

    + *

    When an asynchronous task is executed, the task goes through 4 steps:

    + *
      + *
    1. {@link #onPreExecute()}, invoked on the UI thread immediately after the task + * is executed. This step is normally used to setup the task, for instance by + * showing a progress bar in the user interface.
    2. + *
    3. {@link #doInBackground}, invoked on the background thread + * immediately after {@link #onPreExecute()} finishes executing. This step is used + * to perform background computation that can take a long time. The parameters + * of the asynchronous task are passed to this step. The result of the computation must + * be returned by this step and will be passed back to the last step. This step + * can also use {@link #publishProgress} to publish one or more units + * of progress. These values are published on the UI thread, in the + * {@link #onProgressUpdate} step.
    4. + *
    5. {@link #onProgressUpdate}, invoked on the UI thread after a + * call to {@link #publishProgress}. The timing of the execution is + * undefined. This method is used to display any form of progress in the user + * interface while the background computation is still executing. For instance, + * it can be used to animate a progress bar or show logs in a text field.
    6. + *
    7. {@link #onPostExecute}, invoked on the UI thread after the background + * computation finishes. The result of the background computation is passed to + * this step as a parameter.
    8. + *
    + * + *

    Threading rules

    + *

    There are a few threading rules that must be followed for this class to + * work properly:

    + *
      + *
    • The task instance must be created on the UI thread.
    • + *
    • {@link #execute} must be invoked on the UI thread.
    • + *
    • Do not call {@link #onPreExecute()}, {@link #onPostExecute}, + * {@link #doInBackground}, {@link #onProgressUpdate} manually.
    • + *
    • The task can be executed only once (an exception will be thrown if + * a second execution is attempted.)
    • + *
    + */ +public abstract class AsyncTask { + private static final String LOG_TAG = "AsyncTask"; + + private static final int CORE_POOL_SIZE = 1; + private static final int MAXIMUM_POOL_SIZE = 10; + private static final int KEEP_ALIVE = 10; + + private static final BlockingQueue sWorkQueue = + new LinkedBlockingQueue(MAXIMUM_POOL_SIZE); + + private static final ThreadFactory sThreadFactory = new ThreadFactory() { + private final AtomicInteger mCount = new AtomicInteger(1); + + public Thread newThread(Runnable r) { + return new Thread(r, "AsyncTask #" + mCount.getAndIncrement()); + } + }; + + private static final ThreadPoolExecutor sExecutor = new ThreadPoolExecutor(CORE_POOL_SIZE, + MAXIMUM_POOL_SIZE, KEEP_ALIVE, TimeUnit.SECONDS, sWorkQueue, sThreadFactory); + + private static final int MESSAGE_POST_RESULT = 0x1; + private static final int MESSAGE_POST_PROGRESS = 0x2; + private static final int MESSAGE_POST_CANCEL = 0x3; + + private static final InternalHandler sHandler = new InternalHandler(); + + private final WorkerRunnable mWorker; + private final FutureTask mFuture; + + private volatile Status mStatus = Status.PENDING; + + /** + * Indicates the current status of the task. Each status will be set only once + * during the lifetime of a task. + */ + public enum Status { + /** + * Indicates that the task has not been executed yet. + */ + PENDING, + /** + * Indicates that the task is running. + */ + RUNNING, + /** + * Indicates that {@link AsyncTask#onPostExecute} has finished. + */ + FINISHED, + } + + /** + * Creates a new asynchronous task. This constructor must be invoked on the UI thread. + */ + public AsyncTask() { + mWorker = new WorkerRunnable() { + public Result call() throws Exception { + Process.setThreadPriority(Process.THREAD_PRIORITY_BACKGROUND); + return doInBackground(mParams); + } + }; + + mFuture = new FutureTask(mWorker) { + @Override + protected void done() { + Message message; + Result result = null; + + try { + result = get(); + } catch (InterruptedException e) { + android.util.Log.w(LOG_TAG, e); + } catch (ExecutionException e) { + throw new RuntimeException("An error occured while executing doInBackground()", + e.getCause()); + } catch (CancellationException e) { + message = sHandler.obtainMessage(MESSAGE_POST_CANCEL, + new AsyncTaskResult(AsyncTask.this, (Result[]) null)); + message.sendToTarget(); + return; + } catch (Throwable t) { + throw new RuntimeException("An error occured while executing " + + "doInBackground()", t); + } + + message = sHandler.obtainMessage(MESSAGE_POST_RESULT, + new AsyncTaskResult(AsyncTask.this, result)); + message.sendToTarget(); + } + }; + } + + /** + * Returns the current status of this task. + * + * @return The current status. + */ + public final Status getStatus() { + return mStatus; + } + + /** + * Override this method to perform a computation on a background thread. The + * specified parameters are the parameters passed to {@link #execute} + * by the caller of this task. + * + * This method can call {@link #publishProgress} to publish updates + * on the UI thread. + * + * @param params The parameters of the task. + * + * @return A result, defined by the subclass of this task. + * + * @see #onPreExecute() + * @see #onPostExecute + * @see #publishProgress + */ + protected abstract Result doInBackground(Params... params); + + /** + * Runs on the UI thread before {@link #doInBackground}. + * + * @see #onPostExecute + * @see #doInBackground + */ + protected void onPreExecute() { + } + + /** + * Runs on the UI thread after {@link #doInBackground}. The + * specified result is the value returned by {@link #doInBackground} + * or null if the task was cancelled or an exception occured. + * + * @param result The result of the operation computed by {@link #doInBackground}. + * + * @see #onPreExecute + * @see #doInBackground + */ + @SuppressWarnings({"UnusedDeclaration"}) + protected void onPostExecute(Result result) { + } + + /** + * Runs on the UI thread after {@link #publishProgress} is invoked. + * The specified values are the values passed to {@link #publishProgress}. + * + * @param values The values indicating progress. + * + * @see #publishProgress + * @see #doInBackground + */ + @SuppressWarnings({"UnusedDeclaration"}) + protected void onProgressUpdate(Progress... values) { + } + + /** + * Runs on the UI thread after {@link #cancel(boolean)} is invoked. + * + * @see #cancel(boolean) + * @see #isCancelled() + */ + protected void onCancelled() { + } + + /** + * Returns true if this task was cancelled before it completed + * normally. + * + * @return true if task was cancelled before it completed + * + * @see #cancel(boolean) + */ + public final boolean isCancelled() { + return mFuture.isCancelled(); + } + + /** + * Attempts to cancel execution of this task. This attempt will + * fail if the task has already completed, already been cancelled, + * or could not be cancelled for some other reason. If successful, + * and this task has not started when cancel is called, + * this task should never run. If the task has already started, + * then the mayInterruptIfRunning parameter determines + * whether the thread executing this task should be interrupted in + * an attempt to stop the task. + * + * @param mayInterruptIfRunning true if the thread executing this + * task should be interrupted; otherwise, in-progress tasks are allowed + * to complete. + * + * @return false if the task could not be cancelled, + * typically because it has already completed normally; + * true otherwise + * + * @see #isCancelled() + * @see #onCancelled() + */ + public final boolean cancel(boolean mayInterruptIfRunning) { + return mFuture.cancel(mayInterruptIfRunning); + } + + /** + * Waits if necessary for the computation to complete, and then + * retrieves its result. + * + * @return The computed result. + * + * @throws CancellationException If the computation was cancelled. + * @throws ExecutionException If the computation threw an exception. + * @throws InterruptedException If the current thread was interrupted + * while waiting. + */ + public final Result get() throws InterruptedException, ExecutionException { + return mFuture.get(); + } + + /** + * Waits if necessary for at most the given time for the computation + * to complete, and then retrieves its result. + * + * @param timeout Time to wait before cancelling the operation. + * @param unit The time unit for the timeout. + * + * @return The computed result. + * + * @throws CancellationException If the computation was cancelled. + * @throws ExecutionException If the computation threw an exception. + * @throws InterruptedException If the current thread was interrupted + * while waiting. + * @throws TimeoutException If the wait timed out. + */ + public final Result get(long timeout, TimeUnit unit) throws InterruptedException, + ExecutionException, TimeoutException { + return mFuture.get(timeout, unit); + } + + /** + * Executes the task with the specified parameters. The task returns + * itself (this) so that the caller can keep a reference to it. + * + * This method must be invoked on the UI thread. + * + * @param params The parameters of the task. + * + * @return This instance of AsyncTask. + * + * @throws IllegalStateException If {@link #getStatus()} returns either + * {@link AsyncTask.Status#RUNNING} or {@link AsyncTask.Status#FINISHED}. + */ + public final AsyncTask execute(Params... params) { + if (mStatus != Status.PENDING) { + switch (mStatus) { + case RUNNING: + throw new IllegalStateException("Cannot execute task:" + + " the task is already running."); + case FINISHED: + throw new IllegalStateException("Cannot execute task:" + + " the task has already been executed " + + "(a task can be executed only once)"); + } + } + + mStatus = Status.RUNNING; + + onPreExecute(); + + mWorker.mParams = params; + sExecutor.execute(mFuture); + + return this; + } + + /** + * This method can be invoked from {@link #doInBackground} to + * publish updates on the UI thread while the background computation is + * still running. Each call to this method will trigger the execution of + * {@link #onProgressUpdate} on the UI thread. + * + * @param values The progress values to update the UI with. + * + * @see #onProgressUpdate + * @see #doInBackground + */ + protected final void publishProgress(Progress... values) { + sHandler.obtainMessage(MESSAGE_POST_PROGRESS, + new AsyncTaskResult(this, values)).sendToTarget(); + } + + private void finish(Result result) { + onPostExecute(result); + mStatus = Status.FINISHED; + } + + private static class InternalHandler extends Handler { + @SuppressWarnings({"unchecked", "RawUseOfParameterizedType"}) + @Override + public void handleMessage(Message msg) { + AsyncTaskResult result = (AsyncTaskResult) msg.obj; + switch (msg.what) { + case MESSAGE_POST_RESULT: + // There is only one result + result.mTask.finish(result.mData[0]); + break; + case MESSAGE_POST_PROGRESS: + result.mTask.onProgressUpdate(result.mData); + break; + case MESSAGE_POST_CANCEL: + result.mTask.onCancelled(); + break; + } + } + } + + private static abstract class WorkerRunnable implements Callable { + Params[] mParams; + } + + @SuppressWarnings({"RawUseOfParameterizedType"}) + private static class AsyncTaskResult { + final AsyncTask mTask; + final Data[] mData; + + AsyncTaskResult(AsyncTask task, Data... data) { + mTask = task; + mData = data; + } + } +} diff --git a/core/java/android/os/BatteryManager.java b/core/java/android/os/BatteryManager.java index bf4755553d292..8f1a756b295ce 100644 --- a/core/java/android/os/BatteryManager.java +++ b/core/java/android/os/BatteryManager.java @@ -37,8 +37,10 @@ public class BatteryManager { public static final int BATTERY_HEALTH_OVER_VOLTAGE = 5; public static final int BATTERY_HEALTH_UNSPECIFIED_FAILURE = 6; - // values of the "plugged" field in the ACTION_BATTERY_CHANGED intent + // values of the "plugged" field in the ACTION_BATTERY_CHANGED intent. + // These must be powers of 2. + /** Power source is an AC charger. */ public static final int BATTERY_PLUGGED_AC = 1; + /** Power source is a USB port. */ public static final int BATTERY_PLUGGED_USB = 2; - } diff --git a/core/java/android/os/BatteryStats.java b/core/java/android/os/BatteryStats.java new file mode 100644 index 0000000000000..e065063c21b00 --- /dev/null +++ b/core/java/android/os/BatteryStats.java @@ -0,0 +1,518 @@ +package android.os; + +import java.io.FileDescriptor; +import java.io.PrintWriter; +import java.util.Formatter; +import java.util.Map; + +import android.util.SparseArray; + +/** + * A class providing access to battery usage statistics, including information on + * wakelocks, processes, packages, and services. All times are represented in microseconds + * except where indicated otherwise. + */ +public abstract class BatteryStats { + + /** + * A constant indicating a partial wake lock. + */ + public static final int WAKE_TYPE_PARTIAL = 0; + + /** + * A constant indicating a full wake lock. + */ + public static final int WAKE_TYPE_FULL = 1; + + /** + * A constant indicating a window wake lock. + */ + public static final int WAKE_TYPE_WINDOW = 2; + + /** + * Include all of the data in the stats, including previously saved data. + */ + public static final int STATS_TOTAL = 0; + + /** + * Include only the last run in the stats. + */ + public static final int STATS_LAST = 1; + + /** + * Include only the current run in the stats. + */ + public static final int STATS_CURRENT = 2; + + /** + * Include only the run since the last time the device was unplugged in the stats. + */ + public static final int STATS_UNPLUGGED = 3; + + private final StringBuilder mFormatBuilder = new StringBuilder(8); + private final Formatter mFormatter = new Formatter(mFormatBuilder); + + /** + * State for keeping track of timing information. + */ + public static abstract class Timer { + + /** + * Returns the count associated with this Timer for the + * selected type of statistics. + * + * @param which one of STATS_TOTAL, STATS_LAST, or STATS_CURRENT + */ + public abstract int getCount(int which); + + /** + * Returns the total time in microseconds associated with this Timer for the + * selected type of statistics. + * + * @param now system uptime time in microseconds + * @param which one of STATS_TOTAL, STATS_LAST, or STATS_CURRENT + * @return a time in microseconds + */ + public abstract long getTotalTime(long now, int which); + } + + /** + * The statistics associated with a particular uid. + */ + public static abstract class Uid { + + /** + * Returns a mapping containing wakelock statistics. + * + * @return a Map from Strings to Uid.Wakelock objects. + */ + public abstract Map getWakelockStats(); + + /** + * The statistics associated with a particular wake lock. + */ + public static abstract class Wakelock { + public abstract Timer getWakeTime(int type); + } + + /** + * Returns a mapping containing sensor statistics. + * + * @return a Map from Integer sensor ids to Uid.Sensor objects. + */ + public abstract Map getSensorStats(); + + /** + * Returns a mapping containing process statistics. + * + * @return a Map from Strings to Uid.Proc objects. + */ + public abstract Map getProcessStats(); + + /** + * Returns a mapping containing package statistics. + * + * @return a Map from Strings to Uid.Pkg objects. + */ + public abstract Map getPackageStats(); + + public static abstract class Sensor { + public abstract Timer getSensorTime(); + } + + /** + * The statistics associated with a particular process. + */ + public static abstract class Proc { + + /** + * Returns the total time (in 1/100 sec) spent executing in user code. + * + * @param which one of STATS_TOTAL, STATS_LAST, or STATS_CURRENT. + */ + public abstract long getUserTime(int which); + + /** + * Returns the total time (in 1/100 sec) spent executing in system code. + * + * @param which one of STATS_TOTAL, STATS_LAST, or STATS_CURRENT. + */ + public abstract long getSystemTime(int which); + + /** + * Returns the number of times the process has been started. + * + * @param which one of STATS_TOTAL, STATS_LAST, or STATS_CURRENT. + */ + public abstract int getStarts(int which); + } + + /** + * The statistics associated with a particular package. + */ + public static abstract class Pkg { + + /** + * Returns the number of times this package has done something that could wake up the + * device from sleep. + * + * @param which one of STATS_TOTAL, STATS_LAST, or STATS_CURRENT. + */ + public abstract int getWakeups(int which); + + /** + * Returns a mapping containing service statistics. + */ + public abstract Map getServiceStats(); + + /** + * The statistics associated with a particular service. + */ + public abstract class Serv { + + /** + * Returns the amount of time spent started. + * + * @param now elapsed realtime in microseconds. + * @param which one of STATS_TOTAL, STATS_LAST, or STATS_CURRENT. + * @return + */ + public abstract long getStartTime(long now, int which); + + /** + * Returns the total number of times startService() has been called. + * + * @param which one of STATS_TOTAL, STATS_LAST, or STATS_CURRENT. + */ + public abstract int getStarts(int which); + + /** + * Returns the total number times the service has been launched. + * + * @param which one of STATS_TOTAL, STATS_LAST, or STATS_CURRENT. + */ + public abstract int getLaunches(int which); + } + } + } + + /** + * Returns the number of times the device has been started. + */ + public abstract int getStartCount(); + + /** + * Returns a SparseArray containing the statistics for each uid. + */ + public abstract SparseArray getUidStats(); + + /** + * Returns the current battery uptime in microseconds. + * + * @param curTime the amount of elapsed realtime in microseconds. + */ + public abstract long getBatteryUptime(long curTime); + + /** + * Returns the current battery realtime in microseconds. + * + * @param curTime the amount of elapsed realtime in microseconds. + */ + public abstract long getBatteryRealtime(long curTime); + + /** + * Returns the total, last, or current battery uptime in microseconds. + * + * @param curTime the elapsed realtime in microseconds. + * @param which one of STATS_TOTAL, STATS_LAST, or STATS_CURRENT. + */ + public abstract long computeBatteryUptime(long curTime, int which); + + /** + * Returns the total, last, or current battery realtime in microseconds. + * + * @param curTime the current elapsed realtime in microseconds. + * @param which one of STATS_TOTAL, STATS_LAST, or STATS_CURRENT. + */ + public abstract long computeBatteryRealtime(long curTime, int which); + + /** + * Returns the total, last, or current uptime in micropeconds. + * + * @param curTime the current elapsed realtime in microseconds. + * @param which one of STATS_TOTAL, STATS_LAST, or STATS_CURRENT. + */ + public abstract long computeUptime(long curTime, int which); + + /** + * Returns the total, last, or current realtime in microseconds. + * * + * @param curTime the current elapsed realtime in microseconds. + * @param which one of STATS_TOTAL, STATS_LAST, or STATS_CURRENT. + */ + public abstract long computeRealtime(long curTime, int which); + + private final static void formatTime(StringBuilder out, long seconds) { + long days = seconds / (60 * 60 * 24); + if (days != 0) { + out.append(days); + out.append("d "); + } + long used = days * 60 * 60 * 24; + + long hours = (seconds - used) / (60 * 60); + if (hours != 0 || used != 0) { + out.append(hours); + out.append("h "); + } + used += hours * 60 * 60; + + long mins = (seconds-used) / 60; + if (mins != 0 || used != 0) { + out.append(mins); + out.append("m "); + } + used += mins * 60; + + if (seconds != 0 || used != 0) { + out.append(seconds-used); + out.append("s "); + } + } + + private final static String formatTime(long time) { + long sec = time / 100; + StringBuilder sb = new StringBuilder(); + formatTime(sb, sec); + sb.append((time - (sec * 100)) * 10); + sb.append("ms "); + return sb.toString(); + } + + private final static String formatTimeMs(long time) { + long sec = time / 1000; + StringBuilder sb = new StringBuilder(); + formatTime(sb, sec); + sb.append(time - (sec * 1000)); + sb.append("ms "); + return sb.toString(); + } + + private final String formatRatioLocked(long num, long den) { + float perc = ((float)num) / ((float)den) * 100; + mFormatBuilder.setLength(0); + mFormatter.format("%.1f%%", perc); + return mFormatBuilder.toString(); + } + + /** + * + * @param sb a StringBuilder object. + * @param timer a Timer object contining the wakelock times. + * @param now the current time in microseconds. + * @param name the name of the wakelock. + * @param which which one of STATS_TOTAL, STATS_LAST, or STATS_CURRENT. + * @param linePrefix a String to be prepended to each line of output. + * @return the line prefix + */ + private final String printWakeLock(StringBuilder sb, Timer timer, long now, + String name, int which, String linePrefix) { + if (timer != null) { + // Convert from microseconds to milliseconds with rounding + long totalTimeMillis = (timer.getTotalTime(now, which) + 500) / 1000; + int count = timer.getCount(which); + if (totalTimeMillis != 0) { + sb.append(linePrefix); + sb.append(formatTimeMs(totalTimeMillis)); + sb.append(name); + sb.append(' '); + sb.append('('); + sb.append(count); + sb.append(" times)"); + return ", "; + } + } + return linePrefix; + } + + @SuppressWarnings("unused") + private final void dumpLocked(FileDescriptor fd, PrintWriter pw, String prefix, int which) { + long uSecTime = SystemClock.elapsedRealtime() * 1000; + final long uSecNow = getBatteryUptime(uSecTime); + + StringBuilder sb = new StringBuilder(128); + if (which == STATS_TOTAL) { + pw.println(prefix + "Current and Historic Battery Usage Statistics:"); + pw.println(prefix + " System starts: " + getStartCount()); + } else if (which == STATS_LAST) { + pw.println(prefix + "Last Battery Usage Statistics:"); + } else { + pw.println(prefix + "Current Battery Usage Statistics:"); + } + long batteryUptime = computeBatteryUptime(uSecNow, which); + long batteryRealtime = computeBatteryRealtime(getBatteryRealtime(uSecTime), which); + long elapsedRealtime = computeRealtime(uSecTime, which); + pw.println(prefix + + " On battery: " + formatTimeMs(batteryUptime) + "(" + + formatRatioLocked(batteryUptime, batteryRealtime) + + ") uptime, " + + formatTimeMs(batteryRealtime) + "(" + + formatRatioLocked(batteryRealtime, elapsedRealtime) + + ") realtime"); + pw.println(prefix + + " Total: " + + formatTimeMs(computeUptime(SystemClock.uptimeMillis() * 1000, which)) + + "uptime, " + + formatTimeMs(elapsedRealtime) + + "realtime"); + + pw.println(" "); + + SparseArray uidStats = getUidStats(); + final int NU = uidStats.size(); + for (int iu=0; iu wakelocks = u.getWakelockStats(); + if (wakelocks.size() > 0) { + for (Map.Entry ent + : wakelocks.entrySet()) { + Uid.Wakelock wl = ent.getValue(); + String linePrefix = ": "; + sb.setLength(0); + sb.append(prefix); + sb.append(" Wake lock "); + sb.append(ent.getKey()); + linePrefix = printWakeLock(sb, wl.getWakeTime(WAKE_TYPE_FULL), uSecNow, + "full", which, linePrefix); + linePrefix = printWakeLock(sb, wl.getWakeTime(WAKE_TYPE_PARTIAL), uSecNow, + "partial", which, linePrefix); + linePrefix = printWakeLock(sb, wl.getWakeTime(WAKE_TYPE_WINDOW), uSecNow, + "window", which, linePrefix); + if (linePrefix.equals(": ")) { + sb.append(": (nothing executed)"); + } + pw.println(sb.toString()); + uidActivity = true; + } + } + + Map sensors = u.getSensorStats(); + if (sensors.size() > 0) { + for (Map.Entry ent + : sensors.entrySet()) { + Uid.Sensor se = ent.getValue(); + int sensorNumber = ent.getKey(); + sb.setLength(0); + sb.append(prefix); + sb.append(" Sensor "); + sb.append(sensorNumber); + + Timer timer = se.getSensorTime(); + if (timer != null) { + // Convert from microseconds to milliseconds with rounding + long totalTime = (timer.getTotalTime(uSecNow, which) + 500) / 1000; + int count = timer.getCount(which); + if (totalTime != 0) { + sb.append(": "); + sb.append(formatTimeMs(totalTime)); + sb.append(' '); + sb.append('('); + sb.append(count); + sb.append(" times)"); + } + } else { + sb.append(": (none used)"); + } + + pw.println(sb.toString()); + uidActivity = true; + } + } + + Map processStats = u.getProcessStats(); + if (processStats.size() > 0) { + for (Map.Entry ent + : processStats.entrySet()) { + Uid.Proc ps = ent.getValue(); + long userTime; + long systemTime; + int starts; + + userTime = ps.getUserTime(which); + systemTime = ps.getSystemTime(which); + starts = ps.getStarts(which); + + if (userTime != 0 || systemTime != 0 || starts != 0) { + pw.println(prefix + " Proc " + ent.getKey() + ":"); + pw.println(prefix + " CPU: " + formatTime(userTime) + "user + " + + formatTime(systemTime) + "kernel"); + pw.println(prefix + " " + starts + " process starts"); + uidActivity = true; + } + } + } + + Map packageStats = u.getPackageStats(); + if (packageStats.size() > 0) { + for (Map.Entry ent + : packageStats.entrySet()) { + pw.println(prefix + " Apk " + ent.getKey() + ":"); + boolean apkActivity = false; + Uid.Pkg ps = ent.getValue(); + int wakeups = ps.getWakeups(which); + if (wakeups != 0) { + pw.println(prefix + " " + wakeups + " wakeup alarms"); + apkActivity = true; + } + Map serviceStats = ps.getServiceStats(); + if (serviceStats.size() > 0) { + for (Map.Entry sent + : serviceStats.entrySet()) { + BatteryStats.Uid.Pkg.Serv ss = sent.getValue(); + long startTime = ss.getStartTime(uSecNow, which); + int starts = ss.getStarts(which); + int launches = ss.getLaunches(which); + if (startTime != 0 || starts != 0 || launches != 0) { + pw.println(prefix + " Service " + sent.getKey() + ":"); + pw.println(prefix + " Time spent started: " + + formatTimeMs(startTime)); + pw.println(prefix + " Starts: " + starts + + ", launches: " + launches); + apkActivity = true; + } + } + } + if (!apkActivity) { + pw.println(prefix + " (nothing executed)"); + } + uidActivity = true; + } + } + if (!uidActivity) { + pw.println(prefix + " (nothing executed)"); + } + } + } + + /** + * Dumps a human-readable summary of the battery statistics to the given PrintWriter. + * + * @param fd a FileDescriptor, currently unused. + * @param pw a PrintWriter to receive the dump output. + * @param args an array of Strings, currently unused. + */ + @SuppressWarnings("unused") + public void dumpLocked(FileDescriptor fd, PrintWriter pw, String[] args) { + synchronized (this) { + dumpLocked(fd, pw, "", STATS_TOTAL); + pw.println(""); + dumpLocked(fd, pw, "", STATS_LAST); + pw.println(""); + dumpLocked(fd, pw, "", STATS_CURRENT); + } + } +} diff --git a/core/java/android/os/Debug.java b/core/java/android/os/Debug.java index b9b277309e34b..c3bb967635d57 100644 --- a/core/java/android/os/Debug.java +++ b/core/java/android/os/Debug.java @@ -117,6 +117,10 @@ public final class Debug * waitForDebugger() call if you want to start tracing immediately. */ public static void waitForDebugger() { + if (!VMDebug.isDebuggingEnabled()) { + //System.out.println("debugging not enabled, not waiting"); + return; + } if (isDebuggerConnected()) return; diff --git a/core/java/android/os/Handler.java b/core/java/android/os/Handler.java index b6f38d961786c..2a32e543f19f8 100644 --- a/core/java/android/os/Handler.java +++ b/core/java/android/os/Handler.java @@ -54,7 +54,7 @@ import java.lang.reflect.Modifier; *

    When a * process is created for your application, its main thread is dedicated to * running a message queue that takes care of managing the top-level - * application objects (activities, intent receivers, etc) and any windows + * application objects (activities, broadcast receivers, etc) and any windows * they create. You can create your own threads, and communicate back with * the main application thread through a Handler. This is done by calling * the same post or sendMessage methods as before, but from @@ -70,21 +70,32 @@ public class Handler { private static final boolean FIND_POTENTIAL_LEAKS = false; private static final String TAG = "Handler"; + /** + * Callback interface you can use when instantiating a Handler to avoid + * having to implement your own subclass of Handler. + */ + public interface Callback { + public boolean handleMessage(Message msg); + } + /** * Subclasses must implement this to receive messages. */ - public void handleMessage(Message msg) - { + public void handleMessage(Message msg) { } /** * Handle system messages here. */ - public void dispatchMessage(Message msg) - { + public void dispatchMessage(Message msg) { if (msg.callback != null) { handleCallback(msg); } else { + if (mCallback != null) { + if (mCallback.handleMessage(msg)) { + return; + } + } handleMessage(msg); } } @@ -95,8 +106,31 @@ public class Handler { * * If there isn't one, this handler won't be able to receive messages. */ - public Handler() - { + public Handler() { + if (FIND_POTENTIAL_LEAKS) { + final Class klass = getClass(); + if ((klass.isAnonymousClass() || klass.isMemberClass() || klass.isLocalClass()) && + (klass.getModifiers() & Modifier.STATIC) == 0) { + Log.w(TAG, "The following Handler class should be static or leaks might occur: " + + klass.getCanonicalName()); + } + } + + mLooper = Looper.myLooper(); + if (mLooper == null) { + throw new RuntimeException( + "Can't create handler inside thread that has not called Looper.prepare()"); + } + mQueue = mLooper.mQueue; + mCallback = null; + } + + /** + * Constructor associates this handler with the queue for the + * current thread and takes a callback interface in which you can handle + * messages. + */ + public Handler(Callback callback) { if (FIND_POTENTIAL_LEAKS) { final Class klass = getClass(); if ((klass.isAnonymousClass() || klass.isMemberClass() || klass.isLocalClass()) && @@ -112,15 +146,26 @@ public class Handler { "Can't create handler inside thread that has not called Looper.prepare()"); } mQueue = mLooper.mQueue; + mCallback = callback; } /** * Use the provided queue instead of the default one. */ - public Handler(Looper looper) - { + public Handler(Looper looper) { + mLooper = looper; + mQueue = looper.mQueue; + mCallback = null; + } + + /** + * Use the provided queue instead of the default one and take a callback + * interface in which to handle messages. + */ + public Handler(Looper looper, Callback callback) { mLooper = looper; mQueue = looper.mQueue; + mCallback = callback; } /** @@ -544,5 +589,6 @@ public class Handler { final MessageQueue mQueue; final Looper mLooper; + final Callback mCallback; IMessenger mMessenger; } diff --git a/core/java/android/os/ICheckinService.aidl b/core/java/android/os/ICheckinService.aidl index aa43852cdf4ca..70ad28e4e4698 100644 --- a/core/java/android/os/ICheckinService.aidl +++ b/core/java/android/os/ICheckinService.aidl @@ -39,5 +39,6 @@ interface ICheckinService { * Determine if the device is under parental control. Return null if * we are unable to check the parental control status. */ - void getParentalControlState(IParentalControlCallback p); + void getParentalControlState(IParentalControlCallback p, + String requestingApp); } diff --git a/core/java/android/os/IPowerManager.aidl b/core/java/android/os/IPowerManager.aidl index 9d059172283dc..abc1e2f3105fa 100644 --- a/core/java/android/os/IPowerManager.aidl +++ b/core/java/android/os/IPowerManager.aidl @@ -26,6 +26,6 @@ interface IPowerManager void userActivity(long when, boolean noChangeLights); void userActivityWithForce(long when, boolean noChangeLights, boolean force); void setPokeLock(int pokey, IBinder lock, String tag); - void setStayOnSetting(boolean val); + void setStayOnSetting(int val); long getScreenOnTime(); } diff --git a/core/java/android/os/Looper.java b/core/java/android/os/Looper.java index 80b68e252a604..95818938d5eab 100644 --- a/core/java/android/os/Looper.java +++ b/core/java/android/os/Looper.java @@ -130,7 +130,8 @@ public class Looper { } /** - * Return the Looper object associated with the current thread. + * Return the Looper object associated with the current thread. Returns + * null if the calling thread is not associated with a Looper. */ public static final Looper myLooper() { return (Looper)sThreadLocal.get(); @@ -151,7 +152,8 @@ public class Looper { /** * Return the {@link MessageQueue} object associated with the current - * thread. + * thread. This must be called from a thread running a Looper, or a + * NullPointerException will be thrown. */ public static final MessageQueue myQueue() { return myLooper().mQueue; @@ -171,6 +173,16 @@ public class Looper { mQueue.enqueueMessage(msg, 0); } + /** + * Return the Thread associated with this Looper. + * + * @since CURRENT + * {@hide pending API Council approval} + */ + public Thread getThread() { + return mThread; + } + public void dump(Printer pw, String prefix) { pw.println(prefix + this); pw.println(prefix + "mRun=" + mRun); diff --git a/core/java/android/os/Process.java b/core/java/android/os/Process.java index 2be776842cb99..cd86fbe70dac1 100644 --- a/core/java/android/os/Process.java +++ b/core/java/android/os/Process.java @@ -19,6 +19,7 @@ package android.os; import android.net.LocalSocketAddress; import android.net.LocalSocket; import android.util.Log; +import dalvik.system.Zygote; import java.io.BufferedWriter; import java.io.DataInputStream; @@ -221,13 +222,13 @@ public class Process { public static final int start(final String processClass, final String niceName, int uid, int gid, int[] gids, - boolean enableDebugger, + int debugFlags, String[] zygoteArgs) { if (supportsProcesses()) { try { return startViaZygote(processClass, niceName, uid, gid, gids, - enableDebugger, zygoteArgs); + debugFlags, zygoteArgs); } catch (ZygoteStartFailedEx ex) { Log.e(LOG_TAG, "Starting VM process through Zygote failed"); @@ -259,9 +260,9 @@ public class Process { * {@hide} */ public static final int start(String processClass, int uid, int gid, - int[] gids, boolean enableDebugger, String[] zygoteArgs) { + int[] gids, int debugFlags, String[] zygoteArgs) { return start(processClass, "", uid, gid, gids, - enableDebugger, zygoteArgs); + debugFlags, zygoteArgs); } private static void invokeStaticMain(String className) { @@ -452,7 +453,7 @@ public class Process { final String niceName, final int uid, final int gid, final int[] gids, - boolean enableDebugger, + int debugFlags, String[] extraArgs) throws ZygoteStartFailedEx { int pid; @@ -465,9 +466,15 @@ public class Process { argsForZygote.add("--runtime-init"); argsForZygote.add("--setuid=" + uid); argsForZygote.add("--setgid=" + gid); - if (enableDebugger) { + if ((debugFlags & Zygote.DEBUG_ENABLE_DEBUGGER) != 0) { argsForZygote.add("--enable-debugger"); } + if ((debugFlags & Zygote.DEBUG_ENABLE_CHECKJNI) != 0) { + argsForZygote.add("--enable-checkjni"); + } + if ((debugFlags & Zygote.DEBUG_ENABLE_ASSERT) != 0) { + argsForZygote.add("--enable-assert"); + } //TODO optionally enable debuger //argsForZygote.add("--enable-debugger"); @@ -529,7 +536,12 @@ public class Process { public static final native int myTid(); /** - * Returns the UID assigned to a partlicular user name, or -1 if there is + * Returns the identifier of this process's user. + */ + public static final native int myUid(); + + /** + * Returns the UID assigned to a particular user name, or -1 if there is * none. If the given string consists of only numbers, it is converted * directly to a uid. */ diff --git a/core/java/android/pim/EventRecurrence.java b/core/java/android/pim/EventRecurrence.java index ad671f6856488..edf69eea8a86d 100644 --- a/core/java/android/pim/EventRecurrence.java +++ b/core/java/android/pim/EventRecurrence.java @@ -18,6 +18,7 @@ package android.pim; import android.content.res.Resources; import android.text.TextUtils; +import android.text.format.Time; import java.util.Calendar; diff --git a/core/java/android/pim/RecurrenceSet.java b/core/java/android/pim/RecurrenceSet.java index c02ff52e84f5b..c6615da03eef8 100644 --- a/core/java/android/pim/RecurrenceSet.java +++ b/core/java/android/pim/RecurrenceSet.java @@ -21,6 +21,7 @@ import android.database.Cursor; import android.os.Bundle; import android.provider.Calendar; import android.text.TextUtils; +import android.text.format.Time; import android.util.Config; import android.util.Log; @@ -145,7 +146,7 @@ public class RecurrenceSet { long[] dates = new long[n]; for (int i = 0; i * This preference will store a boolean into the SharedPreferences. diff --git a/core/java/android/preference/DialogPreference.java b/core/java/android/preference/DialogPreference.java index 3eb65e2c033dc..666efaeaffd37 100644 --- a/core/java/android/preference/DialogPreference.java +++ b/core/java/android/preference/DialogPreference.java @@ -34,7 +34,7 @@ import android.view.View; import android.widget.TextView; /** - * The {@link DialogPreference} class is a base class for preferences that are + * A base class for {@link Preference} objects that are * dialog-based. These preferences will, when clicked, open a dialog showing the * actual preference controls. * @@ -356,7 +356,7 @@ public abstract class DialogPreference extends Preference implements getPreferenceManager().unregisterOnActivityDestroyListener(this); mDialog = null; - onDialogClosed(mWhichButtonClicked == DialogInterface.BUTTON1); + onDialogClosed(mWhichButtonClicked == DialogInterface.BUTTON_POSITIVE); } /** @@ -369,6 +369,15 @@ public abstract class DialogPreference extends Preference implements protected void onDialogClosed(boolean positiveResult) { } + /** + * Gets the dialog that is shown by this preference. + * + * @return The dialog, or null if a dialog is not being shown. + */ + public Dialog getDialog() { + return mDialog; + } + /** * {@inheritDoc} */ diff --git a/core/java/android/preference/EditTextPreference.java b/core/java/android/preference/EditTextPreference.java index be56003c94bce..a12704f4820a3 100644 --- a/core/java/android/preference/EditTextPreference.java +++ b/core/java/android/preference/EditTextPreference.java @@ -31,7 +31,7 @@ import android.widget.EditText; import android.widget.LinearLayout; /** - * The {@link EditTextPreference} class is a preference that allows for string + * A {@link Preference} that allows for string * input. *

    * It is a subclass of {@link DialogPreference} and shows the {@link EditText} diff --git a/core/java/android/preference/ListPreference.java b/core/java/android/preference/ListPreference.java index 6c98dedf91bb6..f842d754cbb6e 100644 --- a/core/java/android/preference/ListPreference.java +++ b/core/java/android/preference/ListPreference.java @@ -26,7 +26,7 @@ import android.os.Parcelable; import android.util.AttributeSet; /** - * The {@link ListPreference} is a preference that displays a list of entries as + * A {@link Preference} that displays a list of entries as * a dialog. *

    * This preference will store a string into the SharedPreferences. This string will be the value @@ -192,8 +192,22 @@ public class ListPreference extends DialogPreference { new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { mClickedDialogEntryIndex = which; + + /* + * Clicking on an item simulates the positive button + * click, and dismisses the dialog. + */ + ListPreference.this.onClick(dialog, DialogInterface.BUTTON_POSITIVE); + dialog.dismiss(); } }); + + /* + * The typical interaction for list-based dialogs is to have + * click-on-an-item dismiss the dialog instead of the user having to + * press 'Ok'. + */ + builder.setPositiveButton(null, null); } @Override diff --git a/core/java/android/preference/Preference.java b/core/java/android/preference/Preference.java index 1db7525da0e44..3820f28563262 100644 --- a/core/java/android/preference/Preference.java +++ b/core/java/android/preference/Preference.java @@ -37,13 +37,13 @@ import android.widget.ListView; import android.widget.TextView; /** - * The {@link Preference} class represents the basic preference UI building - * block that is displayed by a {@link PreferenceActivity} in the form of a + * Represents the basic Preference UI building + * block displayed by a {@link PreferenceActivity} in the form of a * {@link ListView}. This class provides the {@link View} to be displayed in * the activity and associates with a {@link SharedPreferences} to * store/retrieve the preference data. *

    - * When specifying a preference hierarchy in XML, each tag name can point to a + * When specifying a preference hierarchy in XML, each element can point to a * subclass of {@link Preference}, similar to the view hierarchy and layouts. *

    * This class contains a {@code key} that will be used as the key into the @@ -109,46 +109,46 @@ public class Preference implements Comparable, OnDependencyChangeLis private boolean mBaseMethodCalled; /** - * Interface definition for a callback to be invoked when this - * {@link Preference Preference's} value has been changed by the user and is + * Interface definition for a callback to be invoked when the value of this + * {@link Preference} has been changed by the user and is * about to be set and/or persisted. This gives the client a chance * to prevent setting and/or persisting the value. */ public interface OnPreferenceChangeListener { /** - * Called when this preference has been changed by the user. This is - * called before the preference's state is about to be updated and + * Called when a Preference has been changed by the user. This is + * called before the state of the Preference is about to be updated and * before the state is persisted. * - * @param preference This preference. - * @param newValue The new value of the preference. - * @return Whether or not to update this preference's state with the new value. + * @param preference The changed Preference. + * @param newValue The new value of the Preference. + * @return True to update the state of the Preference with the new value. */ boolean onPreferenceChange(Preference preference, Object newValue); } /** - * Interface definition for a callback to be invoked when a preference is + * Interface definition for a callback to be invoked when a {@link Preference} is * clicked. */ public interface OnPreferenceClickListener { /** - * Called when a preference has been clicked. + * Called when a Preference has been clicked. * - * @param preference The preference that was clicked. - * @return Whether the click was handled. + * @param preference The Preference that was clicked. + * @return True if the click was handled. */ boolean onPreferenceClick(Preference preference); } /** * Interface definition for a callback to be invoked when this - * {@link Preference} is changed or if this is a group, there is an + * {@link Preference} is changed or, if this is a group, there is an * addition/removal of {@link Preference}(s). This is used internally. */ interface OnPreferenceChangeInternalListener { /** - * Called when this preference has changed. + * Called when this Preference has changed. * * @param preference This preference. */ @@ -157,18 +157,18 @@ public class Preference implements Comparable, OnDependencyChangeLis /** * Called when this group has added/removed {@link Preference}(s). * - * @param preference This preference. + * @param preference This Preference. */ void onPreferenceHierarchyChange(Preference preference); } /** * Perform inflation from XML and apply a class-specific base style. This - * constructor of {@link Preference} allows subclasses to use their own base - * style when they are inflating. For example, a {@link CheckBoxPreference}'s - * constructor would call this version of the super class constructor and - * supply {@code android.R.attr.checkBoxPreferenceStyle} for defStyle; - * this allows the theme's checkbox preference style to modify all of the base + * constructor of Preference allows subclasses to use their own base + * style when they are inflating. For example, a {@link CheckBoxPreference} + * constructor calls this version of the super class constructor and + * supplies {@code android.R.attr.checkBoxPreferenceStyle} for defStyle. + * This allows the theme's checkbox preference style to modify all of the base * preference attributes as well as the {@link CheckBoxPreference} class's * attributes. * @@ -254,8 +254,8 @@ public class Preference implements Comparable, OnDependencyChangeLis } /** - * Constructor that is called when inflating a preference from XML. This is - * called when a preference is being constructed from an XML file, supplying + * Constructor that is called when inflating a Preference from XML. This is + * called when a Preference is being constructed from an XML file, supplying * attributes that were specified in the XML file. This version uses a * default style of 0, so the only attribute values applied are those in the * Context's Theme and the given AttributeSet. @@ -274,15 +274,15 @@ public class Preference implements Comparable, OnDependencyChangeLis /** * Constructor to create a Preference. * - * @param context The context to store preference values. + * @param context The Context in which to store Preference values. */ public Preference(Context context) { this(context, null); } /** - * Called when {@link Preference} is being inflated and the default value - * attribute needs to be read. Since different preference types have + * Called when a Preference is being inflated and the default value + * attribute needs to be read. Since different Preference types have * different value types, the subclass should get and return the default * value which will be its value type. *

    @@ -299,16 +299,16 @@ public class Preference implements Comparable, OnDependencyChangeLis /** * Sets an {@link Intent} to be used for - * {@link Context#startActivity(Intent)} when the preference is clicked. + * {@link Context#startActivity(Intent)} when this Preference is clicked. * - * @param intent The intent associated with the preference. + * @param intent The intent associated with this Preference. */ public void setIntent(Intent intent) { mIntent = intent; } /** - * Return the {@link Intent} associated with this preference. + * Return the {@link Intent} associated with this Preference. * * @return The {@link Intent} last set via {@link #setIntent(Intent)} or XML. */ @@ -318,12 +318,12 @@ public class Preference implements Comparable, OnDependencyChangeLis /** * Sets the layout resource that is inflated as the {@link View} to be shown - * for this preference. In most cases, the default layout is sufficient for - * custom preferences and only the widget layout needs to be changed. + * for this Preference. In most cases, the default layout is sufficient for + * custom Preference objects and only the widget layout needs to be changed. *

    * This layout should contain a {@link ViewGroup} with ID * {@link android.R.id#widget_frame} to be the parent of the specific widget - * for this preference. It should similarly contain + * for this Preference. It should similarly contain * {@link android.R.id#title} and {@link android.R.id#summary}. * * @param layoutResId The layout resource ID to be inflated and returned as @@ -340,7 +340,7 @@ public class Preference implements Comparable, OnDependencyChangeLis } /** - * Gets the layout resource that will be shown as the {@link View} for this preference. + * Gets the layout resource that will be shown as the {@link View} for this Preference. * * @return The layout resource ID. */ @@ -349,8 +349,8 @@ public class Preference implements Comparable, OnDependencyChangeLis } /** - * Sets The layout for the controllable widget portion of a preference. This - * is inflated into the main layout. For example, a checkbox preference + * Sets The layout for the controllable widget portion of this Preference. This + * is inflated into the main layout. For example, a {@link CheckBoxPreference} * would specify a custom layout (consisting of just the CheckBox) here, * instead of creating its own main layout. * @@ -363,7 +363,7 @@ public class Preference implements Comparable, OnDependencyChangeLis } /** - * Gets the layout resource for the controllable widget portion of a preference. + * Gets the layout resource for the controllable widget portion of this Preference. * * @return The layout resource ID. */ @@ -374,11 +374,11 @@ public class Preference implements Comparable, OnDependencyChangeLis /** * Gets the View that will be shown in the {@link PreferenceActivity}. * - * @param convertView The old view to reuse, if possible. Note: You should - * check that this view is non-null and of an appropriate type - * before using. If it is not possible to convert this view to - * display the correct data, this method can create a new view. - * @param parent The parent that this view will eventually be attached to. + * @param convertView The old View to reuse, if possible. Note: You should + * check that this View is non-null and of an appropriate type + * before using. If it is not possible to convert this View to + * display the correct data, this method can create a new View. + * @param parent The parent that this View will eventually be attached to. * @return Returns the same Preference object, for chaining multiple calls * into a single statement. * @see #onCreateView(ViewGroup) @@ -393,16 +393,16 @@ public class Preference implements Comparable, OnDependencyChangeLis } /** - * Creates the View to be shown for this preference in the + * Creates the View to be shown for this Preference in the * {@link PreferenceActivity}. The default behavior is to inflate the main - * layout of this preference (see {@link #setLayoutResource(int)}. If + * layout of this Preference (see {@link #setLayoutResource(int)}. If * changing this behavior, please specify a {@link ViewGroup} with ID * {@link android.R.id#widget_frame}. *

    * Make sure to call through to the superclass's implementation. * - * @param parent The parent that this view will eventually be attached to. - * @return The View that displays this preference. + * @param parent The parent that this View will eventually be attached to. + * @return The View that displays this Preference. * @see #onBindView(View) */ protected View onCreateView(ViewGroup parent) { @@ -420,14 +420,14 @@ public class Preference implements Comparable, OnDependencyChangeLis } /** - * Binds the created View to the data for the preference. + * Binds the created View to the data for this Preference. *

    * This is a good place to grab references to custom Views in the layout and * set properties on them. *

    * Make sure to call through to the superclass's implementation. * - * @param view The View that shows this preference. + * @param view The View that shows this Preference. * @see #onCreateView(ViewGroup) */ protected void onBindView(View view) { @@ -453,7 +453,7 @@ public class Preference implements Comparable, OnDependencyChangeLis } if (mShouldDisableView) { - setEnabledStateOnViews(view, mEnabled); + setEnabledStateOnViews(view, isEnabled()); } } @@ -472,13 +472,13 @@ public class Preference implements Comparable, OnDependencyChangeLis } /** - * Sets the order of this {@link Preference} with respect to other - * {@link Preference} on the same level. If this is not specified, the + * Sets the order of this Preference with respect to other + * Preference objects on the same level. If this is not specified, the * default behavior is to sort alphabetically. The * {@link PreferenceGroup#setOrderingAsAdded(boolean)} can be used to order - * preferences based on the order they appear in the XML. + * Preference objects based on the order they appear in the XML. * - * @param order The order for this preference. A lower value will be shown + * @param order The order for this Preference. A lower value will be shown * first. Use {@link #DEFAULT_ORDER} to sort alphabetically or * allow ordering from XML. * @see PreferenceGroup#setOrderingAsAdded(boolean) @@ -494,9 +494,10 @@ public class Preference implements Comparable, OnDependencyChangeLis } /** - * Gets the order of this {@link Preference}. + * Gets the order of this Preference with respect to other Preference objects + * on the same level. * - * @return The order of this {@link Preference}. + * @return The order of this Preference. * @see #setOrder(int) */ public int getOrder() { @@ -504,11 +505,12 @@ public class Preference implements Comparable, OnDependencyChangeLis } /** - * Sets the title for the preference. This title will be placed into the ID + * Sets the title for this Preference with a CharSequence. + * This title will be placed into the ID * {@link android.R.id#title} within the View created by * {@link #onCreateView(ViewGroup)}. * - * @param title The title of the preference. + * @param title The title for this Preference. */ public void setTitle(CharSequence title) { if (title == null && mTitle != null || title != null && !title.equals(mTitle)) { @@ -518,6 +520,8 @@ public class Preference implements Comparable, OnDependencyChangeLis } /** + * Sets the title for this Preference with a resource ID. + * * @see #setTitle(CharSequence) * @param titleResId The title as a resource ID. */ @@ -526,7 +530,7 @@ public class Preference implements Comparable, OnDependencyChangeLis } /** - * Returns the title of the preference. + * Returns the title of this Preference. * * @return The title. * @see #setTitle(CharSequence) @@ -536,7 +540,7 @@ public class Preference implements Comparable, OnDependencyChangeLis } /** - * Returns the summary of the preference. + * Returns the summary of this Preference. * * @return The summary. * @see #setSummary(CharSequence) @@ -546,11 +550,9 @@ public class Preference implements Comparable, OnDependencyChangeLis } /** - * Sets the summary for the preference. This summary will be placed into the - * ID {@link android.R.id#summary} within the View created by - * {@link #onCreateView(ViewGroup)}. + * Sets the summary for this Preference with a CharSequence. * - * @param summary The summary of the preference. + * @param summary The summary for the preference. */ public void setSummary(CharSequence summary) { if (summary == null && mSummary != null || summary != null && !summary.equals(mSummary)) { @@ -560,6 +562,8 @@ public class Preference implements Comparable, OnDependencyChangeLis } /** + * Sets the summary for this Preference with a resource ID. + * * @see #setSummary(CharSequence) * @param summaryResId The summary as a resource. */ @@ -568,10 +572,10 @@ public class Preference implements Comparable, OnDependencyChangeLis } /** - * Sets whether this preference is enabled. If disabled, the preference will + * Sets whether this Preference is enabled. If disabled, it will * not handle clicks. * - * @param enabled Whether the preference is enabled. + * @param enabled Set true to enable it. */ public void setEnabled(boolean enabled) { if (mEnabled != enabled) { @@ -585,18 +589,18 @@ public class Preference implements Comparable, OnDependencyChangeLis } /** - * Whether this {@link Preference} should be enabled in the list. + * Checks whether this Preference should be enabled in the list. * - * @return Whether this preference is enabled. + * @return True if this Preference is enabled, false otherwise. */ public boolean isEnabled() { return mEnabled; } /** - * Sets whether this preference is selectable. + * Sets whether this Preference is selectable. * - * @param selectable Whether the preference is selectable. + * @param selectable Set true to make it selectable. */ public void setSelectable(boolean selectable) { if (mSelectable != selectable) { @@ -606,23 +610,23 @@ public class Preference implements Comparable, OnDependencyChangeLis } /** - * Whether this {@link Preference} should be selectable in the list. + * Checks whether this Preference should be selectable in the list. * - * @return Whether this preference is selectable. + * @return True if it is selectable, false otherwise. */ public boolean isSelectable() { return mSelectable; } /** - * Sets whether this {@link Preference} should disable its view when it gets + * Sets whether this Preference should disable its view when it gets * disabled. *

    * For example, set this and {@link #setEnabled(boolean)} to false for * preferences that are only displaying information and 1) should not be * clickable 2) should not have the view set to the disabled state. * - * @param shouldDisableView Whether this preference should disable its view + * @param shouldDisableView Set true if this preference should disable its view * when the preference is disabled. */ public void setShouldDisableView(boolean shouldDisableView) { @@ -631,18 +635,19 @@ public class Preference implements Comparable, OnDependencyChangeLis } /** + * Checks whether this Preference should disable its view when it's action is disabled. * @see #setShouldDisableView(boolean) - * @return Whether this preference should disable its view when it is disabled. + * @return True if it should disable the view. */ public boolean getShouldDisableView() { return mShouldDisableView; } /** - * Returns a unique ID for this preference. This ID should be unique across all - * preferences in a hierarchy. + * Returns a unique ID for this Preference. This ID should be unique across all + * Preference objects in a hierarchy. * - * @return A unique ID for this preference. + * @return A unique ID for this Preference. */ long getId() { return mId; @@ -658,7 +663,7 @@ public class Preference implements Comparable, OnDependencyChangeLis } /** - * Sets the key for the preference which is used as a key to the + * Sets the key for this Preference, which is used as a key to the * {@link SharedPreferences}. This should be unique for the package. * * @param key The key for the preference. @@ -673,7 +678,7 @@ public class Preference implements Comparable, OnDependencyChangeLis } /** - * Gets the key for the preference, which is also the key used for storing + * Gets the key for this Preference, which is also the key used for storing * values into SharedPreferences. * * @return The key. @@ -686,6 +691,8 @@ public class Preference implements Comparable, OnDependencyChangeLis * Checks whether the key is present, and if it isn't throws an * exception. This should be called by subclasses that store preferences in * the {@link SharedPreferences}. + * + * @throws IllegalStateException If there is no key assigned. */ void requireKey() { if (mKey == null) { @@ -696,43 +703,43 @@ public class Preference implements Comparable, OnDependencyChangeLis } /** - * Returns whether this {@link Preference} has a valid key. + * Checks whether this Preference has a valid key. * - * @return Whether the key exists and is not a blank string. + * @return True if the key exists and is not a blank string, false otherwise. */ public boolean hasKey() { return !TextUtils.isEmpty(mKey); } /** - * Returns whether this {@link Preference} is persistent. If it is persistent, it stores its value(s) into + * Checks whether this Preference is persistent. If it is, it stores its value(s) into * the persistent {@link SharedPreferences} storage. * - * @return Whether this is persistent. + * @return True if it is persistent. */ public boolean isPersistent() { return mPersistent; } /** - * Convenience method of whether at the given time this method is called, - * the {@link Preference} should store/restore its value(s) into the - * {@link SharedPreferences}. This, at minimum, checks whether the - * {@link Preference} is persistent and it currently has a key. Before you + * Checks whether, at the given time this method is called, + * this Preference should store/restore its value(s) into the + * {@link SharedPreferences}. This, at minimum, checks whether this + * Preference is persistent and it currently has a key. Before you * save/restore from the {@link SharedPreferences}, check this first. * - * @return Whether to persist the value. + * @return True if it should persist the value. */ protected boolean shouldPersist() { return mPreferenceManager != null && isPersistent() && hasKey(); } /** - * Sets whether this {@link Preference} is persistent. If it is persistent, + * Sets whether this Preference is persistent. When persistent, * it stores its value(s) into the persistent {@link SharedPreferences} * storage. * - * @param persistent Whether it should store its value(s) into the {@link SharedPreferences}. + * @param persistent Set true if it should store its value(s) into the {@link SharedPreferences}. */ public void setPersistent(boolean persistent) { mPersistent = persistent; @@ -742,8 +749,8 @@ public class Preference implements Comparable, OnDependencyChangeLis * Call this method after the user changes the preference, but before the * internal state is set. This allows the client to ignore the user value. * - * @param newValue The new value of the preference. - * @return Whether or not the user value should be set as the preference + * @param newValue The new value of this Preference. + * @return True if the user value should be set as the preference * value (and persisted). */ protected boolean callChangeListener(Object newValue) { @@ -751,7 +758,7 @@ public class Preference implements Comparable, OnDependencyChangeLis } /** - * Sets the callback to be invoked when this preference is changed by the + * Sets the callback to be invoked when this Preference is changed by the * user (but before the internal state has been updated). * * @param onPreferenceChangeListener The callback to be invoked. @@ -761,7 +768,7 @@ public class Preference implements Comparable, OnDependencyChangeLis } /** - * Gets the callback to be invoked when this preference is changed by the + * Returns the callback to be invoked when this Preference is changed by the * user (but before the internal state has been updated). * * @return The callback to be invoked. @@ -771,7 +778,7 @@ public class Preference implements Comparable, OnDependencyChangeLis } /** - * Sets the callback to be invoked when this preference is clicked. + * Sets the callback to be invoked when this Preference is clicked. * * @param onPreferenceClickListener The callback to be invoked. */ @@ -780,7 +787,7 @@ public class Preference implements Comparable, OnDependencyChangeLis } /** - * Gets the callback to be invoked when this preference is clicked. + * Returns the callback to be invoked when this Preference is clicked. * * @return The callback to be invoked. */ @@ -791,9 +798,9 @@ public class Preference implements Comparable, OnDependencyChangeLis /** * Called when a click should be performed. * - * @param preferenceScreen Optional {@link PreferenceScreen} whose hierarchy click + * @param preferenceScreen A {@link PreferenceScreen} whose hierarchy click * listener should be called in the proper order (between other - * processing). + * processing). May be null. */ void performClick(PreferenceScreen preferenceScreen) { @@ -824,18 +831,19 @@ public class Preference implements Comparable, OnDependencyChangeLis } /** - * Returns the context of this preference. Each preference in a preference hierarchy can be - * from different context (for example, if multiple activities provide preferences into a single - * {@link PreferenceActivity}). This context will be used to save the preference valus. + * Returns the {@link android.content.Context} of this Preference. + * Each Preference in a Preference hierarchy can be + * from different Context (for example, if multiple activities provide preferences into a single + * {@link PreferenceActivity}). This Context will be used to save the Preference values. * - * @return The context of this preference. + * @return The Context of this Preference. */ public Context getContext() { return mContext; } /** - * Returns the {@link SharedPreferences} where this preference can read its + * Returns the {@link SharedPreferences} where this Preference can read its * value(s). Usually, it's easier to use one of the helper read methods: * {@link #getPersistedBoolean(boolean)}, {@link #getPersistedFloat(float)}, * {@link #getPersistedInt(int)}, {@link #getPersistedLong(long)}, @@ -847,8 +855,8 @@ public class Preference implements Comparable, OnDependencyChangeLis * {@link SharedPreferences}, this is intended behavior to improve * performance. * - * @return The {@link SharedPreferences} where this preference reads its - * value(s), or null if it isn't attached to a preference hierarchy. + * @return The {@link SharedPreferences} where this Preference reads its + * value(s), or null if it isn't attached to a Preference hierarchy. * @see #getEditor() */ public SharedPreferences getSharedPreferences() { @@ -860,7 +868,7 @@ public class Preference implements Comparable, OnDependencyChangeLis } /** - * Returns an {@link SharedPreferences.Editor} where this preference can + * Returns an {@link SharedPreferences.Editor} where this Preference can * save its value(s). Usually it's easier to use one of the helper save * methods: {@link #persistBoolean(boolean)}, {@link #persistFloat(float)}, * {@link #persistInt(int)}, {@link #persistLong(long)}, @@ -869,11 +877,11 @@ public class Preference implements Comparable, OnDependencyChangeLis * true, it is this Preference's responsibility to commit. *

    * In some cases, writes to this will not be committed right away and hence - * not show up in the shared preferences, this is intended behavior to + * not show up in the SharedPreferences, this is intended behavior to * improve performance. * * @return A {@link SharedPreferences.Editor} where this preference saves - * its value(s), or null if it isn't attached to a preference + * its value(s), or null if it isn't attached to a Preference * hierarchy. * @see #shouldCommit() * @see #getSharedPreferences() @@ -903,9 +911,11 @@ public class Preference implements Comparable, OnDependencyChangeLis } /** - * Compares preferences based on order (if set), otherwise alphabetically on title. - *

    - * {@inheritDoc} + * Compares Preference objects based on order (if set), otherwise alphabetically on the titles. + * + * @param another The Preference to compare to this one. + * @return 0 if the same; less than 0 if this Preference sorts ahead of another; + * greater than 0 if this Preference sorts after another. */ public int compareTo(Preference another) { if (mOrder != DEFAULT_ORDER @@ -942,7 +952,7 @@ public class Preference implements Comparable, OnDependencyChangeLis } /** - * Should be called this is a group a {@link Preference} has been + * Should be called when a Preference has been * added/removed from this group, or the ordering should be * re-evaluated. */ @@ -953,7 +963,7 @@ public class Preference implements Comparable, OnDependencyChangeLis } /** - * Gets the {@link PreferenceManager} that manages this preference's tree. + * Gets the {@link PreferenceManager} that manages this Preference object's tree. * * @return The {@link PreferenceManager}. */ @@ -962,10 +972,10 @@ public class Preference implements Comparable, OnDependencyChangeLis } /** - * Called when this preference has been attached to a preference hierarchy. + * Called when this Preference has been attached to a Preference hierarchy. * Make sure to call the super implementation. * - * @param preferenceManager The preference manager of the hierarchy. + * @param preferenceManager The PreferenceManager of the hierarchy. */ protected void onAttachedToHierarchy(PreferenceManager preferenceManager) { mPreferenceManager = preferenceManager; @@ -976,9 +986,9 @@ public class Preference implements Comparable, OnDependencyChangeLis } /** - * Called when the preference hierarchy has been attached to the + * Called when the Preference hierarchy has been attached to the * {@link PreferenceActivity}. This can also be called when this - * {@link Preference} has been attached to a group that was already attached + * Preference has been attached to a group that was already attached * to the {@link PreferenceActivity}. */ protected void onAttachedToActivity() { @@ -1010,15 +1020,14 @@ public class Preference implements Comparable, OnDependencyChangeLis } /** - * Find a Preference in this hierarchy (the whole thing, + * Finds a Preference in this hierarchy (the whole thing, * even above/below your {@link PreferenceScreen} screen break) with the given * key. *

    * This only functions after we have been attached to a hierarchy. * - * @param key The key of the {@link Preference} to find. - * @return The {@link Preference} object of a preference - * with the given key. + * @param key The key of the Preference to find. + * @return The Preference that uses the given key. */ protected Preference findPreferenceInHierarchy(String key) { if (TextUtils.isEmpty(key) || mPreferenceManager == null) { @@ -1029,13 +1038,13 @@ public class Preference implements Comparable, OnDependencyChangeLis } /** - * Adds a dependent Preference on this preference so we can notify it. - * Usually, the dependent preference registers itself (it's good for it to + * Adds a dependent Preference on this Preference so we can notify it. + * Usually, the dependent Preference registers itself (it's good for it to * know it depends on something), so please use - * {@link Preference#setDependency(String)} on the dependent preference. + * {@link Preference#setDependency(String)} on the dependent Preference. * * @param dependent The dependent Preference that will be enabled/disabled - * according to the state of this preference. + * according to the state of this Preference. */ private void registerDependent(Preference dependent) { if (mDependents == null) { @@ -1048,10 +1057,10 @@ public class Preference implements Comparable, OnDependencyChangeLis } /** - * Removes a dependent Preference on this preference. + * Removes a dependent Preference on this Preference. * * @param dependent The dependent Preference that will be enabled/disabled - * according to the state of this preference. + * according to the state of this Preference. * @return Returns the same Preference object, for chaining multiple calls * into a single statement. */ @@ -1065,7 +1074,7 @@ public class Preference implements Comparable, OnDependencyChangeLis * Notifies any listening dependents of a change that affects the * dependency. * - * @param disableDependents Whether this {@link Preference} should disable + * @param disableDependents Whether this Preference should disable * its dependents. */ public void notifyDependencyChange(boolean disableDependents) { @@ -1084,15 +1093,15 @@ public class Preference implements Comparable, OnDependencyChangeLis /** * Called when the dependency changes. * - * @param dependency The preference that this preference depends on. - * @param disableDependent Whether to disable this preference. + * @param dependency The Preference that this Preference depends on. + * @param disableDependent Set true to disable this Preference. */ public void onDependencyChanged(Preference dependency, boolean disableDependent) { setEnabled(!disableDependent); } /** - * Should return whether this preference's dependents should currently be + * Checks whether this preference's dependents should currently be * disabled. * * @return True if the dependents should be disabled, otherwise false. @@ -1117,7 +1126,7 @@ public class Preference implements Comparable, OnDependencyChangeLis } /** - * Returns the key of the dependency on this preference. + * Returns the key of the dependency on this Preference. * * @return The key of the dependency. * @see #setDependency(String) @@ -1136,7 +1145,7 @@ public class Preference implements Comparable, OnDependencyChangeLis } /** - * Sets the default value for the preference, which will be set either if + * Sets the default value for this Preference, which will be set either if * persistence is off or persistence is on and the preference is not found * in the persistent storage. * @@ -1159,17 +1168,21 @@ public class Preference implements Comparable, OnDependencyChangeLis } /** - * Implement this to set the initial value of the Preference. If the - * restoreValue flag is true, you should restore the value from the shared - * preferences. If false, you should set (and possibly store to shared - * preferences if {@link #shouldPersist()}) to defaultValue. + * Implement this to set the initial value of the Preference. + *

    + * If restorePersistedValue is true, you should restore the + * Preference value from the {@link android.content.SharedPreferences}. If + * restorePersistedValue is false, you should set the Preference + * value to defaultValue that is given (and possibly store to SharedPreferences + * if {@link #shouldPersist()} is true). *

    * This may not always be called. One example is if it should not persist * but there is no default value given. * - * @param restorePersistedValue Whether to restore the persisted value - * (true), or use the given default value (false). - * @param defaultValue The default value. Only use if restoreValue is false. + * @param restorePersistedValue True to restore the persisted value; + * false to use the given defaultValue. + * @param defaultValue The default value for this Preference. Only use this + * if restorePersistedValue is false. */ protected void onSetInitialValue(boolean restorePersistedValue, Object defaultValue) { } @@ -1181,14 +1194,14 @@ public class Preference implements Comparable, OnDependencyChangeLis } /** - * Attempts to persist a String to the SharedPreferences. + * Attempts to persist a String to the {@link android.content.SharedPreferences}. *

    - * This will check if the Preference is persistent, get an editor from - * the preference manager, put the string, check if we should commit (and + * This will check if this Preference is persistent, get an editor from + * the {@link PreferenceManager}, put in the string, and check if we should commit (and * commit if so). * * @param value The value to persist. - * @return Whether the Preference is persistent. (This is not whether the + * @return True if the Preference is persistent. (This is not whether the * value was persisted, since we may not necessarily commit if there * will be a batch commit later.) * @see #getPersistedString(String) @@ -1210,15 +1223,15 @@ public class Preference implements Comparable, OnDependencyChangeLis } /** - * Attempts to get a persisted String from the SharedPreferences. + * Attempts to get a persisted String from the {@link android.content.SharedPreferences}. *

    - * This will check if the Preference is persistent, get the shared - * preferences from the preference manager, get the value. + * This will check if this Preference is persistent, get the SharedPreferences + * from the {@link PreferenceManager}, and get the value. * * @param defaultReturnValue The default value to return if either the * Preference is not persistent or the Preference is not in the * shared preferences. - * @return The value from the shared preferences or the default return + * @return The value from the SharedPreferences or the default return * value. * @see #persistString(String) */ @@ -1231,10 +1244,10 @@ public class Preference implements Comparable, OnDependencyChangeLis } /** - * Attempts to persist an int to the SharedPreferences. + * Attempts to persist an int to the {@link android.content.SharedPreferences}. * * @param value The value to persist. - * @return Whether the Preference is persistent. (This is not whether the + * @return True if the Preference is persistent. (This is not whether the * value was persisted, since we may not necessarily commit if there * will be a batch commit later.) * @see #persistString(String) @@ -1256,12 +1269,12 @@ public class Preference implements Comparable, OnDependencyChangeLis } /** - * Attempts to get a persisted int from the SharedPreferences. + * Attempts to get a persisted int from the {@link android.content.SharedPreferences}. * - * @param defaultReturnValue The default value to return if either the - * Preference is not persistent or the Preference is not in the - * shared preferences. - * @return The value from the shared preferences or the default return + * @param defaultReturnValue The default value to return if either this + * Preference is not persistent or this Preference is not in the + * SharedPreferences. + * @return The value from the SharedPreferences or the default return * value. * @see #getPersistedString(String) * @see #persistInt(int) @@ -1275,10 +1288,10 @@ public class Preference implements Comparable, OnDependencyChangeLis } /** - * Attempts to persist a float to the SharedPreferences. + * Attempts to persist a float to the {@link android.content.SharedPreferences}. * * @param value The value to persist. - * @return Whether the Preference is persistent. (This is not whether the + * @return True if this Preference is persistent. (This is not whether the * value was persisted, since we may not necessarily commit if there * will be a batch commit later.) * @see #persistString(String) @@ -1300,12 +1313,12 @@ public class Preference implements Comparable, OnDependencyChangeLis } /** - * Attempts to get a persisted float from the SharedPreferences. + * Attempts to get a persisted float from the {@link android.content.SharedPreferences}. * - * @param defaultReturnValue The default value to return if either the - * Preference is not persistent or the Preference is not in the - * shared preferences. - * @return The value from the shared preferences or the default return + * @param defaultReturnValue The default value to return if either this + * Preference is not persistent or this Preference is not in the + * SharedPreferences. + * @return The value from the SharedPreferences or the default return * value. * @see #getPersistedString(String) * @see #persistFloat(float) @@ -1319,10 +1332,10 @@ public class Preference implements Comparable, OnDependencyChangeLis } /** - * Attempts to persist a long to the SharedPreferences. + * Attempts to persist a long to the {@link android.content.SharedPreferences}. * * @param value The value to persist. - * @return Whether the Preference is persistent. (This is not whether the + * @return True if this Preference is persistent. (This is not whether the * value was persisted, since we may not necessarily commit if there * will be a batch commit later.) * @see #persistString(String) @@ -1344,12 +1357,12 @@ public class Preference implements Comparable, OnDependencyChangeLis } /** - * Attempts to get a persisted long from the SharedPreferences. + * Attempts to get a persisted long from the {@link android.content.SharedPreferences}. * - * @param defaultReturnValue The default value to return if either the - * Preference is not persistent or the Preference is not in the - * shared preferences. - * @return The value from the shared preferences or the default return + * @param defaultReturnValue The default value to return if either this + * Preference is not persistent or this Preference is not in the + * SharedPreferences. + * @return The value from the SharedPreferences or the default return * value. * @see #getPersistedString(String) * @see #persistLong(long) @@ -1363,10 +1376,10 @@ public class Preference implements Comparable, OnDependencyChangeLis } /** - * Attempts to persist a boolean to the SharedPreferences. + * Attempts to persist a boolean to the {@link android.content.SharedPreferences}. * * @param value The value to persist. - * @return Whether the Preference is persistent. (This is not whether the + * @return True if this Preference is persistent. (This is not whether the * value was persisted, since we may not necessarily commit if there * will be a batch commit later.) * @see #persistString(String) @@ -1388,12 +1401,12 @@ public class Preference implements Comparable, OnDependencyChangeLis } /** - * Attempts to get a persisted boolean from the SharedPreferences. + * Attempts to get a persisted boolean from the {@link android.content.SharedPreferences}. * - * @param defaultReturnValue The default value to return if either the - * Preference is not persistent or the Preference is not in the - * shared preferences. - * @return The value from the shared preferences or the default return + * @param defaultReturnValue The default value to return if either this + * Preference is not persistent or this Preference is not in the + * SharedPreferences. + * @return The value from the SharedPreferences or the default return * value. * @see #getPersistedString(String) * @see #persistBoolean(boolean) @@ -1416,7 +1429,7 @@ public class Preference implements Comparable, OnDependencyChangeLis } /** - * Returns the text that will be used to filter this preference depending on + * Returns the text that will be used to filter this Preference depending on * user input. *

    * If overridding and calling through to the superclass, make sure to prepend @@ -1442,9 +1455,9 @@ public class Preference implements Comparable, OnDependencyChangeLis } /** - * Store this preference hierarchy's frozen state into the given container. + * Store this Preference hierarchy's frozen state into the given container. * - * @param container The Bundle in which to save the preference's icicles. + * @param container The Bundle in which to save the instance of this Preference. * * @see #restoreHierarchyState * @see #dispatchSaveInstanceState @@ -1455,11 +1468,11 @@ public class Preference implements Comparable, OnDependencyChangeLis } /** - * Called by {@link #saveHierarchyState} to store the icicles for this preference and its children. - * May be overridden to modify how freezing happens to a preference's children; for example, some - * preferences may want to not store icicles for their children. + * Called by {@link #saveHierarchyState} to store the instance for this Preference and its children. + * May be overridden to modify how the save happens for children. For example, some + * Preference objects may want to not store an instance for their children. * - * @param container The Bundle in which to save the preference's icicles. + * @param container The Bundle in which to save the instance of this Preference. * * @see #dispatchRestoreInstanceState * @see #saveHierarchyState @@ -1480,13 +1493,13 @@ public class Preference implements Comparable, OnDependencyChangeLis } /** - * Hook allowing a preference to generate a representation of its internal + * Hook allowing a Preference to generate a representation of its internal * state that can later be used to create a new instance with that same * state. This state should only contain information that is not persistent * or can be reconstructed later. * - * @return Returns a Parcelable object containing the preference's current - * dynamic state, or null if there is nothing interesting to save. + * @return A Parcelable object containing the current dynamic state of + * this Preference, or null if there is nothing interesting to save. * The default implementation returns null. * @see #onRestoreInstanceState * @see #saveHierarchyState @@ -1498,9 +1511,9 @@ public class Preference implements Comparable, OnDependencyChangeLis } /** - * Restore this preference hierarchy's frozen state from the given container. + * Restore this Preference hierarchy's previously saved state from the given container. * - * @param container The Bundle which holds previously frozen icicles. + * @param container The Bundle that holds the previously saved state. * * @see #saveHierarchyState * @see #dispatchRestoreInstanceState @@ -1511,12 +1524,12 @@ public class Preference implements Comparable, OnDependencyChangeLis } /** - * Called by {@link #restoreHierarchyState} to retrieve the icicles for this - * preference and its children. May be overridden to modify how restoreing - * happens to a preference's children; for example, some preferences may - * want to not store icicles for their children. + * Called by {@link #restoreHierarchyState} to retrieve the saved state for this + * Preference and its children. May be overridden to modify how restoring + * happens to the children of a Preference. For example, some Preference objects may + * not want to save state for their children. * - * @param container The Bundle which holds previously frozen icicles. + * @param container The Bundle that holds the previously saved state. * @see #dispatchSaveInstanceState * @see #restoreHierarchyState * @see #onRestoreInstanceState @@ -1536,11 +1549,11 @@ public class Preference implements Comparable, OnDependencyChangeLis } /** - * Hook allowing a preference to re-apply a representation of its internal + * Hook allowing a Preference to re-apply a representation of its internal * state that had previously been generated by {@link #onSaveInstanceState}. - * This function will never be called with a null icicle. + * This function will never be called with a null state. * - * @param state The frozen state that had previously been returned by + * @param state The saved state that had previously been returned by * {@link #onSaveInstanceState}. * @see #onSaveInstanceState * @see #restoreHierarchyState @@ -1553,6 +1566,9 @@ public class Preference implements Comparable, OnDependencyChangeLis } } + /** + * A base class for managing the instance state of a {@link Preference}. + */ public static class BaseSavedState extends AbsSavedState { public BaseSavedState(Parcel source) { super(source); diff --git a/core/java/android/preference/PreferenceActivity.java b/core/java/android/preference/PreferenceActivity.java index 98144ca3c3304..95970eae0276f 100644 --- a/core/java/android/preference/PreferenceActivity.java +++ b/core/java/android/preference/PreferenceActivity.java @@ -27,7 +27,7 @@ import android.view.View; import android.view.Window; /** - * The {@link PreferenceActivity} activity shows a hierarchy of preferences as + * Shows a hierarchy of {@link Preference} objects as * lists, possibly spanning multiple screens. These preferences will * automatically save to {@link SharedPreferences} as the user interacts with * them. To retrieve an instance of {@link SharedPreferences} that the @@ -108,7 +108,7 @@ public abstract class PreferenceActivity extends ListActivity implements setContentView(com.android.internal.R.layout.preference_list_content); mPreferenceManager = onCreatePreferenceManager(); - getListView().setScrollBarStyle(View.SCROLLBARS_INSIDE_INSET); + getListView().setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY); } @Override diff --git a/core/java/android/preference/PreferenceCategory.java b/core/java/android/preference/PreferenceCategory.java index a1b6f09a836b7..237c5ce8c84ac 100644 --- a/core/java/android/preference/PreferenceCategory.java +++ b/core/java/android/preference/PreferenceCategory.java @@ -22,7 +22,7 @@ import android.content.Context; import android.util.AttributeSet; /** - * The {@link PreferenceCategory} class is used to group {@link Preference}s + * Used to group {@link Preference} objects * and provide a disabled title above the group. */ public class PreferenceCategory extends PreferenceGroup { diff --git a/core/java/android/preference/PreferenceGroup.java b/core/java/android/preference/PreferenceGroup.java index 55b3753006df1..4258b4123f9c4 100644 --- a/core/java/android/preference/PreferenceGroup.java +++ b/core/java/android/preference/PreferenceGroup.java @@ -28,8 +28,8 @@ import android.os.Parcelable; import android.util.AttributeSet; /** - * The {@link PreferenceGroup} class is a container for multiple - * {@link Preference}s. It is a base class for {@link Preference} that are + * A container for multiple + * {@link Preference} objects. It is a base class for Preference objects that are * parents, such as {@link PreferenceCategory} and {@link PreferenceScreen}. * * @attr ref android.R.styleable#PreferenceGroup_orderingFromXml diff --git a/core/java/android/preference/PreferenceManager.java b/core/java/android/preference/PreferenceManager.java index 996354453ab43..a7a3eef68b6f4 100644 --- a/core/java/android/preference/PreferenceManager.java +++ b/core/java/android/preference/PreferenceManager.java @@ -35,7 +35,7 @@ import android.os.Bundle; import android.util.Log; /** - * The {@link PreferenceManager} is used to help create preference hierarchies + * Used to help create {@link Preference} hierarchies * from activities or XML. *

    * In most cases, clients should use @@ -643,17 +643,23 @@ public class PreferenceManager { * event. */ void dispatchActivityDestroy() { - List list; + List list = null; synchronized (this) { - if (mActivityDestroyListeners == null) return; - list = new ArrayList(mActivityDestroyListeners); + if (mActivityDestroyListeners != null) { + list = new ArrayList(mActivityDestroyListeners); + } } - final int N = list.size(); - for (int i = 0; i < N; i++) { - list.get(i).onActivityDestroy(); + if (list != null) { + final int N = list.size(); + for (int i = 0; i < N; i++) { + list.get(i).onActivityDestroy(); + } } + + // Dismiss any PreferenceScreens still showing + dismissAllScreens(); } /** @@ -697,10 +703,13 @@ public class PreferenceManager { * @param intent The new Intent. */ void dispatchNewIntent(Intent intent) { + dismissAllScreens(); + } + private void dismissAllScreens() { // Remove any of the previously shown preferences screens ArrayList screensToDismiss; - + synchronized (this) { if (mPreferencesScreens == null) { @@ -715,7 +724,7 @@ public class PreferenceManager { screensToDismiss.get(i).dismiss(); } } - + /** * Sets the callback to be invoked when a {@link Preference} in the * hierarchy rooted at this {@link PreferenceManager} is clicked. diff --git a/core/java/android/preference/PreferenceScreen.java b/core/java/android/preference/PreferenceScreen.java index e4ecb88824b2f..9929b963755e0 100644 --- a/core/java/android/preference/PreferenceScreen.java +++ b/core/java/android/preference/PreferenceScreen.java @@ -30,11 +30,11 @@ import android.widget.ListAdapter; import android.widget.ListView; /** - * The {@link PreferenceScreen} class represents a top-level {@link Preference} that - * is the root of a {@link Preference} hierarchy. A {@link PreferenceActivity} + * Represents a top-level {@link Preference} that + * is the root of a Preference hierarchy. A {@link PreferenceActivity} * points to an instance of this class to show the preferences. To instantiate * this class, use {@link PreferenceManager#createPreferenceScreen(Context)}. - *

    + *

      * This class can appear in two places: *
    • When a {@link PreferenceActivity} points to this, it is used as the root * and is not shown (only the contained preferences are shown). @@ -45,24 +45,25 @@ import android.widget.ListView; * {@link Preference#getIntent()}). The children of this {@link PreferenceScreen} * are NOT shown in the screen that this {@link PreferenceScreen} is shown in. * Instead, a separate screen will be shown when this preference is clicked. + *
    + *

    Here's an example XML layout of a PreferenceScreen:

    + *
    +<PreferenceScreen
    +        xmlns:android="http://schemas.android.com/apk/res/android"
    +        android:key="first_preferencescreen">
    +    <CheckBoxPreference
    +            android:key="wifi enabled"
    +            android:title="WiFi" />
    +    <PreferenceScreen
    +            android:key="second_preferencescreen"
    +            android:title="WiFi settings">
    +        <CheckBoxPreference
    +                android:key="prefer wifi"
    +                android:title="Prefer WiFi" />
    +        ... other preferences here ...
    +    </PreferenceScreen>
    +</PreferenceScreen> 
    *

    - * - <PreferenceScreen - xmlns:android="http://schemas.android.com/apk/res/android" - android:key="first_preferencescreen"> - <CheckBoxPreference - android:key="wifi enabled" - android:title="WiFi" /> - <PreferenceScreen - android:key="second_preferencescreen" - android:title="WiFi settings"> - <CheckBoxPreference - android:key="prefer wifi" - android:title="Prefer WiFi" /> - ... other preferences here ... - </PreferenceScreen> - </PreferenceScreen> - * * In this example, the "first_preferencescreen" will be used as the root of the * hierarchy and given to a {@link PreferenceActivity}. The first screen will * show preferences "WiFi" (which can be used to quickly enable/disable WiFi) diff --git a/core/java/android/preference/RingtonePreference.java b/core/java/android/preference/RingtonePreference.java index 97674cee48ccf..6beb06dc470e9 100644 --- a/core/java/android/preference/RingtonePreference.java +++ b/core/java/android/preference/RingtonePreference.java @@ -27,8 +27,8 @@ import android.util.AttributeSet; import android.util.Log; /** - * The {@link RingtonePreference} allows the user to choose one from all of the - * available ringtones. The chosen ringtone's URI will be persisted as a string. + * A {@link Preference} that allows the user to choose a ringtone from those on the device. + * The chosen ringtone's URI will be persisted as a string. *

    * If the user chooses the "Default" item, the saved string will be one of * {@link System#DEFAULT_RINGTONE_URI} or diff --git a/core/java/android/preference/VolumePreference.java b/core/java/android/preference/VolumePreference.java index 5a0a0893897ee..6e215dcd74910 100644 --- a/core/java/android/preference/VolumePreference.java +++ b/core/java/android/preference/VolumePreference.java @@ -16,7 +16,6 @@ package android.preference; -import android.content.ContentResolver; import android.content.Context; import android.content.res.TypedArray; import android.database.ContentObserver; @@ -35,33 +34,15 @@ import android.widget.SeekBar.OnSeekBarChangeListener; /** * @hide */ -public class VolumePreference extends SeekBarPreference implements OnSeekBarChangeListener, - Runnable, PreferenceManager.OnActivityStopListener { +public class VolumePreference extends SeekBarPreference implements + PreferenceManager.OnActivityStopListener { private static final String TAG = "VolumePreference"; - private ContentResolver mContentResolver; - private Handler mHandler = new Handler(); - - private AudioManager mVolume; private int mStreamType; - private int mOriginalStreamVolume; - private Ringtone mRingtone; - - private int mLastProgress; - private SeekBar mSeekBar; - private ContentObserver mVolumeObserver = new ContentObserver(mHandler) { - @Override - public void onChange(boolean selfChange) { - super.onChange(selfChange); - - if (mSeekBar != null) { - mSeekBar.setProgress(System.getInt(mContentResolver, - System.VOLUME_SETTINGS[mStreamType], 0)); - } - } - }; + /** May be null if the dialog isn't visible. */ + private SeekBarVolumizer mSeekBarVolumizer; public VolumePreference(Context context, AttributeSet attrs) { super(context, attrs); @@ -70,39 +51,32 @@ public class VolumePreference extends SeekBarPreference implements OnSeekBarChan com.android.internal.R.styleable.VolumePreference, 0, 0); mStreamType = a.getInt(android.R.styleable.VolumePreference_streamType, 0); a.recycle(); - - mContentResolver = context.getContentResolver(); - - mVolume = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE); } + public void setStreamType(int streamType) { + mStreamType = streamType; + } + @Override protected void onBindDialogView(View view) { super.onBindDialogView(view); - final SeekBar seekBar = mSeekBar = (SeekBar) view.findViewById(com.android.internal.R.id.seekbar); - seekBar.setMax(mVolume.getStreamMaxVolume(mStreamType)); - mOriginalStreamVolume = mVolume.getStreamVolume(mStreamType); - seekBar.setProgress(mOriginalStreamVolume); - seekBar.setOnSeekBarChangeListener(this); + final SeekBar seekBar = (SeekBar) view.findViewById(com.android.internal.R.id.seekbar); + mSeekBarVolumizer = new SeekBarVolumizer(getContext(), seekBar, mStreamType); - mContentResolver.registerContentObserver(System.getUriFor(System.VOLUME_SETTINGS[mStreamType]), false, mVolumeObserver); - getPreferenceManager().registerOnActivityStopListener(this); - mRingtone = RingtoneManager.getRingtone(getContext(), Settings.System.DEFAULT_RINGTONE_URI); } @Override protected void onDialogClosed(boolean positiveResult) { super.onDialogClosed(positiveResult); - if (!positiveResult) { - mVolume.setStreamVolume(mStreamType, mOriginalStreamVolume, 0); + if (!positiveResult && mSeekBarVolumizer != null) { + mSeekBarVolumizer.revertVolume(); } cleanup(); } - public void onActivityStop() { cleanup(); @@ -112,50 +86,134 @@ public class VolumePreference extends SeekBarPreference implements OnSeekBarChan * Do clean up. This can be called multiple times! */ private void cleanup() { - stopSample(); - if (mVolumeObserver != null) { - mContentResolver.unregisterContentObserver(mVolumeObserver); + getPreferenceManager().unregisterOnActivityStopListener(this); + + if (mSeekBarVolumizer != null) { + mSeekBarVolumizer.stop(); + mSeekBarVolumizer = null; + } + } + + protected void onSampleStarting(SeekBarVolumizer volumizer) { + if (mSeekBarVolumizer != null && volumizer != mSeekBarVolumizer) { + mSeekBarVolumizer.stopSample(); } - getPreferenceManager().unregisterOnActivityStopListener(this); - mSeekBar = null; } + + /** + * Turns a {@link SeekBar} into a volume control. + */ + public class SeekBarVolumizer implements OnSeekBarChangeListener, Runnable { - public void onProgressChanged(SeekBar seekBar, int progress, boolean fromTouch) { - if (!fromTouch) { - return; + private Context mContext; + private Handler mHandler = new Handler(); + + private AudioManager mAudioManager; + private int mStreamType; + private int mOriginalStreamVolume; + private Ringtone mRingtone; + + private int mLastProgress; + private SeekBar mSeekBar; + + private ContentObserver mVolumeObserver = new ContentObserver(mHandler) { + @Override + public void onChange(boolean selfChange) { + super.onChange(selfChange); + + if (mSeekBar != null) { + mSeekBar.setProgress(System.getInt(mContext.getContentResolver(), + System.VOLUME_SETTINGS[mStreamType], 0)); + } + } + }; + + public SeekBarVolumizer(Context context, SeekBar seekBar, int streamType) { + mContext = context; + mAudioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE); + mStreamType = streamType; + mSeekBar = seekBar; + + initSeekBar(seekBar); } - postSetVolume(progress); - } - - private void postSetVolume(int progress) { - // Do the volume changing separately to give responsive UI - mLastProgress = progress; - mHandler.removeCallbacks(this); - mHandler.post(this); - } + private void initSeekBar(SeekBar seekBar) { + seekBar.setMax(mAudioManager.getStreamMaxVolume(mStreamType)); + mOriginalStreamVolume = mAudioManager.getStreamVolume(mStreamType); + seekBar.setProgress(mOriginalStreamVolume); + seekBar.setOnSeekBarChangeListener(this); + + mContext.getContentResolver().registerContentObserver( + System.getUriFor(System.VOLUME_SETTINGS[mStreamType]), + false, mVolumeObserver); - public void onStartTrackingTouch(SeekBar seekBar) { - } + mRingtone = RingtoneManager.getRingtone(mContext, + mStreamType == AudioManager.STREAM_NOTIFICATION + ? Settings.System.DEFAULT_NOTIFICATION_URI + : Settings.System.DEFAULT_RINGTONE_URI); + mRingtone.setStreamType(mStreamType); + } + + public void stop() { + stopSample(); + mContext.getContentResolver().unregisterContentObserver(mVolumeObserver); + mSeekBar.setOnSeekBarChangeListener(null); + } + + public void revertVolume() { + mAudioManager.setStreamVolume(mStreamType, mOriginalStreamVolume, 0); + } + + public void onProgressChanged(SeekBar seekBar, int progress, + boolean fromTouch) { + if (!fromTouch) { + return; + } + + postSetVolume(progress); + } - public void onStopTrackingTouch(SeekBar seekBar) { - if (mRingtone != null && !mRingtone.isPlaying()) { - sample(); + private void postSetVolume(int progress) { + // Do the volume changing separately to give responsive UI + mLastProgress = progress; + mHandler.removeCallbacks(this); + mHandler.post(this); + } + + public void onStartTrackingTouch(SeekBar seekBar) { } - } - public void run() { - mVolume.setStreamVolume(mStreamType, mLastProgress, 0); - } + public void onStopTrackingTouch(SeekBar seekBar) { + if (mRingtone != null && !mRingtone.isPlaying()) { + sample(); + } + } + + public void run() { + mAudioManager.setStreamVolume(mStreamType, mLastProgress, 0); + } + + private void sample() { - private void sample() { - mRingtone.play(); - } + // Only play a preview sample when controlling the ringer stream + if (mStreamType != AudioManager.STREAM_RING + && mStreamType != AudioManager.STREAM_NOTIFICATION) { + return; + } + + onSampleStarting(this); + mRingtone.play(); + } + + public void stopSample() { + if (mRingtone != null) { + mRingtone.stop(); + } + } - private void stopSample() { - if (mRingtone != null) { - mRingtone.stop(); + public SeekBar getSeekBar() { + return mSeekBar; } + } - } diff --git a/core/java/android/provider/Calendar.java b/core/java/android/provider/Calendar.java index b07f1b823a28e..b137b34b33d1a 100644 --- a/core/java/android/provider/Calendar.java +++ b/core/java/android/provider/Calendar.java @@ -38,11 +38,11 @@ import android.content.Context; import android.content.Intent; import android.database.Cursor; import android.net.Uri; -import android.pim.DateUtils; import android.pim.ICalendar; import android.pim.RecurrenceSet; -import android.pim.Time; import android.text.TextUtils; +import android.text.format.DateUtils; +import android.text.format.Time; import android.util.Config; import android.util.Log; @@ -429,17 +429,26 @@ public final class Calendar { public static final String EXDATE = "exdate"; /** - * The original event this event is an exception for + * The _sync_id of the original recurring event for which this event is + * an exception. *

    Type: TEXT

    */ public static final String ORIGINAL_EVENT = "originalEvent"; /** - * The time of the original instance time this event is an exception for + * The original instance time of the recurring event for which this + * event is an exception. *

    Type: INTEGER (long; millis since epoch)

    */ public static final String ORIGINAL_INSTANCE_TIME = "originalInstanceTime"; + /** + * The allDay status (true or false) of the original recurring event + * for which this event is an exception. + *

    Type: INTEGER (boolean)

    + */ + public static final String ORIGINAL_ALL_DAY = "originalAllDay"; + /** * The last date this event repeats on, or NULL if it never ends *

    Type: INTEGER (long; millis since epoch)

    @@ -543,7 +552,7 @@ public final class Calendar { time.clear(tzidParam.value); } try { - time.parse2445(dtstart); + time.parse(dtstart); } catch (Exception e) { if (Config.LOGD) { Log.d(TAG, "Cannot parse dtstart " + dtstart, e); @@ -564,7 +573,7 @@ public final class Calendar { // TODO: make sure the timezones are the same for // start, end. try { - time.parse2445(dtend); + time.parse(dtend); } catch (Exception e) { if (Config.LOGD) { Log.d(TAG, "Cannot parse dtend " + dtend, e); diff --git a/core/java/android/provider/Checkin.java b/core/java/android/provider/Checkin.java index 5b7948216360f..ef5ededc24b11 100644 --- a/core/java/android/provider/Checkin.java +++ b/core/java/android/provider/Checkin.java @@ -96,8 +96,6 @@ public final class Checkin { SYSTEM_SERVICE_LOOPING, SYSTEM_TOMBSTONE, TEST, - NETWORK_RX_MOBILE, - NETWORK_TX_MOBILE, } } diff --git a/core/java/android/provider/Contacts.java b/core/java/android/provider/Contacts.java index 91b1853471d45..6d24ba87aa532 100644 --- a/core/java/android/provider/Contacts.java +++ b/core/java/android/provider/Contacts.java @@ -16,6 +16,8 @@ package android.provider; +import com.android.internal.R; + import android.content.ContentResolver; import android.content.ContentUris; import android.content.ContentValues; @@ -29,8 +31,6 @@ import android.text.TextUtils; import android.util.Log; import android.widget.ImageView; -import com.android.internal.R; - import java.io.ByteArrayInputStream; import java.io.InputStream; @@ -1229,7 +1229,7 @@ public class Contacts { try { display = labels[type - 1]; } catch (ArrayIndexOutOfBoundsException e) { - display = labels[People.Phones.TYPE_HOME - 1]; + display = labels[Organizations.TYPE_WORK - 1]; } } else { if (!TextUtils.isEmpty(label)) { @@ -1545,6 +1545,32 @@ public class Contacts { */ public static final String PHONE_ISPRIMARY = "phone_isprimary"; + /** + * The extra field for an optional second contact phone number. + *

    Type: String

    + */ + public static final String SECONDARY_PHONE = "secondary_phone"; + + /** + * The extra field for an optional second contact phone number type. + *

    Type: Either an integer value from {@link android.provider.Contacts.PhonesColumns PhonesColumns}, + * or a string specifying a type and label.

    + */ + public static final String SECONDARY_PHONE_TYPE = "secondary_phone_type"; + + /** + * The extra field for an optional third contact phone number. + *

    Type: String

    + */ + public static final String TERTIARY_PHONE = "tertiary_phone"; + + /** + * The extra field for an optional third contact phone number type. + *

    Type: Either an integer value from {@link android.provider.Contacts.PhonesColumns PhonesColumns}, + * or a string specifying a type and label.

    + */ + public static final String TERTIARY_PHONE_TYPE = "tertiary_phone_type"; + /** * The extra field for the contact email address. *

    Type: String

    @@ -1564,6 +1590,32 @@ public class Contacts { */ public static final String EMAIL_ISPRIMARY = "email_isprimary"; + /** + * The extra field for an optional second contact email address. + *

    Type: String

    + */ + public static final String SECONDARY_EMAIL = "secondary_email"; + + /** + * The extra field for an optional second contact email type. + *

    Type: Either an integer value from {@link android.provider.Contacts.ContactMethodsColumns ContactMethodsColumns} + * or a string specifying a type and label.

    + */ + public static final String SECONDARY_EMAIL_TYPE = "secondary_email_type"; + + /** + * The extra field for an optional third contact email address. + *

    Type: String

    + */ + public static final String TERTIARY_EMAIL = "tertiary_email"; + + /** + * The extra field for an optional third contact email type. + *

    Type: Either an integer value from {@link android.provider.Contacts.ContactMethodsColumns ContactMethodsColumns} + * or a string specifying a type and label.

    + */ + public static final String TERTIARY_EMAIL_TYPE = "tertiary_email_type"; + /** * The extra field for the contact postal address. *

    Type: String

    diff --git a/core/java/android/provider/Downloads.java b/core/java/android/provider/Downloads.java index 42e9d95a2ad74..a5a30b92f553a 100644 --- a/core/java/android/provider/Downloads.java +++ b/core/java/android/provider/Downloads.java @@ -29,6 +29,29 @@ import android.net.Uri; // this API is hidden. public final class Downloads implements BaseColumns { private Downloads() {} + + /** + * The permission to access the download manager + */ + public static final String PERMISSION_ACCESS = "android.permission.ACCESS_DOWNLOAD_MANAGER"; + + /** + * The permission to access the download manager's advanced functions + */ + public static final String PERMISSION_ACCESS_ADVANCED = + "android.permission.ACCESS_DOWNLOAD_MANAGER_ADVANCED"; + + /** + * The permission to directly access the download manager's cache directory + */ + public static final String PERMISSION_CACHE = "android.permission.ACCESS_CACHE_FILESYSTEM"; + + /** + * The permission to send broadcasts on download completion + */ + public static final String PERMISSION_SEND_INTENTS = + "android.permission.SEND_DOWNLOAD_COMPLETED_INTENTS"; + /** * The content:// URI for the data table in the provider */ @@ -64,21 +87,11 @@ public final class Downloads implements BaseColumns { public static final String URI = "uri"; /** - * The name of the column containing the HTTP method to use for this - * download. See the METHOD_* constants for a list of legal values. - *

    Type: INTEGER

    - *

    Owner can Init/Read

    - */ - public static final String METHOD = "method"; - - /** - * The name of the column containing the entity to be sent with the - * request of this download. Only use for methods that support sending - * entities, i.e. POST. + * The name of the column containing application-specific data. *

    Type: TEXT

    - *

    Owner can Init

    + *

    Owner can Init/Read/Write

    */ - public static final String ENTITY = "entity"; + public static final String APP_DATA = "entity"; /** * The name of the column containing the flags that indicates whether @@ -89,7 +102,7 @@ public final class Downloads implements BaseColumns { * a byte-range request without an ETag, or when it can't determine * whether a download fully completed). *

    Type: BOOLEAN

    - *

    Owner can Init/Read

    + *

    Owner can Init

    */ public static final String NO_INTEGRITY = "no_integrity"; @@ -98,7 +111,7 @@ public final class Downloads implements BaseColumns { * application recommends. When possible, the download manager will attempt * to use this filename, or a variation, as the actual name for the file. *

    Type: TEXT

    - *

    Owner can Init/Read

    + *

    Owner can Init

    */ public static final String FILENAME_HINT = "hint"; @@ -107,15 +120,13 @@ public final class Downloads implements BaseColumns { * was actually stored. *

    Type: TEXT

    *

    Owner can Read

    - *

    UI can Read

    */ - public static final String FILENAME = "_data"; + public static final String _DATA = "_data"; /** * The name of the column containing the MIME type of the downloaded data. *

    Type: TEXT

    *

    Owner can Init/Read

    - *

    UI can Read

    */ public static final String MIMETYPE = "mimetype"; @@ -123,51 +134,25 @@ public final class Downloads implements BaseColumns { * The name of the column containing the flag that controls the destination * of the download. See the DESTINATION_* constants for a list of legal values. *

    Type: INTEGER

    - *

    Owner can Init/Read

    - *

    UI can Read

    + *

    Owner can Init

    */ public static final String DESTINATION = "destination"; - /** - * The name of the column containing the flags that controls whether - * the download must be saved with the filename used for OTA updates. - * Must be used with INTERNAL, and the initiating application must hold the - * android.permission.DOWNLOAD_OTA_UPDATE permission. - *

    Type: BOOLEAN

    - *

    Owner can Init/Read

    - *

    UI can Read

    - */ - public static final String OTA_UPDATE = "otaupdate"; - - /** - * The name of the columns containing the flag that controls whether - * files with private/inernal/system MIME types can be downloaded. - *

    Type: BOOLEAN

    - *

    Owner can Init/Read

    - */ - public static final String NO_SYSTEM_FILES = "no_system"; - /** * The name of the column containing the flags that controls whether the * download is displayed by the UI. See the VISIBILITY_* constants for * a list of legal values. *

    Type: INTEGER

    *

    Owner can Init/Read/Write

    - *

    UI can Read/Write (only for entries that are visible)

    */ public static final String VISIBILITY = "visibility"; /** - * The name of the column containing the command associated with the - * download. After a download is initiated, this is the only column that - * applications can modify. See the CONTROL_* constants for a list of legal - * values. Note: doesn't do anything in 1.0. The API will be hooked up - * in a future version, and is provided here as an indication of things - * to come. + * The name of the column containing the current control state of the download. + * Applications can write to this to control (pause/resume) the download. + * the CONTROL_* constants for a list of legal values. *

    Type: INTEGER

    - *

    Owner can Init/Read/Write

    - *

    UI can Init/Read/Write

    - * @hide + *

    Owner can Read

    */ public static final String CONTROL = "control"; @@ -177,7 +162,6 @@ public final class Downloads implements BaseColumns { * the STATUS_* constants for a list of legal values. *

    Type: INTEGER

    *

    Owner can Read

    - *

    UI can Read

    */ public static final String STATUS = "status"; @@ -187,24 +171,15 @@ public final class Downloads implements BaseColumns { * value. *

    Type: BIGINT

    *

    Owner can Read

    - *

    UI can Read

    */ public static final String LAST_MODIFICATION = "lastmod"; - /** - * The name of the column containing the number of consecutive connections - * that have failed. - *

    Type: INTEGER

    - */ - public static final String FAILED_CONNECTIONS = "numfailed"; - /** * The name of the column containing the package name of the application * that initiating the download. The download manager will send * notifications to a component in this package when the download completes. *

    Type: TEXT

    *

    Owner can Init/Read

    - *

    UI can Read

    */ public static final String NOTIFICATION_PACKAGE = "notificationpackage"; @@ -215,13 +190,14 @@ public final class Downloads implements BaseColumns { * Intent.setClassName(String,String). *

    Type: TEXT

    *

    Owner can Init/Read

    - *

    UI can Read

    */ public static final String NOTIFICATION_CLASS = "notificationclass"; /** * If extras are specified when requesting a download they will be provided in the intent that * is sent to the specified class and package when a download has finished. + *

    Type: TEXT

    + *

    Owner can Init

    */ public static final String NOTIFICATION_EXTRAS = "notificationextras"; @@ -255,7 +231,6 @@ public final class Downloads implements BaseColumns { * downloaded. *

    Type: INTEGER

    *

    Owner can Read

    - *

    UI can Read

    */ public static final String TOTAL_BYTES = "total_bytes"; @@ -264,33 +239,18 @@ public final class Downloads implements BaseColumns { * has been downloaded so far. *

    Type: INTEGER

    *

    Owner can Read

    - *

    UI can Read

    */ public static final String CURRENT_BYTES = "current_bytes"; - /** - * The name of the column containing the entity tag for the response. - *

    Type: TEXT

    - * @hide - */ - public static final String ETAG = "etag"; - - /** - * The name of the column containing the UID of the application that - * initiated the download. - *

    Type: INTEGER

    - * @hide - */ - public static final String UID = "uid"; - /** * The name of the column where the initiating application can provide the * UID of another application that is allowed to access this download. If * multiple applications share the same UID, all those applications will be * allowed to access this download. This column can be updated after the - * download is initiated. + * download is initiated. This requires the permission + * android.permission.ACCESS_DOWNLOAD_MANAGER_ADVANCED. *

    Type: INTEGER

    - *

    Owner can Init/Read/Write

    + *

    Owner can Init

    */ public static final String OTHER_UID = "otheruid"; @@ -300,7 +260,6 @@ public final class Downloads implements BaseColumns { * list of downloads. *

    Type: TEXT

    *

    Owner can Init/Read/Write

    - *

    UI can Read

    */ public static final String TITLE = "title"; @@ -310,18 +269,9 @@ public final class Downloads implements BaseColumns { * user in the list of downloads. *

    Type: TEXT

    *

    Owner can Init/Read/Write

    - *

    UI can Read

    */ public static final String DESCRIPTION = "description"; - /** - * The name of the column where the download manager indicates whether the - * media scanner was notified about this download. - *

    Type: BOOLEAN

    - * @hide - */ - public static final String MEDIA_SCANNED = "scanned"; - /* * Lists the destinations that an application can specify for a download. */ @@ -343,7 +293,8 @@ public final class Downloads implements BaseColumns { * download private files that are used and deleted soon after they * get downloaded. All file types are allowed, and only the initiating * application can access the file (indirectly through a content - * provider). + * provider). This requires the + * android.permission.ACCESS_DOWNLOAD_MANAGER_ADVANCED permission. */ public static final int DESTINATION_CACHE_PARTITION = 1; @@ -357,40 +308,21 @@ public final class Downloads implements BaseColumns { public static final int DESTINATION_CACHE_PARTITION_PURGEABLE = 2; /** - * This download will be saved to the download manager's cache - * on the shared data partition. Use CACHE_PARTITION_PURGEABLE instead. - */ - public static final int DESTINATION_DATA_CACHE = 3; - - /* (not javadoc) - * This download will be saved to a file specified by the initiating - * applications. - * @hide - */ - //public static final int DESTINATION_PROVIDER = 4; - - /* - * Lists the commands that an application can set to control an ongoing - * download. Note: those aren't working. + * This download will be saved to the download manager's private + * partition, as with DESTINATION_CACHE_PARTITION, but the download + * will not proceed if the user is on a roaming data connection. */ + public static final int DESTINATION_CACHE_PARTITION_NOROAMING = 3; /** - * This download can run - * @hide + * This download is allowed to run. */ public static final int CONTROL_RUN = 0; /** - * This download must pause (might be restarted) - * @hide - */ - public static final int CONTROL_PAUSE = 1; - - /** - * This download must abort (will never be restarted) - * @hide + * This download must pause at the first opportunity. */ - public static final int CONTROL_STOP = 2; + public static final int CONTROL_PAUSED = 1; /* * Lists the states that the download manager can set on a download @@ -489,11 +421,6 @@ public final class Downloads implements BaseColumns { */ public static final int STATUS_BAD_REQUEST = 400; - /** - * The server returned an auth error. - */ - public static final int STATUS_NOT_AUTHORIZED = 401; - /** * This download can't be performed because the content type cannot be * handled. @@ -522,11 +449,6 @@ public final class Downloads implements BaseColumns { * This download was canceled */ public static final int STATUS_CANCELED = 490; - /** - * @hide - * Alternate spelling - */ - public static final int STATUS_CANCELLED = 490; /** * This download has completed with an error. @@ -534,11 +456,6 @@ public final class Downloads implements BaseColumns { * the future. Use isStatusError() to capture the entire category. */ public static final int STATUS_UNKNOWN_ERROR = 491; - /** - * @hide - * Legacy name - use STATUS_UNKNOWN_ERROR - */ - public static final int STATUS_ERROR = 491; /** * This download couldn't be completed because of a storage issue. @@ -548,54 +465,40 @@ public final class Downloads implements BaseColumns { /** * This download couldn't be completed because of an HTTP - * redirect code. + * redirect response that the download manager couldn't + * handle. */ public static final int STATUS_UNHANDLED_REDIRECT = 493; /** - * This download couldn't be completed because of an - * unspecified unhandled HTTP code. + * This download couldn't be completed because there were + * too many redirects. */ - public static final int STATUS_UNHANDLED_HTTP_CODE = 494; + public static final int STATUS_TOO_MANY_REDIRECTS = 494; /** * This download couldn't be completed because of an - * error receiving or processing data at the HTTP level. + * unspecified unhandled HTTP code. */ - public static final int STATUS_HTTP_DATA_ERROR = 495; + public static final int STATUS_UNHANDLED_HTTP_CODE = 495; /** * This download couldn't be completed because of an - * HttpException while setting up the request. - */ - public static final int STATUS_HTTP_EXCEPTION = 496; - - /* - * Lists the HTTP methods that the download manager can use. - */ - - /** - * GET + * error receiving or processing data at the HTTP level. */ - public static final int METHOD_GET = 0; + public static final int STATUS_HTTP_DATA_ERROR = 496; /** - * POST + * This download is visible and shows in the notifications while + * in progress and after completion. */ - public static final int METHOD_POST = 1; + public static final int VISIBILITY_VISIBLE_NOTIFY_COMPLETED = 0; /** * This download is visible but only shows in the notifications - * while it's running (a separate download UI would still show it - * after completion). - */ - public static final int VISIBILITY_VISIBLE = 0; - - /** - * This download is visible and shows in the notifications after - * completion. + * while it's in progress. */ - public static final int VISIBILITY_VISIBLE_NOTIFY_COMPLETED = 1; + public static final int VISIBILITY_VISIBLE = 1; /** * This download doesn't show in the UI or in the notifications. diff --git a/core/java/android/provider/Gmail.java b/core/java/android/provider/Gmail.java index 038ba21074370..0b6a7588eaf14 100644 --- a/core/java/android/provider/Gmail.java +++ b/core/java/android/provider/Gmail.java @@ -72,6 +72,7 @@ public final class Gmail { public static final String LABEL_STARRED = "^t"; public static final String LABEL_CHAT = "^b"; // 'b' for 'buzz' public static final String LABEL_VOICEMAIL = "^vm"; + public static final String LABEL_IGNORED = "^g"; public static final String LABEL_ALL = "^all"; // These constants (starting with "^^") are only used locally and are not understood by the // server. @@ -142,6 +143,8 @@ public final class Gmail { public static final String RESPOND_INPUT_COMMAND = "command"; public static final String COMMAND_RETRY = "retry"; public static final String COMMAND_ACTIVATE = "activate"; + public static final String COMMAND_SET_VISIBLE = "setVisible"; + public static final String SET_VISIBLE_PARAM_VISIBLE = "visible"; public static final String RESPOND_OUTPUT_COMMAND_RESPONSE = "commandResponse"; public static final String COMMAND_RESPONSE_OK = "ok"; public static final String COMMAND_RESPONSE_UNKNOWN = "unknownCommand"; @@ -210,7 +213,8 @@ public final class Gmail { Gmail.LABEL_UNREAD, Gmail.LABEL_TRASH, Gmail.LABEL_SPAM, - Gmail.LABEL_STARRED); + Gmail.LABEL_STARRED, + Gmail.LABEL_IGNORED); /** * Returns whether the label is user-settable. For example, labels such as LABEL_DRAFT should @@ -337,6 +341,8 @@ public final class Gmail { public static final String LABEL_IDS = "labelIds"; public static final String JOINED_ATTACHMENT_INFOS = "joinedAttachmentInfos"; public static final String ERROR = "error"; + // TODO: add a method for accessing this + public static final String REF_MESSAGE_ID = "refMessageId"; // Fake columns used only for saving or sending messages. public static final String FAKE_SAVE = "save"; @@ -773,7 +779,8 @@ public final class Gmail { priorityToLength.clear(); int maxFoundPriority = Integer.MIN_VALUE; - String numMessagesFragment = ""; + int numMessages = 0; + int numDrafts = 0; CharSequence draftsFragment = ""; CharSequence sendingFragment = ""; CharSequence sendFailedFragment = ""; @@ -799,10 +806,10 @@ public final class Gmail { } else if (Gmail.SENDER_LIST_TOKEN_ELIDED.equals(fragment0)) { // ignore } else if (Gmail.SENDER_LIST_TOKEN_NUM_MESSAGES.equals(fragment0)) { - numMessagesFragment = " (" + fragments[i++] + ")"; + numMessages = Integer.valueOf(fragments[i++]); } else if (Gmail.SENDER_LIST_TOKEN_NUM_DRAFTS.equals(fragment0)) { String numDraftsString = fragments[i++]; - int numDrafts = Integer.parseInt(numDraftsString); + numDrafts = Integer.parseInt(numDraftsString); draftsFragment = numDrafts == 1 ? draftString : draftPluralString + " (" + numDraftsString + ")"; } else if (Gmail.SENDER_LIST_TOKEN_LITERAL.equals(fragment0)) { @@ -821,6 +828,8 @@ public final class Gmail { maxFoundPriority = Math.max(maxFoundPriority, priority); } } + String numMessagesFragment = + (numMessages != 0) ? " (" + Integer.toString(numMessages + numDrafts) + ")" : ""; // Don't allocate fixedFragment unless we need it SpannableStringBuilder fixedFragment = null; @@ -1242,6 +1251,7 @@ public final class Gmail { private long mLabelIdStarred; private long mLabelIdChat; private long mLabelIdVoicemail; + private long mLabelIdIgnored; private long mLabelIdVoicemailInbox; private long mLabelIdCached; private long mLabelIdOutbox; @@ -1313,6 +1323,8 @@ public final class Gmail { mLabelIdStarred = labelId; } else if (LABEL_CHAT.equals(canonicalName)) { mLabelIdChat = labelId; + } else if (LABEL_IGNORED.equals(canonicalName)) { + mLabelIdIgnored = labelId; } else if (LABEL_VOICEMAIL.equals(canonicalName)) { mLabelIdVoicemail = labelId; } else if (LABEL_VOICEMAIL_INBOX.equals(canonicalName)) { @@ -1330,6 +1342,7 @@ public final class Gmail { && mLabelIdSpam != 0 && mLabelIdStarred != 0 && mLabelIdChat != 0 + && mLabelIdIgnored != 0 && mLabelIdVoicemail != 0; } } @@ -1374,6 +1387,11 @@ public final class Gmail { return mLabelIdChat; } + public long getLabelIdIgnored() { + checkLabelsSynced(); + return mLabelIdIgnored; + } + public long getLabelIdVoicemail() { checkLabelsSynced(); return mLabelIdVoicemail; @@ -2237,9 +2255,28 @@ public final class Gmail { } /** - * Gets the conversation id. This must be immutable. (For example, with - * GMail this should be the original conversation id rather than the - * default notion of converation id.) + * Tells the cursor whether its contents are visible to the user. The cursor will + * automatically broadcast intents to remove any matching new-mail notifications when this + * cursor's results become visible and, if they are visible, when the cursor is requeried. + * + * Note that contents shown in an activity that is resumed but not focused + * (onWindowFocusChanged/hasWindowFocus) then results shown in that activity do not count + * as visible. (This happens when the activity is behind the lock screen or a dialog.) + * + * @param visible whether the contents of this cursor are visible to the user. + */ + public void setContentsVisibleToUser(boolean visible) { + Bundle input = new Bundle(); + input.putString(RESPOND_INPUT_COMMAND, COMMAND_SET_VISIBLE); + input.putBoolean(SET_VISIBLE_PARAM_VISIBLE, visible); + Bundle output = mCursor.respond(input); + String response = output.getString(RESPOND_OUTPUT_COMMAND_RESPONSE); + assert COMMAND_RESPONSE_OK.equals(response); + } + + /** + * Gets the conversation id. This is immutable. (The server calls it the original + * conversation id.) * * @return the conversation id */ diff --git a/core/java/android/provider/Im.java b/core/java/android/provider/Im.java index 8ca97e1f7306e..68b2acdfaf53f 100644 --- a/core/java/android/provider/Im.java +++ b/core/java/android/provider/Im.java @@ -43,16 +43,25 @@ public class Im { public interface ProviderColumns { /** * The name of the IM provider + *

    Type: TEXT

    */ String NAME = "name"; /** * The full name of the provider + *

    Type: TEXT

    */ String FULLNAME = "fullname"; + /** + * The category for the provider, used to form intent. + *

    Type: TEXT

    + */ + String CATEGORY = "category"; + /** * The url users should visit to create a new account for this provider + *

    Type: TEXT

    */ String SIGNUP_URL = "signup_url"; } @@ -187,6 +196,9 @@ public class Im { public static final String ACTIVE_ACCOUNT_ID = "account_id"; public static final String ACTIVE_ACCOUNT_USERNAME = "account_username"; public static final String ACTIVE_ACCOUNT_PW = "account_pw"; + public static final String ACTIVE_ACCOUNT_LOCKED = "account_locked"; + public static final String ACCOUNT_PRESENCE_STATUS = "account_presenceStatus"; + public static final String ACCOUNT_CONNECTION_STATUS = "account_connStatus"; /** * The content:// style URL for this table @@ -204,6 +216,9 @@ public class Im { public static final String CONTENT_TYPE = "vnd.android.cursor.dir/im-providers"; + public static final String CONTENT_ITEM_TYPE = + "vnd.android.cursor.item/im-providers"; + /** * The default sort order for this table */ @@ -319,6 +334,76 @@ public class Im { } + /** + * Connection status + */ + public interface ConnectionStatus { + /** + * The connection is offline, not logged in. + */ + int OFFLINE = 0; + + /** + * The connection is attempting to connect. + */ + int CONNECTING = 1; + + /** + * The connection is suspended due to network not available. + */ + int SUSPENDED = 2; + + /** + * The connection is logged in and online. + */ + int ONLINE = 3; + } + + public interface AccountStatusColumns { + /** + * account id + *

    Type: INTEGER

    + */ + String ACCOUNT = "account"; + + /** + * User's presence status, see definitions in {#link CommonPresenceColumn} + *

    Type: INTEGER

    + */ + String PRESENCE_STATUS = "presenceStatus"; + + /** + * The connection status of this account, see {#link ConnectionStatus} + *

    Type: INTEGER

    + */ + String CONNECTION_STATUS = "connStatus"; + } + + public static final class AccountStatus implements BaseColumns, AccountStatusColumns { + /** + * The content:// style URL for this table + */ + public static final Uri CONTENT_URI = + Uri.parse("content://im/accountStatus"); + + /** + * The MIME type of {@link #CONTENT_URI} providing a directory of account status. + */ + public static final String CONTENT_TYPE = + "vnd.android.cursor.dir/im-account-status"; + + /** + * The MIME type of a {@link #CONTENT_URI} subdirectory of a single account status. + */ + public static final String CONTENT_ITEM_TYPE = + "vnd.android.cursor.item/im-account-status"; + + /** + * The default sort order for this table + */ + public static final String DEFAULT_SORT_ORDER = "name ASC"; + } + /** * Columns from the Contacts table. */ @@ -451,8 +536,36 @@ public class Im { *

    Type: INTEGER

    */ String REJECTED = "rejected"; + + /** + * Off The Record status: 0 for disabled, 1 for enabled + *

    Type: INTEGER

    + */ + String OTR = "otr"; } + /** + * This defines the different type of values of {@link ContactsColumns#OTR} + */ + public interface OffTheRecordType { + /* + * Off the record not turned on + */ + int DISABLED = 0; + /** + * Off the record turned on, but we don't know who turned it on + */ + int ENABLED = 1; + /** + * Off the record turned on by the user + */ + int ENABLED_BY_USER = 2; + /** + * Off the record turned on by the buddy + */ + int ENABLED_BY_BUDDY = 3; + }; + /** * This table contains contacts. */ @@ -755,15 +868,32 @@ public class Im { * Message type definition */ public interface MessageType { + /* sent message */ int OUTGOING = 0; + /* received message */ int INCOMING = 1; + /* presence became available */ int PRESENCE_AVAILABLE = 2; + /* presence became away */ int PRESENCE_AWAY = 3; + /* presence became DND (busy) */ int PRESENCE_DND = 4; + /* presence became unavailable */ int PRESENCE_UNAVAILABLE = 5; + /* the message is converted to a group chat */ int CONVERT_TO_GROUPCHAT = 6; + /* generic status */ int STATUS = 7; + /* the message cannot be sent now, but will be sent later */ int POSTPONED = 8; + /* off The Record status is turned off */ + int OTR_IS_TURNED_OFF = 9; + /* off the record status is turned on */ + int OTR_IS_TURNED_ON = 10; + /* off the record status turned on by user */ + int OTR_TURNED_ON_BY_USER = 11; + /* off the record status turned on by buddy */ + int OTR_TURNED_ON_BY_BUDDY = 12; } /** @@ -1244,26 +1374,25 @@ public class Im { public interface ChatsColumns { /** * The contact ID this chat belongs to. The value is a long. - *

    Type: TEXT

    + *

    Type: INT

    */ String CONTACT_ID = "contact_id"; /** * The GTalk JID resource. The value is a string. + *

    Type: TEXT

    */ String JID_RESOURCE = "jid_resource"; /** * Whether this is a groupchat or not. + *

    Type: INT

    */ - // TODO: remove this column since we already have a tag in contacts - // table to indicate it's a group chat. String GROUP_CHAT = "groupchat"; /** * The last unread message. This both indicates that there is an * unread message, and what the message is. - * *

    Type: TEXT

    */ String LAST_UNREAD_MESSAGE = "last_unread_message"; @@ -1278,10 +1407,17 @@ public class Im { * A message that is being composed. This indicates that there was a * message being composed when the chat screen was shutdown, and what the * message is. - * *

    Type: TEXT

    */ String UNSENT_COMPOSED_MESSAGE = "unsent_composed_message"; + + /** + * A value from 0-9 indicating which quick-switch chat screen slot this + * chat is occupying. If none (for instance, this is the 12th active chat) + * then the value is -1. + *

    Type: INT

    + */ + String SHORTCUT = "shortcut"; } /** diff --git a/core/java/android/provider/LiveFolders.java b/core/java/android/provider/LiveFolders.java new file mode 100644 index 0000000000000..6e95fb7fc115f --- /dev/null +++ b/core/java/android/provider/LiveFolders.java @@ -0,0 +1,298 @@ +/* + * Copyright (C) 2008 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.provider; + +import android.annotation.SdkConstant; + +/** + *

    A LiveFolder is a special folder whose content is provided by a + * {@link android.content.ContentProvider}. To create a live folder, two components + * are required:

    + *
      + *
    • An activity that can respond to the intent action {@link #ACTION_CREATE_LIVE_FOLDER}. The + * activity is responsible for creating the live folder.
    • + *
    • A {@link android.content.ContentProvider} to provide the live folder items.
    • + *
    + * + *

    Lifecycle

    + *

    When a user wants to create a live folder, the system looks for all activities with the + * intent filter action {@link #ACTION_CREATE_LIVE_FOLDER} and presents the list to the user. + * When the user chooses one of the activities, the activity is invoked with the + * {@link #ACTION_CREATE_LIVE_FOLDER} action. The activity then creates the live folder and + * passes it back to the system by setting it as an + * {@link android.app.Activity#setResult(int, android.content.Intent) activity result}. The + * live folder is described by a content provider URI, a name, an icon and a display mode. + * Finally, when the user opens the live folder, the system queries the content provider + * to retrieve the folder's content.

    + * + *

    Setting up the live folder activity

    + *

    The following code sample shows how to write an activity that creates a live fodler:

    + *
    + * public static class MyLiveFolder extends Activity {
    + *     public static final Uri CONTENT_URI = Uri.parse("content://my.app/live");
    + *
    + *     @Override
    + *     protected void onCreate(Bundle savedInstanceState) {
    + *         super.onCreate(savedInstanceState);
    + *
    + *         final Intent intent = getIntent();
    + *         final String action = intent.getAction();
    + *
    + *         if (LiveFolders.ACTION_CREATE_LIVE_FOLDER.equals(action)) {
    + *             setResult(RESULT_OK, createLiveFolder(this, CONTENT_URI, "My LiveFolder",
    + *                     R.drawable.ic_launcher_contacts_phones));
    + *         } else {
    + *             setResult(RESULT_CANCELED);
    + *         }
    + *
    + *         finish();
    + *     }
    + *
    + *     private static Intent createLiveFolder(Context context, Uri uri, String name,
    + *             int icon) {
    + *
    + *         final Intent intent = new Intent();
    + *
    + *         intent.setData(uri);
    + *         intent.putExtra(LiveFolders.EXTRA_LIVE_FOLDER_NAME, name);
    + *         intent.putExtra(LiveFolders.EXTRA_LIVE_FOLDER_ICON,
    + *                 Intent.ShortcutIconResource.fromContext(context, icon));
    + *         intent.putExtra(LiveFolders.EXTRA_LIVE_FOLDER_DISPLAY_MODE, LiveFolders.DISPLAY_MODE_LIST);
    + *
    + *         return intent;
    + *     }
    + * }
    + * 
    + *

    The live folder is described by an {@link android.content.Intent} as follows:

    + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
    Component Type Description Required
    URIURIThe ContentProvider URIYes
    {@link #EXTRA_LIVE_FOLDER_NAME}Extra StringThe name of the live folderYes
    {@link #EXTRA_LIVE_FOLDER_ICON}Extra {@link android.content.Intent.ShortcutIconResource}The icon of the live folderYes
    {@link #EXTRA_LIVE_FOLDER_DISPLAY_MODE}Extra intThe display mode of the live folder. The value must be either + * {@link #DISPLAY_MODE_GRID} or {@link #DISPLAY_MODE_LIST}.Yes
    {@link #EXTRA_LIVE_FOLDER_BASE_INTENT}Extra IntentWhen the user clicks an item inside a live folder, the system will either fire + * the intent associated with that item or, if present, the live folder's base intent + * with the id of the item appended to the base intent's URI.No
    + * + *

    Setting up the content provider

    + *

    The live folder's content provider must, upon query, return a {@link android.database.Cursor} + * whose columns match the following names:

    + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
    Column Type Description Required
    {@link #NAME}StringThe name of the itemYes
    {@link #DESCRIPTION}StringThe description of the item. The description is ignored when the live folder's + * display mode is {@link #DISPLAY_MODE_GRID}.No
    {@link #INTENT}{@link android.content.Intent}The intent to fire when the item is clicked. Ignored when the live folder defines + * a base intent.No
    {@link #ICON_BITMAP}BitmapThe icon for the item. When this column value is not null, the values for the + * columns {@link #ICON_PACKAGE} and {@link #ICON_RESOURCE} must be null.No
    {@link #ICON_PACKAGE}StringThe package of the item's icon. When this value is not null, the value for the + * column {@link #ICON_RESOURCE} must be specified and the value for the column + * {@link #ICON_BITMAP} must be null.No
    {@link #ICON_RESOURCE}StringThe resource name of the item's icon. When this value is not null, the value for the + * column {@link #ICON_PACKAGE} must be specified and the value for the column + * {@link #ICON_BITMAP} must be null.No
    + */ +public final class LiveFolders implements BaseColumns { + /** + *

    Content provider column.

    + *

    Name of the live folder item.

    + *

    Required.

    + *

    Type: String.

    + */ + public static final String NAME = "name"; + + /** + *

    Content provider column.

    + *

    Description of the live folder item. This value is ignored if the + * live folder's display mode is {@link LiveFolders#DISPLAY_MODE_GRID}.

    + *

    Optional.

    + *

    Type: String.

    + * + * @see LiveFolders#EXTRA_LIVE_FOLDER_DISPLAY_MODE + */ + public static final String DESCRIPTION = "description"; + + /** + *

    Content provider column.

    + *

    Intent of the live folder item.

    + *

    Optional if the live folder has a base intent.

    + *

    Type: {@link android.content.Intent}.

    + * + * @see LiveFolders#EXTRA_LIVE_FOLDER_BASE_INTENT + */ + public static final String INTENT = "intent"; + + /** + *

    Content provider column.

    + *

    Icon of the live folder item, as a custom bitmap.

    + *

    Optional.

    + *

    Type: {@link android.graphics.Bitmap}.

    + */ + public static final String ICON_BITMAP = "icon_bitmap"; + + /** + *

    Content provider column.

    + *

    Package where to find the icon of the live folder item. This value can be + * obtained easily using + * {@link android.content.Intent.ShortcutIconResource#fromContext(android.content.Context, int)}.

    + *

    Optional.

    + *

    Type: String.

    + * + * @see #ICON_RESOURCE + * @see android.content.Intent.ShortcutIconResource + */ + public static final String ICON_PACKAGE = "icon_package"; + + /** + *

    Content provider column.

    + *

    Resource name of the live folder item. This value can be obtained easily using + * {@link android.content.Intent.ShortcutIconResource#fromContext(android.content.Context, int)}.

    + *

    Optional.

    + *

    Type: String.

    + * + * @see #ICON_PACKAGE + * @see android.content.Intent.ShortcutIconResource + */ + public static final String ICON_RESOURCE = "icon_resource"; + + /** + * Displays a live folder's content in a grid. + * + * @see LiveFolders#EXTRA_LIVE_FOLDER_DISPLAY_MODE + */ + public static final int DISPLAY_MODE_GRID = 0x1; + + /** + * Displays a live folder's content in a list. + * + * @see LiveFolders#EXTRA_LIVE_FOLDER_DISPLAY_MODE + */ + public static final int DISPLAY_MODE_LIST = 0x2; + + /** + * The name of the extra used to define the name of a live folder. + * + * @see #ACTION_CREATE_LIVE_FOLDER + */ + public static final String EXTRA_LIVE_FOLDER_NAME = "android.intent.extra.livefolder.NAME"; + + /** + * The name of the extra used to define the icon of a live folder. + * + * @see #ACTION_CREATE_LIVE_FOLDER + */ + public static final String EXTRA_LIVE_FOLDER_ICON = "android.intent.extra.livefolder.ICON"; + + /** + * The name of the extra used to define the display mode of a live folder. + * + * @see #ACTION_CREATE_LIVE_FOLDER + * @see #DISPLAY_MODE_GRID + * @see #DISPLAY_MODE_LIST + */ + public static final String EXTRA_LIVE_FOLDER_DISPLAY_MODE = + "android.intent.extra.livefolder.DISPLAY_MODE"; + + /** + * The name of the extra used to define the base Intent of a live folder. + * + * @see #ACTION_CREATE_LIVE_FOLDER + */ + public static final String EXTRA_LIVE_FOLDER_BASE_INTENT = + "android.intent.extra.livefolder.BASE_INTENT"; + + /** + * Activity Action: Creates a live folder. + *

    Input: Nothing.

    + *

    Output: An Intent representing the live folder. The intent must contain four + * extras: EXTRA_LIVE_FOLDER_NAME (value: String), + * EXTRA_LIVE_FOLDER_ICON (value: ShortcutIconResource), + * EXTRA_LIVE_FOLDER_URI (value: String) and + * EXTRA_LIVE_FOLDER_DISPLAY_MODE (value: int). The Intent can optionnally contain + * EXTRA_LIVE_FOLDER_BASE_INTENT (value: Intent).

    + * + * @see #EXTRA_LIVE_FOLDER_NAME + * @see #EXTRA_LIVE_FOLDER_ICON + * @see #EXTRA_LIVE_FOLDER_DISPLAY_MODE + * @see #EXTRA_LIVE_FOLDER_BASE_INTENT + * @see android.content.Intent.ShortcutIconResource + */ + @SdkConstant(SdkConstant.SdkConstantType.ACTIVITY_INTENT_ACTION) + public static final String ACTION_CREATE_LIVE_FOLDER = + "android.intent.action.CREATE_LIVE_FOLDER"; + + private LiveFolders() { + } +} diff --git a/core/java/android/provider/MediaStore.java b/core/java/android/provider/MediaStore.java index d99ad368d5987..d4b728b437eaa 100644 --- a/core/java/android/provider/MediaStore.java +++ b/core/java/android/provider/MediaStore.java @@ -45,11 +45,70 @@ import java.text.Collator; public final class MediaStore { private final static String TAG = "MediaStore"; - + public static final String AUTHORITY = "media"; - + private static final String CONTENT_AUTHORITY_SLASH = "content://" + AUTHORITY + "/"; - + + /** + * Activity Action: Perform a search for media. + * Contains at least the {@link android.app.SearchManager#QUERY} extra. + * May also contain any combination of the following extras: + * EXTRA_MEDIA_ARTIST, EXTRA_MEDIA_ALBUM, EXTRA_MEDIA_TITLE, EXTRA_MEDIA_FOCUS + * + * @see android.provider.MediaStore#EXTRA_MEDIA_ARTIST + * @see android.provider.MediaStore#EXTRA_MEDIA_ALBUM + * @see android.provider.MediaStore#EXTRA_MEDIA_TITLE + * @see android.provider.MediaStore#EXTRA_MEDIA_FOCUS + */ + @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) + public static final String INTENT_ACTION_MEDIA_SEARCH = "android.intent.action.MEDIA_SEARCH"; + + /** + * The name of the Intent-extra used to define the artist + */ + public static final String EXTRA_MEDIA_ARTIST = "android.intent.extra.artist"; + /** + * The name of the Intent-extra used to define the album + */ + public static final String EXTRA_MEDIA_ALBUM = "android.intent.extra.album"; + /** + * The name of the Intent-extra used to define the song title + */ + public static final String EXTRA_MEDIA_TITLE = "android.intent.extra.title"; + /** + * The name of the Intent-extra used to define the search focus. The search focus + * indicates whether the search should be for things related to the artist, album + * or song that is identified by the other extras. + */ + public static final String EXTRA_MEDIA_FOCUS = "android.intent.extra.focus"; + + /** + * The name of the Intent-extra used to control the orientation of a MovieView. + * This is an int property that overrides the MovieView activity's requestedOrientation. + * @see android.content.pm.ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED + */ + public static final String EXTRA_SCREEN_ORIENTATION = "android.intent.extra.screenOrientation"; + + /** + * The name of the Intent-extra used to control the onCompletion behavior of a MovieView. + * This is a boolean property that specifies whether or not to finish the MovieView activity + * when the movie completes playing. The default value is true, which means to automatically + * exit the movie player activity when the movie completes playing. + */ + public static final String EXTRA_FINISH_ON_COMPLETION = "android.intent.extra.finishOnCompletion"; + + /** + * The name of the Intent action used to launch a camera in still image mode. + */ + public static final String INTENT_ACTION_STILL_IMAGE_CAMERA = "android.media.action.STILL_IMAGE_CAMERA"; + + + /** + * The name of the Intent action used to launch a camera in video mode. + */ + public static final String INTENT_ACTION_VIDEO_CAMERA = "android.media.action.VIDEO_CAMERA"; + /** * Standard Intent action that can be sent to have the media application * capture an image and return it. The image is returned as a Bitmap @@ -57,11 +116,11 @@ public final class MediaStore * @hide */ public final static String ACTION_IMAGE_CAPTURE = "android.media.action.IMAGE_CAPTURE"; - - /** + + /** * Common fields for most MediaProvider tables */ - + public interface MediaColumns extends BaseColumns { /** * The data stream for the file @@ -108,7 +167,7 @@ public final class MediaStore */ public static final String MIME_TYPE = "mime_type"; } - + /** * Contains meta data for all available images. */ @@ -120,19 +179,19 @@ public final class MediaStore *

    Type: TEXT

    */ public static final String DESCRIPTION = "description"; - + /** * The picasa id of the image *

    Type: TEXT

    */ public static final String PICASA_ID = "picasa_id"; - + /** * Whether the video should be published as public or private *

    Type: INTEGER

    */ public static final String IS_PRIVATE = "isprivate"; - + /** * The latitude where the image was captured. *

    Type: DOUBLE

    @@ -144,14 +203,14 @@ public final class MediaStore *

    Type: DOUBLE

    */ public static final String LONGITUDE = "longitude"; - + /** * The date & time that the image was taken in units * of milliseconds since jan 1, 1970. *

    Type: INTEGER

    */ public static final String DATE_TAKEN = "datetaken"; - + /** * The orientation for the image expressed as degrees. * Only degrees 0, 90, 180, 270 will work. @@ -164,15 +223,17 @@ public final class MediaStore *

    Type: INTEGER

    */ public static final String MINI_THUMB_MAGIC = "mini_thumb_magic"; - + /** - * The bucket id of the image + * The bucket id of the image. This is a read-only property that + * is automatically computed from the DATA column. *

    Type: TEXT

    */ public static final String BUCKET_ID = "bucket_id"; - + /** - * The bucket display name of the image + * The bucket display name of the image. This is a read-only property that + * is automatically computed from the DATA column. *

    Type: TEXT

    */ public static final String BUCKET_DISPLAY_NAME = "bucket_display_name"; @@ -183,14 +244,14 @@ public final class MediaStore { return cr.query(uri, projection, null, null, DEFAULT_SORT_ORDER); } - + public static final Cursor query(ContentResolver cr, Uri uri, String[] projection, String where, String orderBy) { return cr.query(uri, projection, where, null, orderBy == null ? DEFAULT_SORT_ORDER : orderBy); } - + public static final Cursor query(ContentResolver cr, Uri uri, String[] projection, String selection, String [] selectionArgs, String orderBy) { @@ -200,7 +261,7 @@ public final class MediaStore /** * Retrieves an image for the given url as a {@link Bitmap}. - * + * * @param cr The content resolver to use * @param url The url of the image * @throws FileNotFoundException @@ -214,10 +275,10 @@ public final class MediaStore input.close(); return bitmap; } - + /** * Insert an image and create a thumbnail for it. - * + * * @param cr The content resolver to use * @param imagePath The path to the image to insert * @param name The name of the image @@ -239,38 +300,38 @@ public final class MediaStore } } } - + private static final Bitmap StoreThumbnail( - ContentResolver cr, + ContentResolver cr, Bitmap source, long id, - float width, float height, + float width, float height, int kind) { // create the matrix to scale it Matrix matrix = new Matrix(); - + float scaleX = width / source.getWidth(); float scaleY = height / source.getHeight(); - + matrix.setScale(scaleX, scaleY); - - Bitmap thumb = Bitmap.createBitmap(source, 0, 0, + + Bitmap thumb = Bitmap.createBitmap(source, 0, 0, source.getWidth(), source.getHeight(), matrix, true); - + ContentValues values = new ContentValues(4); values.put(Images.Thumbnails.KIND, kind); values.put(Images.Thumbnails.IMAGE_ID, (int)id); values.put(Images.Thumbnails.HEIGHT, thumb.getHeight()); values.put(Images.Thumbnails.WIDTH, thumb.getWidth()); - + Uri url = cr.insert(Images.Thumbnails.EXTERNAL_CONTENT_URI, values); - + try { OutputStream thumbOut = cr.openOutputStream(url); - - thumb.compress(Bitmap.CompressFormat.JPEG, 100, thumbOut); + + thumb.compress(Bitmap.CompressFormat.JPEG, 100, thumbOut); thumbOut.close(); return thumb; } @@ -281,10 +342,10 @@ public final class MediaStore return null; } } - + /** * Insert an image and create a thumbnail for it. - * + * * @param cr The content resolver to use * @param source The stream to use for the image * @param title The name of the image @@ -306,7 +367,7 @@ public final class MediaStore try { url = cr.insert(EXTERNAL_CONTENT_URI, values); - + if (source != null) { OutputStream imageOut = cr.openOutputStream(url); try { @@ -337,11 +398,11 @@ public final class MediaStore return stringUrl; } - + /** - * Get the content:// style URI for the image media table on the + * Get the content:// style URI for the image media table on the * given volume. - * + * * @param volumeName the name of the volume to get the URI for * @return the URI to the image media table on the given volume */ @@ -355,7 +416,7 @@ public final class MediaStore */ public static final Uri INTERNAL_CONTENT_URI = getContentUri("internal"); - + /** * The content:// style URI for the "primary" external storage * volume. @@ -369,7 +430,7 @@ public final class MediaStore * image MIME type as appropriate -- for example, image/jpeg. */ public static final String CONTENT_TYPE = "vnd.android.cursor.dir/image"; - + /** * The default sort order for this table */ @@ -382,23 +443,23 @@ public final class MediaStore { return cr.query(uri, projection, null, null, DEFAULT_SORT_ORDER); } - + public static final Cursor queryMiniThumbnails(ContentResolver cr, Uri uri, int kind, String[] projection) { return cr.query(uri, projection, "kind = " + kind, null, DEFAULT_SORT_ORDER); } - + public static final Cursor queryMiniThumbnail(ContentResolver cr, long origId, int kind, String[] projection) { return cr.query(EXTERNAL_CONTENT_URI, projection, IMAGE_ID + " = " + origId + " AND " + KIND + " = " + kind, null, null); } - + /** - * Get the content:// style URI for the image media table on the + * Get the content:// style URI for the image media table on the * given volume. - * + * * @param volumeName the name of the volume to get the URI for * @return the URI to the image media table on the given volume */ @@ -406,13 +467,13 @@ public final class MediaStore return Uri.parse(CONTENT_AUTHORITY_SLASH + volumeName + "/images/thumbnails"); } - + /** * The content:// style URI for the internal storage. */ public static final Uri INTERNAL_CONTENT_URI = getContentUri("internal"); - + /** * The content:// style URI for the "primary" external storage * volume. @@ -424,35 +485,35 @@ public final class MediaStore * The default sort order for this table */ public static final String DEFAULT_SORT_ORDER = "image_id ASC"; - + /** * The data stream for the thumbnail *

    Type: DATA STREAM

    */ public static final String DATA = "_data"; - + /** * The original image for the thumbnal *

    Type: INTEGER (ID from Images table)

    */ public static final String IMAGE_ID = "image_id"; - + /** * The kind of the thumbnail *

    Type: INTEGER (One of the values below)

    */ public static final String KIND = "kind"; - + public static final int MINI_KIND = 1; public static final int FULL_SCREEN_KIND = 2; public static final int MICRO_KIND = 3; - + /** * The width of the thumbnal *

    Type: INTEGER (long)

    */ public static final String WIDTH = "width"; - + /** * The height of the thumbnail *

    Type: INTEGER (long)

    @@ -460,7 +521,7 @@ public final class MediaStore public static final String HEIGHT = "height"; } } - + /** * Container for all audio content. */ @@ -532,7 +593,7 @@ public final class MediaStore *

    Type: TEXT

    */ public static final String ALBUM_ART = "album_art"; - + /** * The track number of this song on the album, if any. * This number encodes both the track number and the @@ -632,9 +693,9 @@ public final class MediaStore public static final class Media implements AudioColumns { /** - * Get the content:// style URI for the audio media table on the + * Get the content:// style URI for the audio media table on the * given volume. - * + * * @param volumeName the name of the volume to get the URI for * @return the URI to the audio media table on the given volume */ @@ -642,46 +703,56 @@ public final class MediaStore return Uri.parse(CONTENT_AUTHORITY_SLASH + volumeName + "/audio/media"); } - + public static Uri getContentUriForPath(String path) { return (path.startsWith(Environment.getExternalStorageDirectory().getPath()) ? EXTERNAL_CONTENT_URI : INTERNAL_CONTENT_URI); } - + /** * The content:// style URI for the internal storage. */ public static final Uri INTERNAL_CONTENT_URI = getContentUri("internal"); - + /** * The content:// style URI for the "primary" external storage * volume. */ public static final Uri EXTERNAL_CONTENT_URI = getContentUri("external"); - + /** * The MIME type for this table. */ public static final String CONTENT_TYPE = "vnd.android.cursor.dir/audio"; - + /** * The default sort order for this table */ public static final String DEFAULT_SORT_ORDER = TITLE; - + /** * Activity Action: Start SoundRecorder application. *

    Input: nothing. *

    Output: An uri to the recorded sound stored in the Media Library * if the recording was successful. - * + * May also contain the extra EXTRA_MAX_BYTES. + * @see #EXTRA_MAX_BYTES */ - public static final String RECORD_SOUND_ACTION = + public static final String RECORD_SOUND_ACTION = "android.provider.MediaStore.RECORD_SOUND"; + + /** + * The name of the Intent-extra used to define a maximum file size for + * a recording made by the SoundRecorder application. + * + * @see #RECORD_SOUND_ACTION + */ + public static final String EXTRA_MAX_BYTES = + "android.provider.MediaStore.extra.MAX_BYTES"; } - + /** * Columns representing an audio genre */ @@ -698,9 +769,9 @@ public final class MediaStore */ public static final class Genres implements BaseColumns, GenresColumns { /** - * Get the content:// style URI for the audio genres table on the + * Get the content:// style URI for the audio genres table on the * given volume. - * + * * @param volumeName the name of the volume to get the URI for * @return the URI to the audio genres table on the given volume */ @@ -714,7 +785,7 @@ public final class MediaStore */ public static final Uri INTERNAL_CONTENT_URI = getContentUri("internal"); - + /** * The content:// style URI for the "primary" external storage * volume. @@ -726,7 +797,7 @@ public final class MediaStore * The MIME type for this table. */ public static final String CONTENT_TYPE = "vnd.android.cursor.dir/genre"; - + /** * The MIME type for entries in this table. */ @@ -794,7 +865,7 @@ public final class MediaStore *

    Type: INTEGER (long)

    */ public static final String DATE_ADDED = "date_added"; - + /** * The time the file was last modified * Units are seconds since 1970. @@ -803,16 +874,16 @@ public final class MediaStore */ public static final String DATE_MODIFIED = "date_modified"; } - + /** * Contains playlists for audio files */ public static final class Playlists implements BaseColumns, PlaylistsColumns { /** - * Get the content:// style URI for the audio playlists table on the + * Get the content:// style URI for the audio playlists table on the * given volume. - * + * * @param volumeName the name of the volume to get the URI for * @return the URI to the audio playlists table on the given volume */ @@ -826,7 +897,7 @@ public final class MediaStore */ public static final Uri INTERNAL_CONTENT_URI = getContentUri("internal"); - + /** * The content:// style URI for the "primary" external storage * volume. @@ -838,7 +909,7 @@ public final class MediaStore * The MIME type for this table. */ public static final String CONTENT_TYPE = "vnd.android.cursor.dir/playlist"; - + /** * The MIME type for entries in this table. */ @@ -863,7 +934,7 @@ public final class MediaStore * The ID within the playlist. */ public static final String _ID = "_id"; - + /** * A subdirectory of each playlist containing all member audio * files. @@ -881,7 +952,7 @@ public final class MediaStore *

    Type: INTEGER (long)

    */ public static final String PLAYLIST_ID = "playlist_id"; - + /** * The order of the songs in the playlist *

    Type: INTEGER (long)>

    @@ -922,15 +993,15 @@ public final class MediaStore */ public static final String NUMBER_OF_TRACKS = "number_of_tracks"; } - + /** * Contains artists for audio files */ public static final class Artists implements BaseColumns, ArtistColumns { /** - * Get the content:// style URI for the artists table on the + * Get the content:// style URI for the artists table on the * given volume. - * + * * @param volumeName the name of the volume to get the URI for * @return the URI to the audio artists table on the given volume */ @@ -944,7 +1015,7 @@ public final class MediaStore */ public static final Uri INTERNAL_CONTENT_URI = getContentUri("internal"); - + /** * The content:// style URI for the "primary" external storage * volume. @@ -956,7 +1027,7 @@ public final class MediaStore * The MIME type for this table. */ public static final String CONTENT_TYPE = "vnd.android.cursor.dir/artists"; - + /** * The MIME type for entries in this table. */ @@ -979,7 +1050,7 @@ public final class MediaStore } } } - + /** * Columns representing an album */ @@ -1009,6 +1080,16 @@ public final class MediaStore */ public static final String NUMBER_OF_SONGS = "numsongs"; + /** + * This column is available when getting album info via artist, + * and indicates the number of songs on the album by the given + * artist. + *

    Type: INTEGER

    + * + * @hide pending API Council approval + */ + public static final String NUMBER_OF_SONGS_FOR_ARTIST = "numsongs_by_artist"; + /** * The year in which the earliest and latest songs * on this album were released. These will often @@ -1025,22 +1106,22 @@ public final class MediaStore *

    Type: TEXT

    */ public static final String ALBUM_KEY = "album_key"; - + /** * Cached album art. *

    Type: TEXT

    */ public static final String ALBUM_ART = "album_art"; } - + /** * Contains artists for audio files */ public static final class Albums implements BaseColumns, AlbumColumns { /** - * Get the content:// style URI for the albums table on the + * Get the content:// style URI for the albums table on the * given volume. - * + * * @param volumeName the name of the volume to get the URI for * @return the URI to the audio albums table on the given volume */ @@ -1054,7 +1135,7 @@ public final class MediaStore */ public static final Uri INTERNAL_CONTENT_URI = getContentUri("internal"); - + /** * The content:// style URI for the "primary" external storage * volume. @@ -1066,7 +1147,7 @@ public final class MediaStore * The MIME type for this table. */ public static final String CONTENT_TYPE = "vnd.android.cursor.dir/albums"; - + /** * The MIME type for entries in this table. */ @@ -1145,7 +1226,7 @@ public final class MediaStore *

    Type: TEXT

    */ public static final String LANGUAGE = "language"; - + /** * The latitude where the image was captured. *

    Type: DOUBLE

    @@ -1157,7 +1238,7 @@ public final class MediaStore *

    Type: DOUBLE

    */ public static final String LONGITUDE = "longitude"; - + /** * The date & time that the image was taken in units * of milliseconds since jan 1, 1970. @@ -1170,13 +1251,27 @@ public final class MediaStore *

    Type: INTEGER

    */ public static final String MINI_THUMB_MAGIC = "mini_thumb_magic"; + + /** + * The bucket id of the video. This is a read-only property that + * is automatically computed from the DATA column. + *

    Type: TEXT

    + */ + public static final String BUCKET_ID = "bucket_id"; + + /** + * The bucket display name of the video. This is a read-only property that + * is automatically computed from the DATA column. + *

    Type: TEXT

    + */ + public static final String BUCKET_DISPLAY_NAME = "bucket_display_name"; } public static final class Media implements VideoColumns { /** - * Get the content:// style URI for the video media table on the + * Get the content:// style URI for the video media table on the * given volume. - * + * * @param volumeName the name of the volume to get the URI for * @return the URI to the video media table on the given volume */ @@ -1190,7 +1285,7 @@ public final class MediaStore */ public static final Uri INTERNAL_CONTENT_URI = getContentUri("internal"); - + /** * The content:// style URI for the "primary" external storage * volume. diff --git a/core/java/android/provider/SearchRecentSuggestions.java b/core/java/android/provider/SearchRecentSuggestions.java index 1439b2649e2dd..0632d9498b84d 100644 --- a/core/java/android/provider/SearchRecentSuggestions.java +++ b/core/java/android/provider/SearchRecentSuggestions.java @@ -190,6 +190,11 @@ public class SearchRecentSuggestions { /** * Completely delete the history. Use this call to implement a "clear history" UI. + * + * Any application that implements search suggestions based on previous actions (such as + * recent queries, page/items viewed, etc.) should provide a way for the user to clear the + * history. This gives the user a measure of privacy, if they do not wish for their recent + * searches to be replayed by other users of the device (via suggestions). */ public void clearHistory() { ContentResolver cr = mContext.getContentResolver(); diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java index 6897bd564a8ab..e93bbeb95cc0d 100644 --- a/core/java/android/provider/Settings.java +++ b/core/java/android/provider/Settings.java @@ -40,6 +40,7 @@ import android.util.Log; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.util.HashMap; +import java.util.HashSet; /** @@ -99,6 +100,20 @@ public final class Settings { public static final String ACTION_WIRELESS_SETTINGS = "android.settings.WIRELESS_SETTINGS"; + /** + * Activity Action: Show settings to allow entering/exiting airplane mode. + *

    + * In some cases, a matching Activity may not exist, so ensure you + * safeguard against this. + *

    + * Input: Nothing. + *

    + * Output: Nothing. + */ + @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) + public static final String ACTION_AIRPLANE_MODE_SETTINGS = + "android.settings.AIRPLANE_MODE_SETTINGS"; + /** * Activity Action: Show settings to allow configuration of security and * location privacy. @@ -116,6 +131,7 @@ public final class Settings { /** * Activity Action: Show settings to allow configuration of Wi-Fi. + *

    * In some cases, a matching Activity may not exist, so ensure you * safeguard against this. @@ -123,10 +139,26 @@ public final class Settings { * Input: Nothing. *

    * Output: Nothing. + */ @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) public static final String ACTION_WIFI_SETTINGS = "android.settings.WIFI_SETTINGS"; + + /** + * Activity Action: Show settings to allow configuration of a static IP + * address for Wi-Fi. + *

    + * In some cases, a matching Activity may not exist, so ensure you safeguard + * against this. + *

    + * Input: Nothing. + *

    + * Output: Nothing. + */ + @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) + public static final String ACTION_WIFI_IP_SETTINGS = + "android.settings.WIFI_IP_SETTINGS"; /** * Activity Action: Show settings to allow configuration of Bluetooth. @@ -213,7 +245,50 @@ public final class Settings { "android.settings.APPLICATION_SETTINGS"; /** - * Activity Action: Show settings to allow configuration of sync settings. + * Activity Action: Show settings to allow configuration of application + * development-related settings. + *

    + * In some cases, a matching Activity may not exist, so ensure you safeguard + * against this. + *

    + * Input: Nothing. + *

    + * Output: Nothing. + */ + @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) + public static final String ACTION_APPLICATION_DEVELOPMENT_SETTINGS = + "android.settings.APPLICATION_DEVELOPMENT_SETTINGS"; + + /** + * Activity Action: Show settings to allow configuration of quick launch shortcuts. + *

    + * In some cases, a matching Activity may not exist, so ensure you + * safeguard against this. + *

    + * Input: Nothing. + *

    + * Output: Nothing. + */ + @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) + public static final String ACTION_QUICK_LAUNCH_SETTINGS = + "android.settings.QUICK_LAUNCH_SETTINGS"; + + /** + * Activity Action: Show settings to manage installed applications. + *

    + * In some cases, a matching Activity may not exist, so ensure you + * safeguard against this. + *

    + * Input: Nothing. + *

    + * Output: Nothing. + */ + @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) + public static final String ACTION_MANAGE_APPLICATIONS_SETTINGS = + "android.settings.MANAGE_APPLICATIONS_SETTINGS"; + + /** + * Activity Action: Show settings for system update functionality. *

    * In some cases, a matching Activity may not exist, so ensure you * safeguard against this. @@ -225,9 +300,78 @@ public final class Settings { * @hide */ @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) + public static final String ACTION_SYSTEM_UPDATE_SETTINGS = + "android.settings.SYSTEM_UPDATE_SETTINGS"; + + /** + * Activity Action: Show settings to allow configuration of sync settings. + *

    + * In some cases, a matching Activity may not exist, so ensure you + * safeguard against this. + *

    + * Input: Nothing. + *

    + * Output: Nothing. + */ + @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) public static final String ACTION_SYNC_SETTINGS = "android.settings.SYNC_SETTINGS"; + /** + * Activity Action: Show settings for selecting the network operator. + *

    + * In some cases, a matching Activity may not exist, so ensure you + * safeguard against this. + *

    + * Input: Nothing. + *

    + * Output: Nothing. + */ + @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) + public static final String ACTION_NETWORK_OPERATOR_SETTINGS = + "android.settings.NETWORK_OPERATOR_SETTINGS"; + + /** + * Activity Action: Show settings for selection of 2G/3G. + *

    + * In some cases, a matching Activity may not exist, so ensure you + * safeguard against this. + *

    + * Input: Nothing. + *

    + * Output: Nothing. + */ + @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) + public static final String ACTION_DATA_ROAMING_SETTINGS = + "android.settings.DATA_ROAMING_SETTINGS"; + + /** + * Activity Action: Show settings for internal storage. + *

    + * In some cases, a matching Activity may not exist, so ensure you + * safeguard against this. + *

    + * Input: Nothing. + *

    + * Output: Nothing. + */ + @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) + public static final String ACTION_INTERNAL_STORAGE_SETTINGS = + "android.settings.INTERNAL_STORAGE_SETTINGS"; + /** + * Activity Action: Show settings for memory card storage. + *

    + * In some cases, a matching Activity may not exist, so ensure you + * safeguard against this. + *

    + * Input: Nothing. + *

    + * Output: Nothing. + */ + @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) + public static final String ACTION_MEMORY_CARD_SETTINGS = + "android.settings.MEMORY_CARD_SETTINGS"; + // End of Intent actions for Settings private static final String JID_RESOURCE_PREFIX = "android"; @@ -246,8 +390,6 @@ public final class Settings { /** * Common base for tables of name/value settings. - * - * */ public static class NameValueTable implements BaseColumns { public static final String NAME = "name"; @@ -296,7 +438,7 @@ public final class Settings { try { c = cr.query(mUri, new String[] { Settings.NameValueTable.VALUE }, Settings.NameValueTable.NAME + "=?", new String[]{name}, null); - if (c.moveToNext()) value = c.getString(0); + if (c != null && c.moveToNext()) value = c.getString(0); mValues.put(name, value); } catch (SQLException e) { // SQL error: return null, but don't cache it. @@ -320,6 +462,41 @@ public final class Settings { public static final String SYS_PROP_SETTING_VERSION = "sys.settings_system_version"; private static volatile NameValueCache mNameValueCache = null; + + private static final HashSet MOVED_TO_SECURE; + static { + MOVED_TO_SECURE = new HashSet(30); + MOVED_TO_SECURE.add(Secure.ADB_ENABLED); + MOVED_TO_SECURE.add(Secure.ANDROID_ID); + MOVED_TO_SECURE.add(Secure.BLUETOOTH_ON); + MOVED_TO_SECURE.add(Secure.DATA_ROAMING); + MOVED_TO_SECURE.add(Secure.DEVICE_PROVISIONED); + MOVED_TO_SECURE.add(Secure.HTTP_PROXY); + MOVED_TO_SECURE.add(Secure.INSTALL_NON_MARKET_APPS); + MOVED_TO_SECURE.add(Secure.LOCATION_PROVIDERS_ALLOWED); + MOVED_TO_SECURE.add(Secure.LOGGING_ID); + MOVED_TO_SECURE.add(Secure.PARENTAL_CONTROL_ENABLED); + MOVED_TO_SECURE.add(Secure.PARENTAL_CONTROL_LAST_UPDATE); + MOVED_TO_SECURE.add(Secure.PARENTAL_CONTROL_REDIRECT_URL); + MOVED_TO_SECURE.add(Secure.SETTINGS_CLASSNAME); + MOVED_TO_SECURE.add(Secure.USB_MASS_STORAGE_ENABLED); + MOVED_TO_SECURE.add(Secure.USE_GOOGLE_MAIL); + MOVED_TO_SECURE.add(Secure.WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON); + MOVED_TO_SECURE.add(Secure.WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY); + MOVED_TO_SECURE.add(Secure.WIFI_NUM_OPEN_NETWORKS_KEPT); + MOVED_TO_SECURE.add(Secure.WIFI_ON); + MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_ACCEPTABLE_PACKET_LOSS_PERCENTAGE); + MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_AP_COUNT); + MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_BACKGROUND_CHECK_DELAY_MS); + MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_BACKGROUND_CHECK_ENABLED); + MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_BACKGROUND_CHECK_TIMEOUT_MS); + MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_INITIAL_IGNORED_PING_COUNT); + MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_MAX_AP_CHECKS); + MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_ON); + MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_PING_COUNT); + MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_PING_DELAY_MS); + MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_PING_TIMEOUT_MS); + } /** * Look up a name in the database. @@ -328,6 +505,11 @@ public final class Settings { * @return the corresponding value, or null if not present */ public synchronized static String getString(ContentResolver resolver, String name) { + if (MOVED_TO_SECURE.contains(name)) { + Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.System" + + " to android.provider.Settings.Secure, returning read-only value."); + return Secure.getString(resolver, name); + } if (mNameValueCache == null) { mNameValueCache = new NameValueCache(SYS_PROP_SETTING_VERSION, CONTENT_URI); } @@ -341,8 +523,12 @@ public final class Settings { * @param value to associate with the name * @return true if the value was set, false on database errors */ - public static boolean putString(ContentResolver resolver, - String name, String value) { + public static boolean putString(ContentResolver resolver, String name, String value) { + if (MOVED_TO_SECURE.contains(name)) { + Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.System" + + " to android.provider.Settings.Secure, value is unchanged."); + return false; + } return putString(resolver, CONTENT_URI, name, value); } @@ -353,6 +539,11 @@ public final class Settings { * @return the corresponding content URI, or null if not present */ public static Uri getUriFor(String name) { + if (MOVED_TO_SECURE.contains(name)) { + Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.System" + + " to android.provider.Settings.Secure, returning Secure URI."); + return Secure.getUriFor(Secure.CONTENT_URI, name); + } return getUriFor(CONTENT_URI, name); } @@ -424,6 +615,75 @@ public final class Settings { return putString(cr, name, Integer.toString(value)); } + /** + * Convenience function for retrieving a single system settings value + * as a {@code long}. Note that internally setting values are always + * stored as strings; this function converts the string to a {@code long} + * for you. The default value will be returned if the setting is + * not defined or not a {@code long}. + * + * @param cr The ContentResolver to access. + * @param name The name of the setting to retrieve. + * @param def Value to return if the setting is not defined. + * + * @return The setting's current value, or 'def' if it is not defined + * or not a valid {@code long}. + */ + public static long getLong(ContentResolver cr, String name, long def) { + String valString = getString(cr, name); + long value; + try { + value = valString != null ? Long.parseLong(valString) : def; + } catch (NumberFormatException e) { + value = def; + } + return value; + } + + /** + * Convenience function for retrieving a single system settings value + * as a {@code long}. Note that internally setting values are always + * stored as strings; this function converts the string to a {@code long} + * for you. + *

    + * This version does not take a default value. If the setting has not + * been set, or the string value is not a number, + * it throws {@link SettingNotFoundException}. + * + * @param cr The ContentResolver to access. + * @param name The name of the setting to retrieve. + * + * @return The setting's current value. + * @throws SettingNotFoundException Thrown if a setting by the given + * name can't be found or the setting value is not an integer. + */ + public static long getLong(ContentResolver cr, String name) + throws SettingNotFoundException { + String valString = getString(cr, name); + try { + return Long.parseLong(valString); + } catch (NumberFormatException e) { + throw new SettingNotFoundException(name); + } + } + + /** + * Convenience function for updating a single settings value as a long + * integer. This will either create a new entry in the table if the + * given name does not exist, or modify the value of the existing row + * with that name. Note that internally setting values are always + * stored as strings, so this function converts the given value to a + * string before storing it. + * + * @param cr The ContentResolver to access. + * @param name The name of the setting to modify. + * @param value The new value for the setting. + * @return true if the value was set, false on database errors + */ + public static boolean putLong(ContentResolver cr, String name, long value) { + return putString(cr, name, Long.toString(value)); + } + /** * Convenience function for retrieving a single system settings value * as a floating point number. Note that internally setting values are @@ -536,7 +796,13 @@ public final class Settings { /** * Whether we keep the device on while the device is plugged in. - * 0=no 1=yes + * Supported values are: + *

      + *
    • {@code 0} to never stay on while plugged in
    • + *
    • {@link BatteryManager#BATTERY_PLUGGED_AC} to stay on for AC charger
    • + *
    • {@link BatteryManager#BATTERY_PLUGGED_USB} to stay on for USB charger
    • + *
    + * These values can be OR-ed together. */ public static final String STAY_ON_WHILE_PLUGGED_IN = "stay_on_while_plugged_in"; @@ -580,190 +846,97 @@ public final class Settings { public static final String AIRPLANE_MODE_RADIOS = "airplane_mode_radios"; /** - * Whether the Wi-Fi should be on. Only the Wi-Fi service should touch this. + * The interval in milliseconds after which Wi-Fi is considered idle. + * When idle, it is possible for the device to be switched from Wi-Fi to + * the mobile data network. + * + * @hide pending API Council approval */ - public static final String WIFI_ON = "wifi_on"; + public static final String WIFI_IDLE_MS = "wifi_idle_ms"; /** - * Whether to notify the user of open networks. + * Whether to use static IP and other static network attributes. *

    - * If not connected and the scan results have an open network, we will - * put this notification up. If we attempt to connect to a network or - * the open network(s) disappear, we remove the notification. When we - * show the notification, we will not show it again for - * {@link #WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY} time. + * Set to 1 for true and 0 for false. */ - public static final String WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON = - "wifi_networks_available_notification_on"; + public static final String WIFI_USE_STATIC_IP = "wifi_use_static_ip"; /** - * Delay (in seconds) before repeating the Wi-Fi networks available notification. - * Connecting to a network will reset the timer. + * The static IP address. + *

    + * Example: "192.168.1.51" */ - public static final String WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY = - "wifi_networks_available_repeat_delay"; + public static final String WIFI_STATIC_IP = "wifi_static_ip"; /** - * When the number of open networks exceeds this number, the - * least-recently-used excess networks will be removed. + * If using static IP, the gateway's IP address. + *

    + * Example: "192.168.1.1" */ - public static final String WIFI_NUM_OPEN_NETWORKS_KEPT = "wifi_num_open_networks_kept"; + public static final String WIFI_STATIC_GATEWAY = "wifi_static_gateway"; /** - * Whether the Wi-Fi watchdog is enabled. + * If using static IP, the net mask. + *

    + * Example: "255.255.255.0" */ - public static final String WIFI_WATCHDOG_ON = "wifi_watchdog_on"; + public static final String WIFI_STATIC_NETMASK = "wifi_static_netmask"; /** - * The number of access points required for a network in order for the - * watchdog to monitor it. + * If using static IP, the primary DNS's IP address. + *

    + * Example: "192.168.1.1" */ - public static final String WIFI_WATCHDOG_AP_COUNT = "wifi_watchdog_ap_count"; + public static final String WIFI_STATIC_DNS1 = "wifi_static_dns1"; /** - * The number of initial pings to perform that *may* be ignored if they - * fail. Again, if these fail, they will *not* be used in packet loss - * calculation. For example, one network always seemed to time out for - * the first couple pings, so this is set to 3 by default. + * If using static IP, the secondary DNS's IP address. + *

    + * Example: "192.168.1.2" */ - public static final String WIFI_WATCHDOG_INITIAL_IGNORED_PING_COUNT = "wifi_watchdog_initial_ignored_ping_count"; - + public static final String WIFI_STATIC_DNS2 = "wifi_static_dns2"; + /** - * The number of pings to test if an access point is a good connection. + * The number of radio channels that are allowed in the local + * 802.11 regulatory domain. + * @hide */ - public static final String WIFI_WATCHDOG_PING_COUNT = "wifi_watchdog_ping_count"; - + public static final String WIFI_NUM_ALLOWED_CHANNELS = "wifi_num_allowed_channels"; + /** - * The timeout per ping. + * Determines whether remote devices may discover and/or connect to + * this device. + *

    Type: INT

    + * 2 -- discoverable and connectable + * 1 -- connectable but not discoverable + * 0 -- neither connectable nor discoverable */ - public static final String WIFI_WATCHDOG_PING_TIMEOUT_MS = "wifi_watchdog_ping_timeout_ms"; + public static final String BLUETOOTH_DISCOVERABILITY = + "bluetooth_discoverability"; /** - * The delay between pings. + * Bluetooth discoverability timeout. If this value is nonzero, then + * Bluetooth becomes discoverable for a certain number of seconds, + * after which is becomes simply connectable. The value is in seconds. */ - public static final String WIFI_WATCHDOG_PING_DELAY_MS = "wifi_watchdog_ping_delay_ms"; + public static final String BLUETOOTH_DISCOVERABILITY_TIMEOUT = + "bluetooth_discoverability_timeout"; /** - * The acceptable packet loss percentage (range 0 - 100) before trying - * another AP on the same network. + * Whether autolock is enabled (0 = false, 1 = true) */ - public static final String WIFI_WATCHDOG_ACCEPTABLE_PACKET_LOSS_PERCENTAGE = - "wifi_watchdog_acceptable_packet_loss_percentage"; + public static final String LOCK_PATTERN_ENABLED = "lock_pattern_autolock"; /** - * The maximum number of access points (per network) to attempt to test. - * If this number is reached, the watchdog will no longer monitor the - * initial connection state for the network. This is a safeguard for - * networks containing multiple APs whose DNS does not respond to pings. - */ - public static final String WIFI_WATCHDOG_MAX_AP_CHECKS = "wifi_watchdog_max_ap_checks"; - - /** - * Whether the Wi-Fi watchdog is enabled for background checking even - * after it thinks the user has connected to a good access point. - */ - public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_ENABLED = - "wifi_watchdog_background_check_enabled"; - - /** - * The timeout for a background ping - */ - public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_TIMEOUT_MS = - "wifi_watchdog_background_check_timeout_ms"; - - /** - * The delay between background checks. - */ - public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_DELAY_MS = - "wifi_watchdog_background_check_delay_ms"; - - /** - * Whether to use static IP and other static network attributes. - *

    - * Set to 1 for true and 0 for false. - */ - public static final String WIFI_USE_STATIC_IP = "wifi_use_static_ip"; - - /** - * The static IP address. - *

    - * Example: "192.168.1.51" - */ - public static final String WIFI_STATIC_IP = "wifi_static_ip"; - - /** - * If using static IP, the gateway's IP address. - *

    - * Example: "192.168.1.1" - */ - public static final String WIFI_STATIC_GATEWAY = "wifi_static_gateway"; - - /** - * If using static IP, the net mask. - *

    - * Example: "255.255.255.0" - */ - public static final String WIFI_STATIC_NETMASK = "wifi_static_netmask"; - - /** - * If using static IP, the primary DNS's IP address. - *

    - * Example: "192.168.1.1" - */ - public static final String WIFI_STATIC_DNS1 = "wifi_static_dns1"; - - /** - * If using static IP, the secondary DNS's IP address. - *

    - * Example: "192.168.1.2" - */ - public static final String WIFI_STATIC_DNS2 = "wifi_static_dns2"; - - /** - * User preference for which network(s) should be used. Only the - * connectivity service should touch this. - */ - public static final String NETWORK_PREFERENCE = "network_preference"; - - /** - * Whether bluetooth is enabled/disabled - * 0=disabled. 1=enabled. - */ - public static final String BLUETOOTH_ON = "bluetooth_on"; - - /** - * Determines whether remote devices may discover and/or connect to - * this device. - *

    Type: INT

    - * 2 -- discoverable and connectable - * 1 -- connectable but not discoverable - * 0 -- neither connectable nor discoverable - */ - public static final String BLUETOOTH_DISCOVERABILITY = - "bluetooth_discoverability"; - - /** - * Bluetooth discoverability timeout. If this value is nonzero, then - * Bluetooth becomes discoverable for a certain number of seconds, - * after which is becomes simply connectable. The value is in seconds. - */ - public static final String BLUETOOTH_DISCOVERABILITY_TIMEOUT = - "bluetooth_discoverability_timeout"; - - /** - * Whether autolock is enabled (0 = false, 1 = true) - */ - public static final String LOCK_PATTERN_ENABLED = "lock_pattern_autolock"; - - /** - * Whether the device has been provisioned (0 = false, 1 = true) + * Whether lock pattern is visible as user enters (0 = false, 1 = true) */ - public static final String DEVICE_PROVISIONED = "device_provisioned"; + public static final String LOCK_PATTERN_VISIBLE = "lock_pattern_visible_pattern"; /** - * Whether lock pattern is visible as user enters (0 = false, 1 = true) + * Whether lock pattern will vibrate as user enters (0 = false, 1 = true) */ - public static final String LOCK_PATTERN_VISIBLE = "lock_pattern_visible_pattern"; + public static final String LOCK_PATTERN_TACTILE_FEEDBACK_ENABLED = + "lock_pattern_tactile_feedback_enabled"; /** @@ -772,16 +945,6 @@ public final class Settings { */ public static final String NEXT_ALARM_FORMATTED = "next_alarm_formatted"; - /** - * Comma-separated list of location providers that activities may access. - */ - public static final String LOCATION_PROVIDERS_ALLOWED = "location_providers_allowed"; - - /** - * Whether or not data roaming is enabled. (0 = false, 1 = true) - */ - public static final String DATA_ROAMING = "data_roaming"; - /** * Scaling factor for fonts, float. */ @@ -883,11 +1046,34 @@ public final class Settings { */ public static final String VOLUME_ALARM = "volume_alarm"; + /** + * Notification volume. This is used internally, changing this + * value will not change the volume. See AudioManager. + */ + public static final String VOLUME_NOTIFICATION = "volume_notification"; + + /** + * Whether the notifications should use the ring volume (value of 1) or + * a separate notification volume (value of 0). In most cases, users + * will have this enabled so the notification and ringer volumes will be + * the same. However, power users can disable this and use the separate + * notification volume control. + *

    + * Note: This is a one-off setting that will be removed in the future + * when there is profile support. For this reason, it is kept hidden + * from the public APIs. + * + * @hide + */ + public static final String NOTIFICATIONS_USE_RING_VOLUME = + "notifications_use_ring_volume"; + /** * The mapping of stream type (integer) to its setting. */ public static final String[] VOLUME_SETTINGS = { - VOLUME_VOICE, VOLUME_SYSTEM, VOLUME_RING, VOLUME_MUSIC, VOLUME_ALARM + VOLUME_VOICE, VOLUME_SYSTEM, VOLUME_RING, VOLUME_MUSIC, + VOLUME_ALARM, VOLUME_NOTIFICATION }; /** @@ -949,145 +1135,828 @@ public final class Settings { * feature converts two spaces to a "." and space. */ public static final String TEXT_AUTO_PUNCTUATE = "auto_punctuate"; - + /** * Setting to showing password characters in text editors. 1 = On, 0 = Off */ public static final String TEXT_SHOW_PASSWORD = "show_password"; - /** - * USB Mass Storage Enabled - */ - public static final String USB_MASS_STORAGE_ENABLED = - "usb_mass_storage_enabled"; public static final String SHOW_GTALK_SERVICE_STATUS = "SHOW_GTALK_SERVICE_STATUS"; /** - * Name of activity to use for wallpaper on the home screen. + * Name of activity to use for wallpaper on the home screen. + */ + public static final String WALLPAPER_ACTIVITY = "wallpaper_activity"; + + /** + * Value to specify if the user prefers the date, time and time zone + * to be automatically fetched from the network (NITZ). 1=yes, 0=no + */ + public static final String AUTO_TIME = "auto_time"; + + /** + * Display times as 12 or 24 hours + * 12 + * 24 + */ + public static final String TIME_12_24 = "time_12_24"; + + /** + * Date format string + * mm/dd/yyyy + * dd/mm/yyyy + * yyyy/mm/dd + */ + public static final String DATE_FORMAT = "date_format"; + + /** + * Whether the setup wizard has been run before (on first boot), or if + * it still needs to be run. + * + * nonzero = it has been run in the past + * 0 = it has not been run in the past + */ + public static final String SETUP_WIZARD_HAS_RUN = "setup_wizard_has_run"; + + /** + * Scaling factor for normal window animations. Setting to 0 will disable window + * animations. + */ + public static final String WINDOW_ANIMATION_SCALE = "window_animation_scale"; + + /** + * Scaling factor for activity transition animations. Setting to 0 will disable window + * animations. + */ + public static final String TRANSITION_ANIMATION_SCALE = "transition_animation_scale"; + + /** + * Control whether the accelerometer will be used to change screen + * orientation. If 0, it will not be used unless explicitly requested + * by the application; if 1, it will be used by default unless explicitly + * disabled by the application. + */ + public static final String ACCELEROMETER_ROTATION = "accelerometer_rotation"; + + /** + * Whether the audible DTMF tones are played by the dialer when dialing. The value is + * boolean (1 or 0). + */ + public static final String DTMF_TONE_WHEN_DIALING = "dtmf_tone"; + + /** + * Whether the sounds effects (key clicks, lid open ...) are enabled. The value is + * boolean (1 or 0). + */ + public static final String SOUND_EFFECTS_ENABLED = "sound_effects_enabled"; + + // Settings moved to Settings.Secure + + /** + * @deprecated Use {@link android.provider.Settings.Secure#LOCATION_PROVIDERS_ALLOWED} + * instead + */ + @Deprecated + public static final String ADB_ENABLED = Secure.ADB_ENABLED; + + /** + * @deprecated Use {@link android.provider.Settings.Secure#ANDROID_ID} instead + */ + @Deprecated + public static final String ANDROID_ID = Secure.ANDROID_ID; + + /** + * @deprecated Use {@link android.provider.Settings.Secure#BLUETOOTH_ON} instead + */ + @Deprecated + public static final String BLUETOOTH_ON = Secure.BLUETOOTH_ON; + + /** + * @deprecated Use {@link android.provider.Settings.Secure#DATA_ROAMING} instead + */ + @Deprecated + public static final String DATA_ROAMING = Secure.DATA_ROAMING; + + /** + * @deprecated Use {@link android.provider.Settings.Secure#DEVICE_PROVISIONED} instead + */ + @Deprecated + public static final String DEVICE_PROVISIONED = Secure.DEVICE_PROVISIONED; + + /** + * @deprecated Use {@link android.provider.Settings.Secure#HTTP_PROXY} instead + */ + @Deprecated + public static final String HTTP_PROXY = Secure.HTTP_PROXY; + + /** + * @deprecated Use {@link android.provider.Settings.Secure#INSTALL_NON_MARKET_APPS} instead + */ + @Deprecated + public static final String INSTALL_NON_MARKET_APPS = Secure.INSTALL_NON_MARKET_APPS; + + /** + * @deprecated Use {@link android.provider.Settings.Secure#LOCATION_PROVIDERS_ALLOWED} + * instead + */ + @Deprecated + public static final String LOCATION_PROVIDERS_ALLOWED = Secure.LOCATION_PROVIDERS_ALLOWED; + + /** + * @deprecated Use {@link android.provider.Settings.Secure#LOGGING_ID} instead + */ + @Deprecated + public static final String LOGGING_ID = Secure.LOGGING_ID; + + /** + * @deprecated Use {@link android.provider.Settings.Secure#NETWORK_PREFERENCE} instead + */ + @Deprecated + public static final String NETWORK_PREFERENCE = Secure.NETWORK_PREFERENCE; + + /** + * @deprecated Use {@link android.provider.Settings.Secure#PARENTAL_CONTROL_ENABLED} + * instead + */ + @Deprecated + public static final String PARENTAL_CONTROL_ENABLED = Secure.PARENTAL_CONTROL_ENABLED; + + /** + * @deprecated Use {@link android.provider.Settings.Secure#PARENTAL_CONTROL_LAST_UPDATE} + * instead + */ + @Deprecated + public static final String PARENTAL_CONTROL_LAST_UPDATE = Secure.PARENTAL_CONTROL_LAST_UPDATE; + + /** + * @deprecated Use {@link android.provider.Settings.Secure#PARENTAL_CONTROL_REDIRECT_URL} + * instead + */ + @Deprecated + public static final String PARENTAL_CONTROL_REDIRECT_URL = + Secure.PARENTAL_CONTROL_REDIRECT_URL; + + /** + * @deprecated Use {@link android.provider.Settings.Secure#SETTINGS_CLASSNAME} instead + */ + @Deprecated + public static final String SETTINGS_CLASSNAME = Secure.SETTINGS_CLASSNAME; + + /** + * @deprecated Use {@link android.provider.Settings.Secure#USB_MASS_STORAGE_ENABLED} instead + */ + @Deprecated + public static final String USB_MASS_STORAGE_ENABLED = Secure.USB_MASS_STORAGE_ENABLED; + + /** + * @deprecated Use {@link android.provider.Settings.Secure#USE_GOOGLE_MAIL} instead + */ + @Deprecated + public static final String USE_GOOGLE_MAIL = Secure.USE_GOOGLE_MAIL; + +// /** +// * @deprecated Use {@link android.provider.Settings.Secure#WIFI_MAX_DHCP_RETRY_COUNT} +// * instead +// */ + @Deprecated + public static final String WIFI_MAX_DHCP_RETRY_COUNT = Secure.WIFI_MAX_DHCP_RETRY_COUNT; + +// /** +// * @deprecated Use +// * {@link android.provider.Settings.Secure#WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS} +// * instead +// */ + @Deprecated + public static final String WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS = + Secure.WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS; + + /** + * @deprecated Use + * {@link android.provider.Settings.Secure#WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON} instead + */ + @Deprecated + public static final String WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON = + Secure.WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON; + + /** + * @deprecated Use + * {@link android.provider.Settings.Secure#WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY} instead + */ + @Deprecated + public static final String WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY = + Secure.WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY; + + /** + * @deprecated Use {@link android.provider.Settings.Secure#WIFI_NUM_OPEN_NETWORKS_KEPT} + * instead + */ + @Deprecated + public static final String WIFI_NUM_OPEN_NETWORKS_KEPT = Secure.WIFI_NUM_OPEN_NETWORKS_KEPT; + + /** + * @deprecated Use {@link android.provider.Settings.Secure#WIFI_ON} instead + */ + @Deprecated + public static final String WIFI_ON = Secure.WIFI_ON; + + /** + * @deprecated Use + * {@link android.provider.Settings.Secure#WIFI_WATCHDOG_ACCEPTABLE_PACKET_LOSS_PERCENTAGE} + * instead + */ + @Deprecated + public static final String WIFI_WATCHDOG_ACCEPTABLE_PACKET_LOSS_PERCENTAGE = + Secure.WIFI_WATCHDOG_ACCEPTABLE_PACKET_LOSS_PERCENTAGE; + + /** + * @deprecated Use {@link android.provider.Settings.Secure#WIFI_WATCHDOG_AP_COUNT} instead + */ + @Deprecated + public static final String WIFI_WATCHDOG_AP_COUNT = Secure.WIFI_WATCHDOG_AP_COUNT; + + /** + * @deprecated Use + * {@link android.provider.Settings.Secure#WIFI_WATCHDOG_BACKGROUND_CHECK_DELAY_MS} instead + */ + @Deprecated + public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_DELAY_MS = + Secure.WIFI_WATCHDOG_BACKGROUND_CHECK_DELAY_MS; + + /** + * @deprecated Use + * {@link android.provider.Settings.Secure#WIFI_WATCHDOG_BACKGROUND_CHECK_ENABLED} instead + */ + @Deprecated + public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_ENABLED = + Secure.WIFI_WATCHDOG_BACKGROUND_CHECK_ENABLED; + + /** + * @deprecated Use + * {@link android.provider.Settings.Secure#WIFI_WATCHDOG_BACKGROUND_CHECK_TIMEOUT_MS} + * instead + */ + @Deprecated + public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_TIMEOUT_MS = + Secure.WIFI_WATCHDOG_BACKGROUND_CHECK_TIMEOUT_MS; + + /** + * @deprecated Use + * {@link android.provider.Settings.Secure#WIFI_WATCHDOG_INITIAL_IGNORED_PING_COUNT} instead + */ + @Deprecated + public static final String WIFI_WATCHDOG_INITIAL_IGNORED_PING_COUNT = + Secure.WIFI_WATCHDOG_INITIAL_IGNORED_PING_COUNT; + + /** + * @deprecated Use {@link android.provider.Settings.Secure#WIFI_WATCHDOG_MAX_AP_CHECKS} + * instead + */ + @Deprecated + public static final String WIFI_WATCHDOG_MAX_AP_CHECKS = Secure.WIFI_WATCHDOG_MAX_AP_CHECKS; + + /** + * @deprecated Use {@link android.provider.Settings.Secure#WIFI_WATCHDOG_ON} instead + */ + @Deprecated + public static final String WIFI_WATCHDOG_ON = Secure.WIFI_WATCHDOG_ON; + + /** + * @deprecated Use {@link android.provider.Settings.Secure#WIFI_WATCHDOG_PING_COUNT} instead + */ + @Deprecated + public static final String WIFI_WATCHDOG_PING_COUNT = Secure.WIFI_WATCHDOG_PING_COUNT; + + /** + * @deprecated Use {@link android.provider.Settings.Secure#WIFI_WATCHDOG_PING_DELAY_MS} + * instead + */ + @Deprecated + public static final String WIFI_WATCHDOG_PING_DELAY_MS = Secure.WIFI_WATCHDOG_PING_DELAY_MS; + + /** + * @deprecated Use {@link android.provider.Settings.Secure#WIFI_WATCHDOG_PING_TIMEOUT_MS} + * instead + */ + @Deprecated + public static final String WIFI_WATCHDOG_PING_TIMEOUT_MS = + Secure.WIFI_WATCHDOG_PING_TIMEOUT_MS; + } + + /** + * Secure system settings, containing system preferences that applications + * can read but are not allowed to write. These are for preferences that + * the user must explicitly modify through the system UI or specialized + * APIs for those values, not modified directly by applications. + */ + public static final class Secure extends NameValueTable { + public static final String SYS_PROP_SETTING_VERSION = "sys.settings_secure_version"; + + private static volatile NameValueCache mNameValueCache = null; + + /** + * Look up a name in the database. + * @param resolver to access the database with + * @param name to look up in the table + * @return the corresponding value, or null if not present + */ + public synchronized static String getString(ContentResolver resolver, String name) { + if (mNameValueCache == null) { + mNameValueCache = new NameValueCache(SYS_PROP_SETTING_VERSION, CONTENT_URI); + } + return mNameValueCache.getString(resolver, name); + } + + /** + * Store a name/value pair into the database. + * @param resolver to access the database with + * @param name to store + * @param value to associate with the name + * @return true if the value was set, false on database errors + */ + public static boolean putString(ContentResolver resolver, + String name, String value) { + return putString(resolver, CONTENT_URI, name, value); + } + + /** + * Construct the content URI for a particular name/value pair, + * useful for monitoring changes with a ContentObserver. + * @param name to look up in the table + * @return the corresponding content URI, or null if not present + */ + public static Uri getUriFor(String name) { + return getUriFor(CONTENT_URI, name); + } + + /** + * Convenience function for retrieving a single secure settings value + * as an integer. Note that internally setting values are always + * stored as strings; this function converts the string to an integer + * for you. The default value will be returned if the setting is + * not defined or not an integer. + * + * @param cr The ContentResolver to access. + * @param name The name of the setting to retrieve. + * @param def Value to return if the setting is not defined. + * + * @return The setting's current value, or 'def' if it is not defined + * or not a valid integer. + */ + public static int getInt(ContentResolver cr, String name, int def) { + String v = getString(cr, name); + try { + return v != null ? Integer.parseInt(v) : def; + } catch (NumberFormatException e) { + return def; + } + } + + /** + * Convenience function for retrieving a single secure settings value + * as an integer. Note that internally setting values are always + * stored as strings; this function converts the string to an integer + * for you. + *

    + * This version does not take a default value. If the setting has not + * been set, or the string value is not a number, + * it throws {@link SettingNotFoundException}. + * + * @param cr The ContentResolver to access. + * @param name The name of the setting to retrieve. + * + * @throws SettingNotFoundException Thrown if a setting by the given + * name can't be found or the setting value is not an integer. + * + * @return The setting's current value. + */ + public static int getInt(ContentResolver cr, String name) + throws SettingNotFoundException { + String v = getString(cr, name); + try { + return Integer.parseInt(v); + } catch (NumberFormatException e) { + throw new SettingNotFoundException(name); + } + } + + /** + * Convenience function for updating a single settings value as an + * integer. This will either create a new entry in the table if the + * given name does not exist, or modify the value of the existing row + * with that name. Note that internally setting values are always + * stored as strings, so this function converts the given value to a + * string before storing it. + * + * @param cr The ContentResolver to access. + * @param name The name of the setting to modify. + * @param value The new value for the setting. + * @return true if the value was set, false on database errors + */ + public static boolean putInt(ContentResolver cr, String name, int value) { + return putString(cr, name, Integer.toString(value)); + } + + /** + * Convenience function for retrieving a single secure settings value + * as a {@code long}. Note that internally setting values are always + * stored as strings; this function converts the string to a {@code long} + * for you. The default value will be returned if the setting is + * not defined or not a {@code long}. + * + * @param cr The ContentResolver to access. + * @param name The name of the setting to retrieve. + * @param def Value to return if the setting is not defined. + * + * @return The setting's current value, or 'def' if it is not defined + * or not a valid {@code long}. + */ + public static long getLong(ContentResolver cr, String name, long def) { + String valString = getString(cr, name); + long value; + try { + value = valString != null ? Long.parseLong(valString) : def; + } catch (NumberFormatException e) { + value = def; + } + return value; + } + + /** + * Convenience function for retrieving a single secure settings value + * as a {@code long}. Note that internally setting values are always + * stored as strings; this function converts the string to a {@code long} + * for you. + *

    + * This version does not take a default value. If the setting has not + * been set, or the string value is not a number, + * it throws {@link SettingNotFoundException}. + * + * @param cr The ContentResolver to access. + * @param name The name of the setting to retrieve. + * + * @return The setting's current value. + * @throws SettingNotFoundException Thrown if a setting by the given + * name can't be found or the setting value is not an integer. + */ + public static long getLong(ContentResolver cr, String name) + throws SettingNotFoundException { + String valString = getString(cr, name); + try { + return Long.parseLong(valString); + } catch (NumberFormatException e) { + throw new SettingNotFoundException(name); + } + } + + /** + * Convenience function for updating a secure settings value as a long + * integer. This will either create a new entry in the table if the + * given name does not exist, or modify the value of the existing row + * with that name. Note that internally setting values are always + * stored as strings, so this function converts the given value to a + * string before storing it. + * + * @param cr The ContentResolver to access. + * @param name The name of the setting to modify. + * @param value The new value for the setting. + * @return true if the value was set, false on database errors + */ + public static boolean putLong(ContentResolver cr, String name, long value) { + return putString(cr, name, Long.toString(value)); + } + + /** + * Convenience function for retrieving a single secure settings value + * as a floating point number. Note that internally setting values are + * always stored as strings; this function converts the string to an + * float for you. The default value will be returned if the setting + * is not defined or not a valid float. + * + * @param cr The ContentResolver to access. + * @param name The name of the setting to retrieve. + * @param def Value to return if the setting is not defined. + * + * @return The setting's current value, or 'def' if it is not defined + * or not a valid float. + */ + public static float getFloat(ContentResolver cr, String name, float def) { + String v = getString(cr, name); + try { + return v != null ? Float.parseFloat(v) : def; + } catch (NumberFormatException e) { + return def; + } + } + + /** + * Convenience function for retrieving a single secure settings value + * as a float. Note that internally setting values are always + * stored as strings; this function converts the string to a float + * for you. + *

    + * This version does not take a default value. If the setting has not + * been set, or the string value is not a number, + * it throws {@link SettingNotFoundException}. + * + * @param cr The ContentResolver to access. + * @param name The name of the setting to retrieve. + * + * @throws SettingNotFoundException Thrown if a setting by the given + * name can't be found or the setting value is not a float. + * + * @return The setting's current value. + */ + public static float getFloat(ContentResolver cr, String name) + throws SettingNotFoundException { + String v = getString(cr, name); + try { + return Float.parseFloat(v); + } catch (NumberFormatException e) { + throw new SettingNotFoundException(name); + } + } + + /** + * Convenience function for updating a single settings value as a + * floating point number. This will either create a new entry in the + * table if the given name does not exist, or modify the value of the + * existing row with that name. Note that internally setting values + * are always stored as strings, so this function converts the given + * value to a string before storing it. + * + * @param cr The ContentResolver to access. + * @param name The name of the setting to modify. + * @param value The new value for the setting. + * @return true if the value was set, false on database errors + */ + public static boolean putFloat(ContentResolver cr, String name, float value) { + return putString(cr, name, Float.toString(value)); + } + + /** + * The content:// style URL for this table + */ + public static final Uri CONTENT_URI = + Uri.parse("content://" + AUTHORITY + "/secure"); + + /** + * Whether ADB is enabled. + */ + public static final String ADB_ENABLED = "adb_enabled"; + + /** + * Setting to allow mock locations and location provider status to be injected into the + * LocationManager service for testing purposes during application development. These + * locations and status values override actual location and status information generated + * by network, gps, or other location providers. + */ + public static final String ALLOW_MOCK_LOCATION = "mock_location"; + + /** + * The Android ID (a unique 64-bit value) as a hex string. + * Identical to that obtained by calling + * GoogleLoginService.getAndroidId(); it is also placed here + * so you can get it without binding to a service. + */ + public static final String ANDROID_ID = "android_id"; + + /** + * Whether bluetooth is enabled/disabled + * 0=disabled. 1=enabled. + */ + public static final String BLUETOOTH_ON = "bluetooth_on"; + + /** + * Whether or not data roaming is enabled. (0 = false, 1 = true) + */ + public static final String DATA_ROAMING = "data_roaming"; + + /** + * Setting to record the input method used by default, holding the ID + * of the desired method. + */ + public static final String DEFAULT_INPUT_METHOD = "default_input_method"; + + /** + * Whether the device has been provisioned (0 = false, 1 = true) + */ + public static final String DEVICE_PROVISIONED = "device_provisioned"; + + /** + * List of input methods that are currently enabled. This is a string + * containing the IDs of all enabled input methods, each ID separated + * by ':'. + */ + public static final String ENABLED_INPUT_METHODS = "enabled_input_methods"; + + /** + * Host name and port for a user-selected proxy. + */ + public static final String HTTP_PROXY = "http_proxy"; + + /** + * Whether the package installer should allow installation of apps downloaded from + * sources other than the Android Market (vending machine). + * + * 1 = allow installing from other sources + * 0 = only allow installing from the Android Market + */ + public static final String INSTALL_NON_MARKET_APPS = "install_non_market_apps"; + + /** + * Comma-separated list of location providers that activities may access. + */ + public static final String LOCATION_PROVIDERS_ALLOWED = "location_providers_allowed"; + + /** + * The Logging ID (a unique 64-bit value) as a hex string. + * Used as a pseudonymous identifier for logging. + */ + public static final String LOGGING_ID = "logging_id"; + + /** + * User preference for which network(s) should be used. Only the + * connectivity service should touch this. + */ + public static final String NETWORK_PREFERENCE = "network_preference"; + + /** + */ + public static final String PARENTAL_CONTROL_ENABLED = "parental_control_enabled"; + + /** + */ + public static final String PARENTAL_CONTROL_LAST_UPDATE = "parental_control_last_update"; + + /** + */ + public static final String PARENTAL_CONTROL_REDIRECT_URL = "parental_control_redirect_url"; + + /** + * Settings classname to launch when Settings is clicked from All + * Applications. Needed because of user testing between the old + * and new Settings apps. + */ + // TODO: 881807 + public static final String SETTINGS_CLASSNAME = "settings_classname"; + + /** + * USB Mass Storage Enabled + */ + public static final String USB_MASS_STORAGE_ENABLED = "usb_mass_storage_enabled"; + + /** + * If this setting is set (to anything), then all references + * to Gmail on the device must change to Google Mail. + */ + public static final String USE_GOOGLE_MAIL = "use_google_mail"; + + /** + * Whether to notify the user of open networks. + *

    + * If not connected and the scan results have an open network, we will + * put this notification up. If we attempt to connect to a network or + * the open network(s) disappear, we remove the notification. When we + * show the notification, we will not show it again for + * {@link android.provider.Settings.Secure#WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY} time. + */ + public static final String WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON = + "wifi_networks_available_notification_on"; + + /** + * Delay (in seconds) before repeating the Wi-Fi networks available notification. + * Connecting to a network will reset the timer. + */ + public static final String WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY = + "wifi_networks_available_repeat_delay"; + + /** + * The number of radio channels that are allowed in the local + * 802.11 regulatory domain. + * @hide */ - public static final String WALLPAPER_ACTIVITY = "wallpaper_activity"; - + public static final String WIFI_NUM_ALLOWED_CHANNELS = "wifi_num_allowed_channels"; + /** - * Host name and port for a user-selected proxy. + * When the number of open networks exceeds this number, the + * least-recently-used excess networks will be removed. */ - public static final String HTTP_PROXY = "http_proxy"; - + public static final String WIFI_NUM_OPEN_NETWORKS_KEPT = "wifi_num_open_networks_kept"; + /** - * Value to specify if the user prefers the date, time and time zone - * to be automatically fetched from the network (NITZ). 1=yes, 0=no + * Whether the Wi-Fi should be on. Only the Wi-Fi service should touch this. */ - public static final String AUTO_TIME = "auto_time"; - + public static final String WIFI_ON = "wifi_on"; + /** - * Display times as 12 or 24 hours - * 12 - * 24 + * The acceptable packet loss percentage (range 0 - 100) before trying + * another AP on the same network. */ - public static final String TIME_12_24 = "time_12_24"; - + public static final String WIFI_WATCHDOG_ACCEPTABLE_PACKET_LOSS_PERCENTAGE = + "wifi_watchdog_acceptable_packet_loss_percentage"; + /** - * Date format string - * mm/dd/yyyy - * dd/mm/yyyy - * yyyy/mm/dd + * The number of access points required for a network in order for the + * watchdog to monitor it. */ - public static final String DATE_FORMAT = "date_format"; - + public static final String WIFI_WATCHDOG_AP_COUNT = "wifi_watchdog_ap_count"; + /** - * Settings classname to launch when Settings is clicked from All - * Applications. Needed because of user testing between the old - * and new Settings apps. TODO: 881807 + * The delay between background checks. */ - public static final String SETTINGS_CLASSNAME = "settings_classname"; - + public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_DELAY_MS = + "wifi_watchdog_background_check_delay_ms"; + /** - * Whether the setup wizard has been run before (on first boot), or if - * it still needs to be run. - * - * nonzero = it has been run in the past - * 0 = it has not been run in the past + * Whether the Wi-Fi watchdog is enabled for background checking even + * after it thinks the user has connected to a good access point. */ - public static final String SETUP_WIZARD_HAS_RUN = "setup_wizard_has_run"; - + public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_ENABLED = + "wifi_watchdog_background_check_enabled"; + /** - * The Android ID (a unique 64-bit value) as a hex string. - * Identical to that obtained by calling - * GoogleLoginService.getAndroidId(); it is also placed here - * so you can get it without binding to a service. + * The timeout for a background ping */ - public static final String ANDROID_ID = "android_id"; - + public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_TIMEOUT_MS = + "wifi_watchdog_background_check_timeout_ms"; + /** - * The Logging ID (a unique 64-bit value) as a hex string. - * Used as a pseudonymous identifier for logging. + * The number of initial pings to perform that *may* be ignored if they + * fail. Again, if these fail, they will *not* be used in packet loss + * calculation. For example, one network always seemed to time out for + * the first couple pings, so this is set to 3 by default. */ - public static final String LOGGING_ID = "logging_id"; - + public static final String WIFI_WATCHDOG_INITIAL_IGNORED_PING_COUNT = + "wifi_watchdog_initial_ignored_ping_count"; + /** - * If this setting is set (to anything), then all references - * to Gmail on the device must change to Google Mail. + * The maximum number of access points (per network) to attempt to test. + * If this number is reached, the watchdog will no longer monitor the + * initial connection state for the network. This is a safeguard for + * networks containing multiple APs whose DNS does not respond to pings. */ - public static final String USE_GOOGLE_MAIL = "use_google_mail"; - + public static final String WIFI_WATCHDOG_MAX_AP_CHECKS = "wifi_watchdog_max_ap_checks"; + /** - * Whether the package installer should allow installation of apps downloaded from - * sources other than the Android Market (vending machine). - * - * 1 = allow installing from other sources - * 0 = only allow installing from the Android Market + * Whether the Wi-Fi watchdog is enabled. */ - public static final String INSTALL_NON_MARKET_APPS = "install_non_market_apps"; - + public static final String WIFI_WATCHDOG_ON = "wifi_watchdog_on"; + /** - * Scaling factor for normal window animations. Setting to 0 will disable window - * animations. + * The number of pings to test if an access point is a good connection. */ - public static final String WINDOW_ANIMATION_SCALE = "window_animation_scale"; - + public static final String WIFI_WATCHDOG_PING_COUNT = "wifi_watchdog_ping_count"; + /** - * Scaling factor for activity transition animations. Setting to 0 will disable window - * animations. + * The delay between pings. */ - public static final String TRANSITION_ANIMATION_SCALE = "transition_animation_scale"; - - public static final String PARENTAL_CONTROL_ENABLED = - "parental_control_enabled"; - - public static final String PARENTAL_CONTROL_REDIRECT_URL = - "parental_control_redirect_url"; - - public static final String PARENTAL_CONTROL_LAST_UPDATE = - "parental_control_last_update"; - + public static final String WIFI_WATCHDOG_PING_DELAY_MS = "wifi_watchdog_ping_delay_ms"; + /** - * Whether ADB is enabled. + * The timeout per ping. */ - public static final String ADB_ENABLED = "adb_enabled"; - + public static final String WIFI_WATCHDOG_PING_TIMEOUT_MS = "wifi_watchdog_ping_timeout_ms"; + /** - * Whether the audible DTMF tones are played by the dialer when dialing. The value is - * boolean (1 or 0). + * The maximum number of times we will retry a connection to an access + * point for which we have failed in acquiring an IP address from DHCP. + * A value of N means that we will make N+1 connection attempts in all. + * + * @hide pending API Council approval */ - public static final String DTMF_TONE_WHEN_DIALING = "dtmf_tone"; - + public static final String WIFI_MAX_DHCP_RETRY_COUNT = "wifi_max_dhcp_retry_count"; + /** - * Whether the sounds effects (key clicks, lid open ...) are enabled. The value is - * boolean (1 or 0). + * Maximum amount of time in milliseconds to hold a wakelock while waiting for mobile + * data connectivity to be established after a disconnect from Wi-Fi. + * + * @hide pending API Council approval */ - public static final String SOUND_EFFECTS_ENABLED = "sound_effects_enabled"; + public static final String WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS = + "wifi_mobile_data_transition_wakelock_timeout_ms"; } - - + /** * Gservices settings, containing the network names for Google's * various services. This table holds simple name/addr pairs. * Addresses can be accessed through the getString() method. + * + * TODO: This should move to partner/google/... somewhere. + * * @hide */ public static final class Gservices extends NameValueTable { public static final String SYS_PROP_SETTING_VERSION = "sys.settings_gservices_version"; + /** + * Intent action broadcast when the Gservices table is updated by the server. + * This is broadcast once after settings change (so many values may have been updated). + */ + @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) + public static final String CHANGED_ACTION = + "com.google.gservices.intent.action.GSERVICES_CHANGED"; + private static volatile NameValueCache mNameValueCache = null; private static final Object mNameValueCacheLock = new Object(); @@ -1172,132 +2041,6 @@ public final class Settings { public static final String MMS_X_WAP_PROFILE_URL = "mms_x_wap_profile_url"; - /** - * YouTube - "most viewed" url - */ - public static final String YOUTUBE_MOST_VIEWED_URL - = "youtube_most_viewed_url"; - - /** - * YouTube - "most recent" url - */ - public static final String YOUTUBE_MOST_RECENT_URL - = "youtube_most_recent_url"; - - /** - * YouTube - "top favorites" url - */ - public static final String YOUTUBE_TOP_FAVORITES_URL - = "youtube_top_favorites_url"; - - /** - * YouTube - "most discussed" url - */ - public static final String YOUTUBE_MOST_DISCUSSED_URL - = "youtube_most_discussed_url"; - - /** - * YouTube - "most responded" url - */ - public static final String YOUTUBE_MOST_RESPONDED_URL - = "youtube_most_responded_url"; - - /** - * YouTube - "most linked" url - */ - public static final String YOUTUBE_MOST_LINKED_URL - = "youtube_most_linked_url"; - - /** - * YouTube - "top rated" url - */ - public static final String YOUTUBE_TOP_RATED_URL - = "youtube_top_rated_url"; - - /** - * YouTube - "recently featured" url - */ - public static final String YOUTUBE_RECENTLY_FEATURED_URL - = "youtube_recently_featured_url"; - - /** - * YouTube - my uploaded videos - */ - public static final String YOUTUBE_MY_VIDEOS_URL - = "youtube_my_videos_url"; - - /** - * YouTube - "my favorite" videos url - */ - public static final String YOUTUBE_MY_FAVORITES_URL - = "youtube_my_favorites_url"; - - /** - * YouTube - "by author" videos url -- used for My videos - */ - public static final String YOUTUBE_BY_AUTHOR_URL - = "youtube_by_author_url"; - - /** - * YouTube - save a video to favorite videos url - */ - public static final String YOUTUBE_SAVE_TO_FAVORITES_URL - = "youtube_save_to_favorites_url"; - - /** - * YouTube - "mobile" videos url - */ - public static final String YOUTUBE_MOBILE_VIDEOS_URL - = "youtube_mobile_videos_url"; - - /** - * YouTube - search videos url - */ - public static final String YOUTUBE_SEARCH_URL - = "youtube_search_url"; - - /** - * YouTube - category search videos url - */ - public static final String YOUTUBE_CATEGORY_SEARCH_URL - = "youtube_category_search_url"; - - /** - * YouTube - url to get the list of categories - */ - public static final String YOUTUBE_CATEGORY_LIST_URL - = "youtube_category_list_url"; - - /** - * YouTube - related videos url - */ - public static final String YOUTUBE_RELATED_VIDEOS_URL - = "youtube_related_videos_url"; - - /** - * YouTube - individual video url - */ - public static final String YOUTUBE_INDIVIDUAL_VIDEO_URL - = "youtube_individual_video_url"; - - /** - * YouTube - user's playlist url - */ - public static final String YOUTUBE_MY_PLAYLISTS_URL - = "youtube_my_playlists_url"; - - /** - * YouTube - user's subscriptions url - */ - public static final String YOUTUBE_MY_SUBSCRIPTIONS_URL - = "youtube_my_subscriptions_url"; - - /** - * YouTube - the url we use to contact YouTube to get a device id - */ - public static final String YOUTUBE_REGISTER_DEVICE_URL - = "youtube_register_device_url"; - /** * YouTube - the flag to indicate whether to use proxy */ @@ -1325,7 +2068,8 @@ public final class Settings { * seconds. This allows for throttling of logs when the device is * running for large amounts of time. */ - public static final String MEMCHECK_LOG_REALTIME_INTERVAL = "memcheck_log_realtime_interval"; + public static final String MEMCHECK_LOG_REALTIME_INTERVAL = + "memcheck_log_realtime_interval"; /** * Boolean indicating whether rebooting due to system memory checks @@ -1423,7 +2167,7 @@ public final class Settings { * the device is idle within the window. */ public static final String REBOOT_WINDOW = "reboot_window"; - + /** * The minimum version of the server that is required in order for the device to accept * the server's recommendations about the initial sync settings to use. When this is unset, @@ -1445,6 +2189,12 @@ public final class Settings { */ public static final String GMAIL_TIMEOUT_MS = "gmail_timeout_ms"; + /** + * Controls whether Gmail will request an expedited sync when a message is sent. Value must + * be an integer where non-zero means true. Defaults to 1. + */ + public static final String GMAIL_SEND_IMMEDIATELY = "gmail_send_immediately"; + /** * Hostname of the GTalk server. */ @@ -1667,7 +2417,28 @@ public final class Settings { */ public static final String SETTINGS_CONTRIBUTORS_PRETTY_URL = "settings_contributors_pretty_url"; - + + /** + * URL that points to the Terms Of Service for the device. + *

    + * This should be a pretty http URL. + */ + public static final String SETUP_GOOGLE_TOS_URL = "setup_google_tos_url"; + + /** + * URL that points to the Android privacy policy for the device. + *

    + * This should be a pretty http URL. + */ + public static final String SETUP_ANDROID_PRIVACY_URL = "setup_android_privacy_url"; + + /** + * URL that points to the Google privacy policy for the device. + *

    + * This should be a pretty http URL. + */ + public static final String SETUP_GOOGLE_PRIVACY_URL = "setup_google_privacy_url"; + /** * Request an MSISDN token for various Google services. */ @@ -1684,6 +2455,12 @@ public final class Settings { public static final String PARENTAL_CONTROL_CHECK_ENABLED = "parental_control_check_enabled"; + /** + * The list of applications we need to block if parental control is + * enabled. + */ + public static final String PARENTAL_CONTROL_APPS_LIST = + "parental_control_apps_list"; /** * Duration in which parental control status is valid. @@ -1712,7 +2489,7 @@ public final class Settings { */ public static final String DISK_FREE_CHANGE_REPORTING_THRESHOLD = "disk_free_change_reporting_threshold"; - + /** * Prefix for new Google services published by the checkin * server. @@ -1726,23 +2503,38 @@ public final class Settings { */ public static final String SYNC_MAX_RETRY_DELAY_IN_SECONDS = "sync_max_retry_delay_in_seconds"; - + /** * Minimum percentage of free storage on the device that is used to determine if - * the device is running low on storage. + * the device is running low on storage. * Say this value is set to 10, the device is considered running low on storage * if 90% or more of the device storage is filled up. */ - public static final String SYS_STORAGE_THRESHOLD_PERCENTAGE = + public static final String SYS_STORAGE_THRESHOLD_PERCENTAGE = "sys_storage_threshold_percentage"; - + /** - * The interval in minutes after which the amount of free storage left on the + * The interval in minutes after which the amount of free storage left on the * device is logged to the event log */ - public static final String SYS_FREE_STORAGE_LOG_INTERVAL = + public static final String SYS_FREE_STORAGE_LOG_INTERVAL = "sys_free_storage_log_interval"; + /** + * The interval in milliseconds at which to check the number of SMS sent + * out without asking for use permit, to limit the un-authorized SMS + * usage. + */ + public static final String SMS_OUTGOING_CEHCK_INTERVAL_MS = + "sms_outgoing_check_interval_ms"; + + /** + * The number of outgoing SMS sent without asking for user permit + * (of {@link #SMS_OUTGOING_CEHCK_INTERVAL_MS} + */ + public static final String SMS_OUTGOING_CEHCK_MAX_COUNT = + "sms_outgoing_check_max_count"; + /** * The interval in milliseconds at which to check packet counts on the * mobile data interface when screen is on, to detect possible data @@ -1757,22 +2549,22 @@ public final class Settings { * connection problems. */ public static final String PDP_WATCHDOG_LONG_POLL_INTERVAL_MS = - "pdp_watchdog_long_poll_interval_ms"; - + "pdp_watchdog_long_poll_interval_ms"; + /** * The interval in milliseconds at which to check packet counts on the * mobile data interface after {@link #PDP_WATCHDOG_TRIGGER_PACKET_COUNT} * outgoing packets has been reached without incoming packets. */ - public static final String PDP_WATCHDOG_ERROR_POLL_INTERVAL_MS = + public static final String PDP_WATCHDOG_ERROR_POLL_INTERVAL_MS = "pdp_watchdog_error_poll_interval_ms"; /** * The number of outgoing packets sent without seeing an incoming packet - * that triggers a countdown (of {@link #PDP_WATCHDOG_ERROR_POLL_COUNT} + * that triggers a countdown (of {@link #PDP_WATCHDOG_ERROR_POLL_COUNT} * device is logged to the event log */ - public static final String PDP_WATCHDOG_TRIGGER_PACKET_COUNT = + public static final String PDP_WATCHDOG_TRIGGER_PACKET_COUNT = "pdp_watchdog_trigger_packet_count"; /** @@ -1780,50 +2572,44 @@ public final class Settings { * after hitting {@link #PDP_WATCHDOG_TRIGGER_PACKET_COUNT} before * attempting data connection recovery. */ - public static final String PDP_WATCHDOG_ERROR_POLL_COUNT = + public static final String PDP_WATCHDOG_ERROR_POLL_COUNT = "pdp_watchdog_error_poll_count"; /** * The number of failed PDP reset attempts before moving to something more * drastic: re-registering to the network. */ - public static final String PDP_WATCHDOG_MAX_PDP_RESET_FAIL_COUNT = + public static final String PDP_WATCHDOG_MAX_PDP_RESET_FAIL_COUNT = "pdp_watchdog_max_pdp_reset_fail_count"; /** * Address to ping as a last sanity check before attempting any recovery. * Unset or set to "0.0.0.0" to skip this check. */ - public static final String PDP_WATCHDOG_PING_ADDRESS = - "pdp_watchdog_ping_address"; + public static final String PDP_WATCHDOG_PING_ADDRESS = "pdp_watchdog_ping_address"; /** * The "-w deadline" parameter for the ping, ie, the max time in * seconds to spend pinging. */ - public static final String PDP_WATCHDOG_PING_DEADLINE = - "pdp_watchdog_ping_deadline"; - - /** - * The interval in milliseconds after which Wi-Fi is considered idle. - * When idle, it is possible for the device to be switched from Wi-Fi to - * the mobile data network. - */ - public static final String WIFI_IDLE_MS = "wifi_idle_ms"; + public static final String PDP_WATCHDOG_PING_DEADLINE = "pdp_watchdog_ping_deadline"; /** - * The interval in milliseconds at which we forcefully release the - * transition-to-mobile-data wake lock. + * The interval in milliseconds at which to check gprs registration + * after the first registration mismatch of gprs and voice service, + * to detect possible data network registration problems. + * */ - public static final String WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS = - "wifi_mobile_data_transition_wakelock_timeout_ms"; + public static final String GPRS_REGISTER_CHECK_PERIOD_MS = + "gprs_register_check_period_ms"; /** - * The maximum number of times we will retry a connection to an access - * point for which we have failed in acquiring an IP address from DHCP. - * A value of N means that we will make N+1 connection attempts in all. + * Screen timeout in milliseconds corresponding to the + * PowerManager's POKE_LOCK_SHORT_TIMEOUT flag (i.e. the fastest + * possible screen timeout behavior.) */ - public static final String WIFI_MAX_DHCP_RETRY_COUNT = "wifi_max_dhcp_retry_count"; + public static final String SHORT_KEYLIGHT_DELAY_MS = + "short_keylight_delay_ms"; /** * @deprecated diff --git a/core/java/android/provider/Sync.java b/core/java/android/provider/Sync.java index b889293c2b6b8..2086a5dd4aa66 100644 --- a/core/java/android/provider/Sync.java +++ b/core/java/android/provider/Sync.java @@ -489,9 +489,14 @@ public final class Sync { */ public static final Uri CONTENT_URI = Uri.parse("content://sync/settings"); - /** controls whether or not the devices listens for sync tickles */ + /** controls whether or not the device listens for sync tickles */ public static final String SETTING_LISTEN_FOR_TICKLES = "listen_for_tickles"; + /** controls whether or not the device connect to Google in background for various + * stuff, including GTalk, checkin, Market and data sync ... + */ + public static final String SETTING_BACKGROUND_DATA = "background_data"; + /** controls whether or not the individual provider is synced when tickles are received */ public static final String SETTING_SYNC_PROVIDER_PREFIX = "sync_provider_"; @@ -529,17 +534,28 @@ public final class Sync { } /** - * A convenience method to set whether or not the tickle xmpp connection - * should be established. + * A convenience method to set whether or not the device should listen to tickles. * * @param contentResolver the ContentResolver to use to access the settings table - * @param flag true if the tickle xmpp connection should be established + * @param flag true if it should listen. */ static public void setListenForNetworkTickles(ContentResolver contentResolver, boolean flag) { putBoolean(contentResolver, SETTING_LISTEN_FOR_TICKLES, flag); } + /** + * A convenience method to set whether or not the device should connect to Google + * in background. + * + * @param contentResolver the ContentResolver to use to access the settings table + * @param flag true if it should connect. + */ + static public void setBackgroundData(ContentResolver contentResolver, + boolean flag) { + putBoolean(contentResolver, SETTING_BACKGROUND_DATA, flag); + } + public static class QueryMap extends ContentQueryMap { private ContentResolver mContentResolver; @@ -570,22 +586,41 @@ public final class Sync { } /** - * Set whether or not the tickle xmpp connection should be established. + * Set whether or not the device should listen for tickles. * - * @param flag true if the tickle xmpp connection should be established + * @param flag true if it should listen. */ public void setListenForNetworkTickles(boolean flag) { Settings.setListenForNetworkTickles(mContentResolver, flag); } /** - * Check if the tickle xmpp connection should be established - * @return true if it should be stablished + * Check if the device should listen to tickles. + + * @return true if it should */ public boolean getListenForNetworkTickles() { return getBoolean(SETTING_LISTEN_FOR_TICKLES, true); } + /** + * Set whether or not the device should connect to Google in background + * + * @param flag true if it should + */ + public void setBackgroundData(boolean flag) { + Settings.setBackgroundData(mContentResolver, flag); + } + + /** + * Check if the device should connect to Google in background. + + * @return true if it should + */ + public boolean getBackgroundData() { + return getBoolean(SETTING_BACKGROUND_DATA, true); + } + /** * Convenience function for retrieving a single settings value * as a boolean. diff --git a/core/java/android/provider/Telephony.java b/core/java/android/provider/Telephony.java index 776a2664b16a2..18c64ed182030 100644 --- a/core/java/android/provider/Telephony.java +++ b/core/java/android/provider/Telephony.java @@ -16,7 +16,6 @@ package android.provider; -import com.android.internal.telephony.CallerInfo; import com.google.android.mms.util.SqliteWrapper; import android.annotation.SdkConstant; @@ -27,8 +26,6 @@ import android.content.Context; import android.content.Intent; import android.database.Cursor; import android.net.Uri; -import android.telephony.PhoneNumberUtils; -import android.telephony.TelephonyManager; import android.telephony.gsm.SmsMessage; import android.text.TextUtils; import android.text.util.Regex; @@ -263,49 +260,6 @@ public final class Telephony { || (messageType == MESSAGE_TYPE_QUEUED); } - /** - * Returns true if the address is an email address - * - * @param address the input address to be tested - * @return true if address is an email address - */ - public static boolean isEmailAddress(String address) { - /* - * The '@' char isn't a valid char in phone numbers. However, in SMS - * messages sent by carrier, the originating-address can contain - * non-dialable alphanumeric chars. For the purpose of thread id - * grouping, we don't care about those. We only care about the - * legitmate/dialable phone numbers (which we use the special phone - * number comparison) and email addresses (which we do straight up - * string comparison). - */ - return (address != null) && (address.indexOf('@') != -1); - } - - /** - * Formats an address for displaying, doing a phone number lookup in the - * Address Book, etc. - * - * @param context the context to use - * @param address the address to format - * @return a nicely formatted version of the sender to display - */ - public static String getDisplayAddress(Context context, String address) { - String result; - int index; - if (isEmailAddress(address)) { - index = address.indexOf('@'); - if (index != -1) { - result = address.substring(0, index); - } else { - result = address; - } - } else { - result = CallerInfo.getCallerId(context, address); - } - return result; - } - /** * Contains all text based SMS messages in the SMS app's inbox. */ @@ -1166,7 +1120,7 @@ public final class Telephony { * name-addr = [display-name] angle-addr * angle-addr = [CFWS] "<" addr-spec ">" [CFWS] */ - private static final Pattern NAME_ADDR_EMAIL_PATTERN = + public static final Pattern NAME_ADDR_EMAIL_PATTERN = Pattern.compile("\\s*(\"[^\"]*\"|[^<>\"]+)\\s*<([^<>]+)>\\s*"); /** @@ -1174,7 +1128,7 @@ public final class Telephony { * DQUOTE *([FWS] qcontent) [FWS] DQUOTE * [CFWS] */ - private static final Pattern QUOTED_STRING_PATTERN = + public static final Pattern QUOTED_STRING_PATTERN = Pattern.compile("\\s*\"([^\"]*)\"\\s*"); public static final Cursor query( @@ -1231,81 +1185,6 @@ public final class Telephony { return match.matches(); } - /** - * Formats an address for displaying, doing a phone number lookup in the - * Address Book, etc. - * - * @param context the context to use - * @param address the address to format - * @return a nicely formatted version of the sender to display - */ - public static String getDisplayAddress(Context context, String address) { - if (address == null) { - return ""; - } - - String localNumber = TelephonyManager.getDefault().getLine1Number(); - String[] values = address.split(";"); - String result = ""; - for (int i = 0; i < values.length; i++) { - if (values[i].length() > 0) { - if (PhoneNumberUtils.compare(values[i], localNumber)) { - result = result + ";" - + context.getString(com.android.internal.R.string.me); - } else if (isEmailAddress(values[i])) { - result = result + ";" + getDisplayName(context, values[i]); - } else { - result = result + ";" + CallerInfo.getCallerId(context, values[i]); - } - } - } - - if (result.length() > 0) { - // Skip the first ';' - return result.substring(1); - } - return result; - } - - private static String getEmailDisplayName(String displayString) { - Matcher match = QUOTED_STRING_PATTERN.matcher(displayString); - if (match.matches()) { - return match.group(1); - } - - return displayString; - } - - private static String getDisplayName(Context context, String email) { - Matcher match = NAME_ADDR_EMAIL_PATTERN.matcher(email); - if (match.matches()) { - // email has display name - return getEmailDisplayName(match.group(1)); - } - - Cursor cursor = SqliteWrapper.query(context, context.getContentResolver(), - Contacts.ContactMethods.CONTENT_EMAIL_URI, - new String[] { Contacts.ContactMethods.NAME }, - Contacts.ContactMethods.DATA + " = \'" + email + "\'", - null, null); - - if (cursor != null) { - try { - int columnIndex = cursor.getColumnIndexOrThrow( - Contacts.ContactMethods.NAME); - while (cursor.moveToNext()) { - String name = cursor.getString(columnIndex); - if (!TextUtils.isEmpty(name)) { - return name; - } - } - } finally { - cursor.close(); - } - } - return email; - } - /** * Contains all MMS messages in the MMS app's inbox. */ @@ -1647,6 +1526,7 @@ public final class Telephony { public static final String TYPE = "type"; + public static final String CURRENT = "current"; } public static final class Intents { diff --git a/core/java/android/security/Md5MessageDigest.java b/core/java/android/security/Md5MessageDigest.java index a7221aea2318d..4fe0cb0e62fe3 100644 --- a/core/java/android/security/Md5MessageDigest.java +++ b/core/java/android/security/Md5MessageDigest.java @@ -17,8 +17,7 @@ package android.security; /** - * This is a temporary class to provide SHA-1 hash. - * It's not meant to be correct, and eventually doesn't belong in java.security + * Provides the MD5 hash encryption. */ public class Md5MessageDigest extends MessageDigest { diff --git a/core/java/android/security/MessageDigest.java b/core/java/android/security/MessageDigest.java index 93040b9a229c9..cf2d0fe6e225e 100644 --- a/core/java/android/security/MessageDigest.java +++ b/core/java/android/security/MessageDigest.java @@ -18,8 +18,22 @@ package android.security; import java.security.NoSuchAlgorithmException; +/** + * Base class for producing a message digest from different hash encryptions. + */ public abstract class MessageDigest { + /** + * Returns a digest object of the specified type. + * + * @param algorithm The type of hash function to use. Valid values are + * SHA-1 and MD5. + * @return The respective MessageDigest object. Either a + * {@link android.security.Sha1MessageDigest} or + * {@link android.security.Md5MessageDigest} object. + * @throws NoSuchAlgorithmException If an invalid algorithm + * is given. + */ public static MessageDigest getInstance(String algorithm) throws NoSuchAlgorithmException { @@ -39,5 +53,12 @@ public abstract class MessageDigest public abstract void update(byte[] input); public abstract byte[] digest(); + + /** + * Produces a message digest for the given input. + * + * @param input The message to encrypt. + * @return The digest (hash sum). + */ public abstract byte[] digest(byte[] input); } diff --git a/core/java/android/security/Sha1MessageDigest.java b/core/java/android/security/Sha1MessageDigest.java index 3b3fd6a67f837..aa01fa6151991 100644 --- a/core/java/android/security/Sha1MessageDigest.java +++ b/core/java/android/security/Sha1MessageDigest.java @@ -17,8 +17,7 @@ package android.security; /** - * This is a temporary class to provide SHA-1 hash. - * It's not meant to be correct, and eventually doesn't belong in java.security + * Provides the SHA-1 hash encyption. */ public class Sha1MessageDigest extends MessageDigest { diff --git a/core/java/android/security/package.html b/core/java/android/security/package.html index 26b8a328b1321..dfc6303fe4ad5 100644 --- a/core/java/android/security/package.html +++ b/core/java/android/security/package.html @@ -1,5 +1,6 @@ +Utilities for encrypting messages from hash functions. {@hide} - \ No newline at end of file + diff --git a/core/java/android/server/BluetoothA2dpService.java b/core/java/android/server/BluetoothA2dpService.java new file mode 100644 index 0000000000000..3cbb855d08c9c --- /dev/null +++ b/core/java/android/server/BluetoothA2dpService.java @@ -0,0 +1,315 @@ +/* + * Copyright (C) 2008 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * TODO: Move this to + * java/services/com/android/server/BluetoothA2dpService.java + * and make the contructor package private again. + * @hide + */ + +package android.server; + +import android.bluetooth.BluetoothA2dp; +import android.bluetooth.BluetoothDevice; +import android.bluetooth.BluetoothError; +import android.bluetooth.BluetoothIntent; +import android.bluetooth.IBluetoothA2dp; +import android.content.BroadcastReceiver; +import android.content.Context; +import android.content.Intent; +import android.content.IntentFilter; +import android.content.pm.PackageManager; +import android.media.AudioManager; +import android.os.Binder; +import android.util.Log; + +import java.io.FileDescriptor; +import java.io.PrintWriter; +import java.util.ArrayList; +import java.util.List; +import java.util.HashMap; +import java.util.Iterator; + +public class BluetoothA2dpService extends IBluetoothA2dp.Stub { + private static final String TAG = "BluetoothDeviceService"; + private static final boolean DBG = true; + + public static final String BLUETOOTH_A2DP_SERVICE = "bluetooth_a2dp"; + + private static final String BLUETOOTH_ADMIN_PERM = android.Manifest.permission.BLUETOOTH_ADMIN; + private static final String BLUETOOTH_PERM = android.Manifest.permission.BLUETOOTH; + + private final Context mContext; + private final IntentFilter mIntentFilter; + private HashMap mAudioDevices; + private final AudioManager mAudioManager; + + private class SinkState { + public String address; + public int state; + public SinkState(String a, int s) {address = a; state = s;} + } + + public BluetoothA2dpService(Context context) { + mContext = context; + + mAudioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE); + + BluetoothDevice device = + (BluetoothDevice)mContext.getSystemService(Context.BLUETOOTH_SERVICE); + if (device == null) { + throw new RuntimeException("Platform does not support Bluetooth"); + } + + if (!initNative()) { + throw new RuntimeException("Could not init BluetoothA2dpService"); + } + + mIntentFilter = new IntentFilter(BluetoothIntent.ENABLED_ACTION); + mIntentFilter.addAction(BluetoothIntent.DISABLED_ACTION); + mContext.registerReceiver(mReceiver, mIntentFilter); + + if (device.isEnabled()) { + onBluetoothEnable(); + } + } + + @Override + protected void finalize() throws Throwable { + try { + cleanupNative(); + } finally { + super.finalize(); + } + } + + private final BroadcastReceiver mReceiver = new BroadcastReceiver() { + @Override + public void onReceive(Context context, Intent intent) { + String action = intent.getAction(); + if (action.equals(BluetoothIntent.ENABLED_ACTION)) { + onBluetoothEnable(); + } else if (action.equals(BluetoothIntent.DISABLED_ACTION)) { + onBluetoothDisable(); + } + } + }; + + private synchronized void onBluetoothEnable() { + mAudioDevices = new HashMap(); + String[] paths = (String[])listHeadsetsNative(); + if (paths != null) { + for (String path : paths) { + mAudioDevices.put(path, new SinkState(getAddressNative(path), + isSinkConnectedNative(path) ? BluetoothA2dp.STATE_CONNECTED : + BluetoothA2dp.STATE_DISCONNECTED)); + } + } + } + + private synchronized void onBluetoothDisable() { + mAudioDevices = null; + } + + public synchronized int connectSink(String address) { + mContext.enforceCallingOrSelfPermission(BLUETOOTH_ADMIN_PERM, + "Need BLUETOOTH_ADMIN permission"); + if (DBG) log("connectSink(" + address + ")"); + if (!BluetoothDevice.checkBluetoothAddress(address)) { + return BluetoothError.ERROR; + } + if (mAudioDevices == null) { + return BluetoothError.ERROR; + } + String path = lookupPath(address); + if (path == null) { + path = createHeadsetNative(address); + if (DBG) log("new bluez sink: " + address + " (" + path + ")"); + } + if (path == null) { + return BluetoothError.ERROR; + } + if (!connectSinkNative(path)) { + return BluetoothError.ERROR; + } else { + updateState(path, BluetoothA2dp.STATE_CONNECTING); + return BluetoothError.SUCCESS; + } + } + + public synchronized int disconnectSink(String address) { + mContext.enforceCallingOrSelfPermission(BLUETOOTH_ADMIN_PERM, + "Need BLUETOOTH_ADMIN permission"); + if (DBG) log("disconnectSink(" + address + ")"); + if (!BluetoothDevice.checkBluetoothAddress(address)) { + return BluetoothError.ERROR; + } + if (mAudioDevices == null) { + return BluetoothError.ERROR; + } + String path = lookupPath(address); + if (path == null) { + return BluetoothError.ERROR; + } + if (!disconnectSinkNative(path)) { + return BluetoothError.ERROR; + } else { + updateState(path, BluetoothA2dp.STATE_DISCONNECTING); + return BluetoothError.SUCCESS; + } + } + + public synchronized List listConnectedSinks() { + mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission"); + List connectedSinks = new ArrayList(); + if (mAudioDevices == null) { + return connectedSinks; + } + for (SinkState sink : mAudioDevices.values()) { + if (sink.state == BluetoothA2dp.STATE_CONNECTED || + sink.state == BluetoothA2dp.STATE_PLAYING) { + connectedSinks.add(sink.address); + } + } + return connectedSinks; + } + + public synchronized int getSinkState(String address) { + mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission"); + if (!BluetoothDevice.checkBluetoothAddress(address)) { + return BluetoothError.ERROR; + } + if (mAudioDevices == null) { + return BluetoothA2dp.STATE_DISCONNECTED; + } + for (SinkState sink : mAudioDevices.values()) { + if (address.equals(sink.address)) { + return sink.state; + } + } + return BluetoothA2dp.STATE_DISCONNECTED; + } + + public synchronized void onHeadsetCreated(String path) { + updateState(path, BluetoothA2dp.STATE_DISCONNECTED); + } + + public synchronized void onHeadsetRemoved(String path) { + if (mAudioDevices == null) return; + mAudioDevices.remove(path); + } + + public synchronized void onSinkConnected(String path) { + if (mAudioDevices == null) return; + // bluez 3.36 quietly disconnects the previous sink when a new sink + // is connected, so we need to mark all previously connected sinks as + // disconnected + for (String oldPath : mAudioDevices.keySet()) { + if (path.equals(oldPath)) { + continue; + } + int state = mAudioDevices.get(oldPath).state; + if (state == BluetoothA2dp.STATE_CONNECTED || state == BluetoothA2dp.STATE_PLAYING) { + updateState(path, BluetoothA2dp.STATE_DISCONNECTED); + } + } + + mAudioManager.setBluetoothA2dpOn(true); + updateState(path, BluetoothA2dp.STATE_CONNECTED); + } + + public synchronized void onSinkDisconnected(String path) { + mAudioManager.setBluetoothA2dpOn(false); + updateState(path, BluetoothA2dp.STATE_DISCONNECTED); + } + + public synchronized void onSinkPlaying(String path) { + updateState(path, BluetoothA2dp.STATE_PLAYING); + } + + public synchronized void onSinkStopped(String path) { + updateState(path, BluetoothA2dp.STATE_CONNECTED); + } + + private synchronized final String lookupAddress(String path) { + if (mAudioDevices == null) return null; + String address = mAudioDevices.get(path).address; + if (address == null) Log.e(TAG, "Can't find address for " + path); + return address; + } + + private synchronized final String lookupPath(String address) { + if (mAudioDevices == null) return null; + + for (String path : mAudioDevices.keySet()) { + if (address.equals(mAudioDevices.get(path).address)) { + return path; + } + } + return null; + } + + private synchronized void updateState(String path, int state) { + if (mAudioDevices == null) return; + + SinkState s = mAudioDevices.get(path); + int prevState; + String address; + if (s == null) { + address = getAddressNative(path); + mAudioDevices.put(path, new SinkState(address, state)); + prevState = BluetoothA2dp.STATE_DISCONNECTED; + } else { + address = lookupAddress(path); + prevState = s.state; + s.state = state; + } + + if (DBG) log("state " + address + " (" + path + ") " + prevState + "->" + state); + + Intent intent = new Intent(BluetoothA2dp.SINK_STATE_CHANGED_ACTION); + intent.putExtra(BluetoothIntent.ADDRESS, address); + intent.putExtra(BluetoothA2dp.SINK_PREVIOUS_STATE, prevState); + intent.putExtra(BluetoothA2dp.SINK_STATE, state); + mContext.sendBroadcast(intent, BLUETOOTH_PERM); + } + + @Override + protected synchronized void dump(FileDescriptor fd, PrintWriter pw, String[] args) { + if (mAudioDevices == null) return; + pw.println("Cached audio devices:"); + for (String path : mAudioDevices.keySet()) { + SinkState sink = mAudioDevices.get(path); + pw.println(path + " " + sink.address + " " + BluetoothA2dp.stateToString(sink.state)); + } + } + + private static void log(String msg) { + Log.d(TAG, msg); + } + + private native boolean initNative(); + private native void cleanupNative(); + private synchronized native String[] listHeadsetsNative(); + private synchronized native String createHeadsetNative(String address); + private synchronized native boolean removeHeadsetNative(String path); + private synchronized native String getAddressNative(String path); + private synchronized native boolean connectSinkNative(String path); + private synchronized native boolean disconnectSinkNative(String path); + private synchronized native boolean isSinkConnectedNative(String path); + +} diff --git a/core/java/android/server/BluetoothDeviceService.java b/core/java/android/server/BluetoothDeviceService.java index 10f9f7c15075b..9bdab9f2957a7 100644 --- a/core/java/android/server/BluetoothDeviceService.java +++ b/core/java/android/server/BluetoothDeviceService.java @@ -54,13 +54,17 @@ import java.util.HashMap; public class BluetoothDeviceService extends IBluetoothDevice.Stub { private static final String TAG = "BluetoothDeviceService"; private int mNativeData; - private Context mContext; private BluetoothEventLoop mEventLoop; private IntentFilter mIntentFilter; private boolean mIsAirplaneSensitive; private volatile boolean mIsEnabled; // local cache of isEnabledNative() private boolean mIsDiscovering; + private final Context mContext; + + private static final String BLUETOOTH_ADMIN_PERM = android.Manifest.permission.BLUETOOTH_ADMIN; + private static final String BLUETOOTH_PERM = android.Manifest.permission.BLUETOOTH; + static { classInitNative(); } @@ -97,7 +101,7 @@ public class BluetoothDeviceService extends IBluetoothDevice.Stub { private native void cleanupNativeDataNative(); public boolean isEnabled() { - checkPermissionBluetooth(); + mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission"); return mIsEnabled; } private native int isEnabledNative(); @@ -106,7 +110,8 @@ public class BluetoothDeviceService extends IBluetoothDevice.Stub { * Disable bluetooth. Returns true on success. */ public synchronized boolean disable() { - checkPermissionBluetoothAdmin(); + mContext.enforceCallingOrSelfPermission(BLUETOOTH_ADMIN_PERM, + "Need BLUETOOTH_ADMIN permission"); if (mEnableThread != null && mEnableThread.isAlive()) { return false; @@ -117,9 +122,10 @@ public class BluetoothDeviceService extends IBluetoothDevice.Stub { mEventLoop.stop(); disableNative(); mIsEnabled = false; + Settings.Secure.putInt(mContext.getContentResolver(), Settings.Secure.BLUETOOTH_ON, 0); mIsDiscovering = false; Intent intent = new Intent(BluetoothIntent.DISABLED_ACTION); - mContext.sendBroadcast(intent); + mContext.sendBroadcast(intent, BLUETOOTH_PERM); return true; } @@ -131,7 +137,8 @@ public class BluetoothDeviceService extends IBluetoothDevice.Stub { * notified when complete. */ public synchronized boolean enable(IBluetoothDeviceCallback callback) { - checkPermissionBluetoothAdmin(); + mContext.enforceCallingOrSelfPermission(BLUETOOTH_ADMIN_PERM, + "Need BLUETOOTH_ADMIN permission"); // Airplane mode can prevent Bluetooth radio from being turned on. if (mIsAirplaneSensitive && isAirplaneModeOn()) { @@ -164,6 +171,8 @@ public class BluetoothDeviceService extends IBluetoothDevice.Stub { }; private EnableThread mEnableThread; + private String mOutgoingBondingDevAddress = null; + private class EnableThread extends Thread { private final IBluetoothDeviceCallback mEnableCallback; public EnableThread(IBluetoothDeviceCallback callback) { @@ -185,9 +194,11 @@ public class BluetoothDeviceService extends IBluetoothDevice.Stub { if (res) { mIsEnabled = true; + Settings.Secure.putInt(mContext.getContentResolver(), + Settings.Secure.BLUETOOTH_ON, 1); mIsDiscovering = false; Intent intent = new Intent(BluetoothIntent.ENABLED_ACTION); - mContext.sendBroadcast(intent); + mContext.sendBroadcast(intent, BLUETOOTH_PERM); mHandler.sendMessageDelayed(mHandler.obtainMessage(REGISTER_SDP_RECORDS), 3000); } mEnableThread = null; @@ -198,19 +209,20 @@ public class BluetoothDeviceService extends IBluetoothDevice.Stub { private native int disableNative(); public synchronized String getAddress() { - checkPermissionBluetooth(); + mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission"); return getAddressNative(); } private native String getAddressNative(); public synchronized String getName() { - checkPermissionBluetooth(); + mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission"); return getNameNative(); } private native String getNameNative(); public synchronized boolean setName(String name) { - checkPermissionBluetoothAdmin(); + mContext.enforceCallingOrSelfPermission(BLUETOOTH_ADMIN_PERM, + "Need BLUETOOTH_ADMIN permission"); if (name == null) { return false; } @@ -220,19 +232,19 @@ public class BluetoothDeviceService extends IBluetoothDevice.Stub { private native boolean setNameNative(String name); public synchronized String[] listBondings() { - checkPermissionBluetooth(); + mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission"); return listBondingsNative(); } private native String[] listBondingsNative(); public synchronized String getMajorClass() { - checkPermissionBluetooth(); + mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission"); return getMajorClassNative(); } private native String getMajorClassNative(); public synchronized String getMinorClass() { - checkPermissionBluetooth(); + mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission"); return getMinorClassNative(); } private native String getMinorClassNative(); @@ -248,7 +260,7 @@ public class BluetoothDeviceService extends IBluetoothDevice.Stub { * @return The user-friendly name of the specified remote device. */ public synchronized String getRemoteName(String address) { - checkPermissionBluetooth(); + mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission"); if (!BluetoothDevice.checkBluetoothAddress(address)) { return null; } @@ -277,7 +289,8 @@ public class BluetoothDeviceService extends IBluetoothDevice.Stub { * false otherwise. */ public synchronized boolean startDiscovery(boolean resolveNames) { - checkPermissionBluetoothAdmin(); + mContext.enforceCallingOrSelfPermission(BLUETOOTH_ADMIN_PERM, + "Need BLUETOOTH_ADMIN permission"); return startDiscoveryNative(resolveNames); } private native boolean startDiscoveryNative(boolean resolveNames); @@ -289,13 +302,14 @@ public class BluetoothDeviceService extends IBluetoothDevice.Stub { * started. */ public synchronized boolean cancelDiscovery() { - checkPermissionBluetoothAdmin(); + mContext.enforceCallingOrSelfPermission(BLUETOOTH_ADMIN_PERM, + "Need BLUETOOTH_ADMIN permission"); return cancelDiscoveryNative(); } private native boolean cancelDiscoveryNative(); public synchronized boolean isDiscovering() { - checkPermissionBluetooth(); + mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission"); return mIsDiscovering; } @@ -304,19 +318,21 @@ public class BluetoothDeviceService extends IBluetoothDevice.Stub { } public synchronized boolean startPeriodicDiscovery() { - checkPermissionBluetoothAdmin(); + mContext.enforceCallingOrSelfPermission(BLUETOOTH_ADMIN_PERM, + "Need BLUETOOTH_ADMIN permission"); return startPeriodicDiscoveryNative(); } private native boolean startPeriodicDiscoveryNative(); public synchronized boolean stopPeriodicDiscovery() { - checkPermissionBluetoothAdmin(); + mContext.enforceCallingOrSelfPermission(BLUETOOTH_ADMIN_PERM, + "Need BLUETOOTH_ADMIN permission"); return stopPeriodicDiscoveryNative(); } private native boolean stopPeriodicDiscoveryNative(); public synchronized boolean isPeriodicDiscovery() { - checkPermissionBluetooth(); + mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission"); return isPeriodicDiscoveryNative(); } private native boolean isPeriodicDiscoveryNative(); @@ -331,7 +347,8 @@ public class BluetoothDeviceService extends IBluetoothDevice.Stub { * @param timeout_s The discoverable timeout in seconds. */ public synchronized boolean setDiscoverableTimeout(int timeout) { - checkPermissionBluetoothAdmin(); + mContext.enforceCallingOrSelfPermission(BLUETOOTH_ADMIN_PERM, + "Need BLUETOOTH_ADMIN permission"); return setDiscoverableTimeoutNative(timeout); } private native boolean setDiscoverableTimeoutNative(int timeout_s); @@ -345,13 +362,13 @@ public class BluetoothDeviceService extends IBluetoothDevice.Stub { * value indicates an error. */ public synchronized int getDiscoverableTimeout() { - checkPermissionBluetooth(); + mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission"); return getDiscoverableTimeoutNative(); } private native int getDiscoverableTimeoutNative(); public synchronized boolean isAclConnected(String address) { - checkPermissionBluetooth(); + mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission"); if (!BluetoothDevice.checkBluetoothAddress(address)) { return false; } @@ -378,7 +395,7 @@ public class BluetoothDeviceService extends IBluetoothDevice.Stub { * @see #setMode */ public synchronized boolean isConnectable() { - checkPermissionBluetooth(); + mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission"); return isConnectableNative(); } private native boolean isConnectableNative(); @@ -401,7 +418,7 @@ public class BluetoothDeviceService extends IBluetoothDevice.Stub { * @see #setMode */ public synchronized boolean isDiscoverable() { - checkPermissionBluetooth(); + mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission"); return isDiscoverableNative(); } private native boolean isDiscoverableNative(); @@ -415,7 +432,7 @@ public class BluetoothDeviceService extends IBluetoothDevice.Stub { * @see #setMode */ public synchronized int getMode() { - checkPermissionBluetooth(); + mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission"); String mode = getModeNative(); if (mode == null) { return BluetoothDevice.MODE_UNKNOWN; @@ -451,7 +468,8 @@ public class BluetoothDeviceService extends IBluetoothDevice.Stub { * @see #getMode */ public synchronized boolean setMode(int mode) { - checkPermissionBluetoothAdmin(); + mContext.enforceCallingOrSelfPermission(BLUETOOTH_ADMIN_PERM, + "Need BLUETOOTH_ADMIN permission"); switch (mode) { case BluetoothDevice.MODE_OFF: return setModeNative("off"); @@ -477,7 +495,7 @@ public class BluetoothDeviceService extends IBluetoothDevice.Stub { * @return The alias of the remote device. */ public synchronized String getRemoteAlias(String address) { - checkPermissionBluetooth(); + mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission"); if (!BluetoothDevice.checkBluetoothAddress(address)) { return null; } @@ -496,7 +514,8 @@ public class BluetoothDeviceService extends IBluetoothDevice.Stub { * @param alias Alias for the remote device */ public synchronized boolean setRemoteAlias(String address, String alias) { - checkPermissionBluetoothAdmin(); + mContext.enforceCallingOrSelfPermission(BLUETOOTH_ADMIN_PERM, + "Need BLUETOOTH_ADMIN permission"); if (alias == null || !BluetoothDevice.checkBluetoothAddress(address)) { return false; } @@ -513,7 +532,8 @@ public class BluetoothDeviceService extends IBluetoothDevice.Stub { * @param address Bluetooth address of remote device */ public synchronized boolean clearRemoteAlias(String address) { - checkPermissionBluetoothAdmin(); + mContext.enforceCallingOrSelfPermission(BLUETOOTH_ADMIN_PERM, + "Need BLUETOOTH_ADMIN permission"); if (!BluetoothDevice.checkBluetoothAddress(address)) { return false; } @@ -522,7 +542,8 @@ public class BluetoothDeviceService extends IBluetoothDevice.Stub { private native boolean clearRemoteAliasNative(String address); public synchronized boolean disconnectRemoteDeviceAcl(String address) { - checkPermissionBluetoothAdmin(); + mContext.enforceCallingOrSelfPermission(BLUETOOTH_ADMIN_PERM, + "Need BLUETOOTH_ADMIN permission"); if (!BluetoothDevice.checkBluetoothAddress(address)) { return false; } @@ -546,7 +567,8 @@ public class BluetoothDeviceService extends IBluetoothDevice.Stub { * @see android.bluetooth.PasskeyAgent */ public synchronized boolean createBonding(String address, IBluetoothDeviceCallback callback) { - checkPermissionBluetoothAdmin(); + mContext.enforceCallingOrSelfPermission(BLUETOOTH_ADMIN_PERM, + "Need BLUETOOTH_ADMIN permission"); if (!BluetoothDevice.checkBluetoothAddress(address)) { return false; } @@ -568,9 +590,19 @@ public class BluetoothDeviceService extends IBluetoothDevice.Stub { callbacks.remove(address); return false; } + mOutgoingBondingDevAddress = address; return true; } + private native boolean createBondingNative(String address, int timeout_ms); + + /*package*/ String getOutgoingBondingDevAddress() { + return mOutgoingBondingDevAddress; + } + + /*package*/ void setOutgoingBondingDevAddress(String outgoingBondingDevAddress) { + mOutgoingBondingDevAddress = outgoingBondingDevAddress; + } /** * This method cancels a pending bonding request. @@ -593,7 +625,8 @@ public class BluetoothDeviceService extends IBluetoothDevice.Stub { * @see #listBondings */ public synchronized boolean cancelBondingProcess(String address) { - checkPermissionBluetoothAdmin(); + mContext.enforceCallingOrSelfPermission(BLUETOOTH_ADMIN_PERM, + "Need BLUETOOTH_ADMIN permission"); if (!BluetoothDevice.checkBluetoothAddress(address)) { return false; } @@ -618,7 +651,8 @@ public class BluetoothDeviceService extends IBluetoothDevice.Stub { * @see #listBondings */ public synchronized boolean removeBonding(String address) { - checkPermissionBluetoothAdmin(); + mContext.enforceCallingOrSelfPermission(BLUETOOTH_ADMIN_PERM, + "Need BLUETOOTH_ADMIN permission"); if (!BluetoothDevice.checkBluetoothAddress(address)) { return false; } @@ -627,7 +661,7 @@ public class BluetoothDeviceService extends IBluetoothDevice.Stub { private native boolean removeBondingNative(String address); public synchronized boolean hasBonding(String address) { - checkPermissionBluetooth(); + mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission"); if (!BluetoothDevice.checkBluetoothAddress(address)) { return false; } @@ -636,7 +670,7 @@ public class BluetoothDeviceService extends IBluetoothDevice.Stub { private native boolean hasBondingNative(String address); public synchronized String[] listAclConnections() { - checkPermissionBluetooth(); + mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission"); return listConnectionsNative(); } private native String[] listConnectionsNative(); @@ -652,7 +686,7 @@ public class BluetoothDeviceService extends IBluetoothDevice.Stub { * remote devices that this adapter is aware of. */ public synchronized String[] listRemoteDevices() { - checkPermissionBluetooth(); + mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission"); return listRemoteDevicesNative(); } private native String[] listRemoteDevicesNative(); @@ -666,7 +700,7 @@ public class BluetoothDeviceService extends IBluetoothDevice.Stub { * Bluetooth-chip version. */ public synchronized String getVersion() { - checkPermissionBluetooth(); + mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission"); return getVersionNative(); } private native String getVersionNative(); @@ -683,7 +717,7 @@ public class BluetoothDeviceService extends IBluetoothDevice.Stub { * @return The HCI revision of this adapter. */ public synchronized String getRevision() { - checkPermissionBluetooth(); + mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission"); return getRevisionNative(); } private native String getRevisionNative(); @@ -697,7 +731,7 @@ public class BluetoothDeviceService extends IBluetoothDevice.Stub { * @return Manufacturer name. */ public synchronized String getManufacturer() { - checkPermissionBluetooth(); + mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission"); return getManufacturerNative(); } private native String getManufacturerNative(); @@ -716,7 +750,7 @@ public class BluetoothDeviceService extends IBluetoothDevice.Stub { * @return company name */ public synchronized String getCompany() { - checkPermissionBluetooth(); + mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission"); return getCompanyNative(); } private native String getCompanyNative(); @@ -731,7 +765,7 @@ public class BluetoothDeviceService extends IBluetoothDevice.Stub { * @see #getVersion */ public synchronized String getRemoteVersion(String address) { - checkPermissionBluetooth(); + mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission"); if (!BluetoothDevice.checkBluetoothAddress(address)) { return null; } @@ -749,7 +783,7 @@ public class BluetoothDeviceService extends IBluetoothDevice.Stub { * @see #getRevision */ public synchronized String getRemoteRevision(String address) { - checkPermissionBluetooth(); + mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission"); if (!BluetoothDevice.checkBluetoothAddress(address)) { return null; } @@ -767,7 +801,7 @@ public class BluetoothDeviceService extends IBluetoothDevice.Stub { * @see #getManufacturer */ public synchronized String getRemoteManufacturer(String address) { - checkPermissionBluetooth(); + mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission"); if (!BluetoothDevice.checkBluetoothAddress(address)) { return null; } @@ -785,7 +819,7 @@ public class BluetoothDeviceService extends IBluetoothDevice.Stub { * @see #getCompany */ public synchronized String getRemoteCompany(String address) { - checkPermissionBluetooth(); + mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission"); if (!BluetoothDevice.checkBluetoothAddress(address)) { return null; } @@ -801,7 +835,7 @@ public class BluetoothDeviceService extends IBluetoothDevice.Stub { * @return a String with the timestamp. */ public synchronized String lastSeen(String address) { - checkPermissionBluetooth(); + mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission"); if (!BluetoothDevice.checkBluetoothAddress(address)) { return null; } @@ -817,7 +851,7 @@ public class BluetoothDeviceService extends IBluetoothDevice.Stub { * @return a String with the timestamp. */ public synchronized String lastUsed(String address) { - checkPermissionBluetooth(); + mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission"); if (!BluetoothDevice.checkBluetoothAddress(address)) { return null; } @@ -841,7 +875,7 @@ public class BluetoothDeviceService extends IBluetoothDevice.Stub { */ public synchronized String getRemoteMajorClass(String address) { if (!BluetoothDevice.checkBluetoothAddress(address)) { - checkPermissionBluetooth(); + mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission"); return null; } return getRemoteMajorClassNative(address); @@ -863,7 +897,7 @@ public class BluetoothDeviceService extends IBluetoothDevice.Stub { * @see #getRemoteClass */ public synchronized String getRemoteMinorClass(String address) { - checkPermissionBluetooth(); + mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission"); if (!BluetoothDevice.checkBluetoothAddress(address)) { return null; } @@ -880,7 +914,7 @@ public class BluetoothDeviceService extends IBluetoothDevice.Stub { * @see #getRemoteClass */ public synchronized String[] getRemoteServiceClasses(String address) { - checkPermissionBluetooth(); + mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission"); if (!BluetoothDevice.checkBluetoothAddress(address)) { return null; } @@ -904,7 +938,7 @@ public class BluetoothDeviceService extends IBluetoothDevice.Stub { */ public synchronized int getRemoteClass(String address) { if (!BluetoothDevice.checkBluetoothAddress(address)) { - checkPermissionBluetooth(); + mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission"); return -1; } return getRemoteClassNative(address); @@ -919,7 +953,7 @@ public class BluetoothDeviceService extends IBluetoothDevice.Stub { * @return byte array of features. */ public synchronized byte[] getRemoteFeatures(String address) { - checkPermissionBluetooth(); + mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission"); if (!BluetoothDevice.checkBluetoothAddress(address)) { return null; } @@ -944,7 +978,7 @@ public class BluetoothDeviceService extends IBluetoothDevice.Stub { * @see #getRemoteServiceRecord */ public synchronized int[] getRemoteServiceHandles(String address, String match) { - checkPermissionBluetooth(); + mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission"); if (!BluetoothDevice.checkBluetoothAddress(address)) { return null; } @@ -974,7 +1008,7 @@ public class BluetoothDeviceService extends IBluetoothDevice.Stub { * @see #getRemoteServiceHandles */ public synchronized byte[] getRemoteServiceRecord(String address, int handle) { - checkPermissionBluetooth(); + mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission"); if (!BluetoothDevice.checkBluetoothAddress(address)) { return null; } @@ -985,7 +1019,7 @@ public class BluetoothDeviceService extends IBluetoothDevice.Stub { // AIDL does not yet support short's public synchronized boolean getRemoteServiceChannel(String address, int uuid16, IBluetoothDeviceCallback callback) { - checkPermissionBluetooth(); + mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission"); if (!BluetoothDevice.checkBluetoothAddress(address)) { return false; } @@ -1011,7 +1045,8 @@ public class BluetoothDeviceService extends IBluetoothDevice.Stub { private native boolean getRemoteServiceChannelNative(String address, short uuid16); public synchronized boolean setPin(String address, byte[] pin) { - checkPermissionBluetoothAdmin(); + mContext.enforceCallingOrSelfPermission(BLUETOOTH_ADMIN_PERM, + "Need BLUETOOTH_ADMIN permission"); if (pin == null || pin.length <= 0 || pin.length > 16 || !BluetoothDevice.checkBluetoothAddress(address)) { return false; @@ -1036,7 +1071,8 @@ public class BluetoothDeviceService extends IBluetoothDevice.Stub { private native boolean setPinNative(String address, String pin, int nativeData); public synchronized boolean cancelPin(String address) { - checkPermissionBluetoothAdmin(); + mContext.enforceCallingOrSelfPermission(BLUETOOTH_ADMIN_PERM, + "Need BLUETOOTH_ADMIN permission"); if (!BluetoothDevice.checkBluetoothAddress(address)) { return false; } @@ -1061,7 +1097,7 @@ public class BluetoothDeviceService extends IBluetoothDevice.Stub { // some random app is not sending this intent and disabling bluetooth boolean enabled = !isAirplaneModeOn(); // If bluetooth is currently expected to be on, then enable or disable bluetooth - if (Settings.System.getInt(resolver, Settings.System.BLUETOOTH_ON, 0) > 0) { + if (Settings.Secure.getInt(resolver, Settings.Secure.BLUETOOTH_ON, 0) > 0) { if (enabled) { enable(null); } else { @@ -1089,25 +1125,6 @@ public class BluetoothDeviceService extends IBluetoothDevice.Stub { Settings.System.AIRPLANE_MODE_ON, 0) == 1; } - private static final String BLUETOOTH_ADMIN = android.Manifest.permission.BLUETOOTH_ADMIN; - private static final String BLUETOOTH = android.Manifest.permission.BLUETOOTH; - - private void checkPermissionBluetoothAdmin() { - if (mContext.checkCallingOrSelfPermission(BLUETOOTH_ADMIN) != - PackageManager.PERMISSION_GRANTED) { - throw new SecurityException("Requires BLUETOOTH_ADMIN permission"); - } - } - - private void checkPermissionBluetooth() { - if (mContext.checkCallingOrSelfPermission(BLUETOOTH_ADMIN) != - PackageManager.PERMISSION_GRANTED && - mContext.checkCallingOrSelfPermission(BLUETOOTH) != - PackageManager.PERMISSION_GRANTED ) { - throw new SecurityException("Requires BLUETOOTH or BLUETOOTH_ADMIN permission"); - } - } - private static final String DISABLE_ESCO_PATH = "/sys/module/sco/parameters/disable_esco"; private static void disableEsco() { try { @@ -1124,7 +1141,7 @@ public class BluetoothDeviceService extends IBluetoothDevice.Stub { pw.println("\nBluetooth ENABLED: " + getAddress() + " (" + getName() + ")"); pw.println("\nisDiscovering() = " + isDiscovering()); - BluetoothHeadset headset = new BluetoothHeadset(mContext); + BluetoothHeadset headset = new BluetoothHeadset(mContext, null); pw.println("\n--Bondings--"); String[] addresses = listBondings(); diff --git a/core/java/android/server/BluetoothEventLoop.java b/core/java/android/server/BluetoothEventLoop.java index 5722f51a68f26..2d8aaccfb9bfe 100644 --- a/core/java/android/server/BluetoothEventLoop.java +++ b/core/java/android/server/BluetoothEventLoop.java @@ -16,6 +16,7 @@ package android.server; +import android.bluetooth.BluetoothClass.Device; import android.bluetooth.BluetoothDevice; import android.bluetooth.BluetoothIntent; import android.bluetooth.IBluetoothDeviceCallback; @@ -24,8 +25,6 @@ import android.content.Intent; import android.os.RemoteException; import android.util.Log; -import java.io.IOException; -import java.lang.Thread; import java.util.HashMap; /** @@ -45,10 +44,13 @@ class BluetoothEventLoop { private HashMap mCreateBondingCallbacks; private HashMap mPasskeyAgentRequestData; private HashMap mGetRemoteServiceChannelCallbacks; - private BluetoothDeviceService mBluetoothService; - + private HashMap mDefaultPinData; + private BluetoothDeviceService mBluetoothService; private Context mContext; + private static final String BLUETOOTH_ADMIN_PERM = android.Manifest.permission.BLUETOOTH_ADMIN; + private static final String BLUETOOTH_PERM = android.Manifest.permission.BLUETOOTH; + static { classInitNative(); } private static native void classInitNative(); @@ -58,6 +60,7 @@ class BluetoothEventLoop { mCreateBondingCallbacks = new HashMap(); mPasskeyAgentRequestData = new HashMap(); mGetRemoteServiceChannelCallbacks = new HashMap(); + mDefaultPinData = new HashMap(); initializeNativeDataNative(); } private native void initializeNativeDataNative(); @@ -146,27 +149,28 @@ class BluetoothEventLoop { intMode = BluetoothDevice.MODE_DISCOVERABLE; } intent.putExtra(BluetoothIntent.MODE, intMode); - mContext.sendBroadcast(intent); + mContext.sendBroadcast(intent, BLUETOOTH_PERM); } public void onDiscoveryStarted() { mBluetoothService.setIsDiscovering(true); Intent intent = new Intent(BluetoothIntent.DISCOVERY_STARTED_ACTION); - mContext.sendBroadcast(intent); + mContext.sendBroadcast(intent, BLUETOOTH_PERM); } public void onDiscoveryCompleted() { mBluetoothService.setIsDiscovering(false); Intent intent = new Intent(BluetoothIntent.DISCOVERY_COMPLETED_ACTION); - mContext.sendBroadcast(intent); + mContext.sendBroadcast(intent, BLUETOOTH_PERM); } public void onPairingRequest() { Intent intent = new Intent(BluetoothIntent.PAIRING_REQUEST_ACTION); - mContext.sendBroadcast(intent); + mContext.sendBroadcast(intent, BLUETOOTH_ADMIN_PERM); } + public void onPairingCancel() { Intent intent = new Intent(BluetoothIntent.PAIRING_CANCEL_ACTION); - mContext.sendBroadcast(intent); + mContext.sendBroadcast(intent, BLUETOOTH_ADMIN_PERM); } public void onRemoteDeviceFound(String address, int deviceClass, short rssi) { @@ -174,64 +178,65 @@ class BluetoothEventLoop { intent.putExtra(BluetoothIntent.ADDRESS, address); intent.putExtra(BluetoothIntent.CLASS, deviceClass); intent.putExtra(BluetoothIntent.RSSI, rssi); - mContext.sendBroadcast(intent); + mContext.sendBroadcast(intent, BLUETOOTH_PERM); } public void onRemoteDeviceDisappeared(String address) { Intent intent = new Intent(BluetoothIntent.REMOTE_DEVICE_DISAPPEARED_ACTION); intent.putExtra(BluetoothIntent.ADDRESS, address); - mContext.sendBroadcast(intent); + mContext.sendBroadcast(intent, BLUETOOTH_PERM); } public void onRemoteClassUpdated(String address, int deviceClass) { Intent intent = new Intent(BluetoothIntent.REMOTE_DEVICE_CLASS_UPDATED_ACTION); intent.putExtra(BluetoothIntent.ADDRESS, address); intent.putExtra(BluetoothIntent.CLASS, deviceClass); - mContext.sendBroadcast(intent); + mContext.sendBroadcast(intent, BLUETOOTH_PERM); } public void onRemoteDeviceConnected(String address) { Intent intent = new Intent(BluetoothIntent.REMOTE_DEVICE_CONNECTED_ACTION); intent.putExtra(BluetoothIntent.ADDRESS, address); - mContext.sendBroadcast(intent); + mContext.sendBroadcast(intent, BLUETOOTH_PERM); } public void onRemoteDeviceDisconnectRequested(String address) { Intent intent = new Intent(BluetoothIntent.REMOTE_DEVICE_DISCONNECT_REQUESTED_ACTION); intent.putExtra(BluetoothIntent.ADDRESS, address); - mContext.sendBroadcast(intent); + mContext.sendBroadcast(intent, BLUETOOTH_PERM); } public void onRemoteDeviceDisconnected(String address) { Intent intent = new Intent(BluetoothIntent.REMOTE_DEVICE_DISCONNECTED_ACTION); intent.putExtra(BluetoothIntent.ADDRESS, address); - mContext.sendBroadcast(intent); + mContext.sendBroadcast(intent, BLUETOOTH_PERM); } public void onRemoteNameUpdated(String address, String name) { Intent intent = new Intent(BluetoothIntent.REMOTE_NAME_UPDATED_ACTION); intent.putExtra(BluetoothIntent.ADDRESS, address); intent.putExtra(BluetoothIntent.NAME, name); - mContext.sendBroadcast(intent); + mContext.sendBroadcast(intent, BLUETOOTH_PERM); } public void onRemoteNameFailed(String address) { Intent intent = new Intent(BluetoothIntent.REMOTE_NAME_FAILED_ACTION); intent.putExtra(BluetoothIntent.ADDRESS, address); - mContext.sendBroadcast(intent); + mContext.sendBroadcast(intent, BLUETOOTH_PERM); } public void onRemoteNameChanged(String address, String name) { Intent intent = new Intent(BluetoothIntent.REMOTE_NAME_UPDATED_ACTION); intent.putExtra(BluetoothIntent.ADDRESS, address); intent.putExtra(BluetoothIntent.NAME, name); - mContext.sendBroadcast(intent); + mContext.sendBroadcast(intent, BLUETOOTH_PERM); } public void onRemoteAliasChanged(String address, String alias) { Intent intent = new Intent(BluetoothIntent.REMOTE_ALIAS_CHANGED_ACTION); intent.putExtra(BluetoothIntent.ADDRESS, address); intent.putExtra(BluetoothIntent.ALIAS, alias); - mContext.sendBroadcast(intent); + mContext.sendBroadcast(intent, BLUETOOTH_PERM); } public void onRemoteAliasCleared(String address) { Intent intent = new Intent(BluetoothIntent.REMOTE_ALIAS_CLEARED_ACTION); intent.putExtra(BluetoothIntent.ADDRESS, address); - mContext.sendBroadcast(intent); + mContext.sendBroadcast(intent, BLUETOOTH_PERM); } private void onCreateBondingResult(String address, boolean result) { + mBluetoothService.setOutgoingBondingDevAddress(null); IBluetoothDeviceCallback callback = mCreateBondingCallbacks.get(address); if (callback != null) { try { @@ -240,39 +245,71 @@ class BluetoothEventLoop { BluetoothDevice.RESULT_FAILURE); } catch (RemoteException e) {} mCreateBondingCallbacks.remove(address); - } + } } + public void onBondingCreated(String address) { Intent intent = new Intent(BluetoothIntent.BONDING_CREATED_ACTION); intent.putExtra(BluetoothIntent.ADDRESS, address); - mContext.sendBroadcast(intent); + mContext.sendBroadcast(intent, BLUETOOTH_PERM); } + public void onBondingRemoved(String address) { Intent intent = new Intent(BluetoothIntent.BONDING_REMOVED_ACTION); intent.putExtra(BluetoothIntent.ADDRESS, address); - mContext.sendBroadcast(intent); + mContext.sendBroadcast(intent, BLUETOOTH_PERM); + + if (mDefaultPinData.containsKey(address)) { + mDefaultPinData.remove(address); + } } public void onNameChanged(String name) { Intent intent = new Intent(BluetoothIntent.NAME_CHANGED_ACTION); intent.putExtra(BluetoothIntent.NAME, name); - mContext.sendBroadcast(intent); + mContext.sendBroadcast(intent, BLUETOOTH_PERM); } public void onPasskeyAgentRequest(String address, int nativeData) { - mPasskeyAgentRequestData.put(address, new Integer(nativeData)); + mPasskeyAgentRequestData.put(address, new Integer(nativeData)); + + if (address.equals(mBluetoothService.getOutgoingBondingDevAddress())) { + int btClass = mBluetoothService.getRemoteClass(address); + int remoteDeviceClass = Device.getDevice(btClass); + if (remoteDeviceClass == Device.AUDIO_VIDEO_WEARABLE_HEADSET || + remoteDeviceClass == Device.AUDIO_VIDEO_HANDSFREE || + remoteDeviceClass == Device.AUDIO_VIDEO_HEADPHONES || + remoteDeviceClass == Device.AUDIO_VIDEO_PORTABLE_AUDIO || + remoteDeviceClass == Device.AUDIO_VIDEO_CAR_AUDIO || + remoteDeviceClass == Device.AUDIO_VIDEO_HIFI_AUDIO) { + if (!mDefaultPinData.containsKey(address)) { + mDefaultPinData.put(address, false); + } + if (!mDefaultPinData.get(address)) { + mDefaultPinData.remove(address); + mDefaultPinData.put(address, true); + mBluetoothService.setPin(address, BluetoothDevice.convertPinToBytes("0000")); + return; + } + } + } Intent intent = new Intent(BluetoothIntent.PAIRING_REQUEST_ACTION); intent.putExtra(BluetoothIntent.ADDRESS, address); - mContext.sendBroadcast(intent); + mContext.sendBroadcast(intent, BLUETOOTH_ADMIN_PERM); } + public void onPasskeyAgentCancel(String address) { mPasskeyAgentRequestData.remove(address); - + if (mDefaultPinData.containsKey(address)) { + mDefaultPinData.remove(address); + mDefaultPinData.put(address, false); + } Intent intent = new Intent(BluetoothIntent.PAIRING_CANCEL_ACTION); intent.putExtra(BluetoothIntent.ADDRESS, address); - mContext.sendBroadcast(intent); + mContext.sendBroadcast(intent, BLUETOOTH_ADMIN_PERM); } + private void onGetRemoteServiceChannelResult(String address, int channel) { IBluetoothDeviceCallback callback = mGetRemoteServiceChannelCallbacks.get(address); if (callback != null) { diff --git a/core/java/android/server/checkin/FallbackCheckinService.java b/core/java/android/server/checkin/FallbackCheckinService.java index b450913cf5e62..65921af5038b5 100644 --- a/core/java/android/server/checkin/FallbackCheckinService.java +++ b/core/java/android/server/checkin/FallbackCheckinService.java @@ -42,4 +42,8 @@ public final class FallbackCheckinService extends ICheckinService.Stub { state.isEnabled = false; p.onResult(state); } + + public void getParentalControlState(IParentalControlCallback p, String requestingApp) + throws android.os.RemoteException { + } } diff --git a/core/java/android/server/search/SearchableInfo.java b/core/java/android/server/search/SearchableInfo.java index 5b9942e2224df..6c8f55487c0e7 100644 --- a/core/java/android/server/search/SearchableInfo.java +++ b/core/java/android/server/search/SearchableInfo.java @@ -402,7 +402,7 @@ public final class SearchableInfo implements Parcelable { // initialize as an "unsearchable" object mSearchable = false; mSearchActivity = cName; - + // to access another activity's resources, I need its context. // BE SURE to release the cache sometime after construction - it's a large object to hold mCacheActivityContext = getActivityContext(context); @@ -415,6 +415,7 @@ public final class SearchableInfo implements Parcelable { mIconId = a.getResourceId(com.android.internal.R.styleable.Searchable_icon, 0); mSearchButtonText = a.getResourceId( com.android.internal.R.styleable.Searchable_searchButtonText, 0); + setSearchModeFlags(); if (DBG_INHIBIT_SUGGESTIONS == 0) { mSuggestAuthority = a.getString( diff --git a/core/java/android/speech/recognition/AbstractEmbeddedGrammarListener.java b/core/java/android/speech/recognition/AbstractEmbeddedGrammarListener.java deleted file mode 100644 index c25a7e3983498..0000000000000 --- a/core/java/android/speech/recognition/AbstractEmbeddedGrammarListener.java +++ /dev/null @@ -1,51 +0,0 @@ -/*---------------------------------------------------------------------------* - * AbstractEmbeddedGrammarListener.java * - * * - * Copyright 2007, 2008 Nuance Communciations, Inc. * - * * - * Licensed under the Apache License, Version 2.0 (the 'License'); * - * you may not use this file except in compliance with the License. * - * * - * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 * - * * - * Unless required by applicable law or agreed to in writing, software * - * distributed under the License is distributed on an 'AS IS' BASIS, * - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * - * See the License for the specific language governing permissions and * - * limitations under the License. * - * * - *---------------------------------------------------------------------------*/ - -package android.speech.recognition; - -/** - * An EmbeddedGrammarListener whose methods are empty. This class exists as - * convenience for creating listener objects. - */ -public abstract class AbstractEmbeddedGrammarListener implements EmbeddedGrammarListener -{ - public void onCompileAllSlots() - { - } - - public void onError(Exception e) - { - } - - public void onLoaded() - { - } - - public void onResetAllSlots() - { - } - - public void onSaved(String path) - { - } - - public void onUnloaded() - { - } -} diff --git a/core/java/android/speech/recognition/AbstractGrammarListener.java b/core/java/android/speech/recognition/AbstractGrammarListener.java deleted file mode 100644 index fe6229086fcd5..0000000000000 --- a/core/java/android/speech/recognition/AbstractGrammarListener.java +++ /dev/null @@ -1,39 +0,0 @@ -/*---------------------------------------------------------------------------* - * AbstractGrammarListener.java * - * * - * Copyright 2007, 2008 Nuance Communciations, Inc. * - * * - * Licensed under the Apache License, Version 2.0 (the 'License'); * - * you may not use this file except in compliance with the License. * - * * - * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 * - * * - * Unless required by applicable law or agreed to in writing, software * - * distributed under the License is distributed on an 'AS IS' BASIS, * - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * - * See the License for the specific language governing permissions and * - * limitations under the License. * - * * - *---------------------------------------------------------------------------*/ - -package android.speech.recognition; - -/** - * A GrammarListener whose methods are empty. This class exists as convenience - * for creating listener objects. - */ -public abstract class AbstractGrammarListener implements GrammarListener -{ - public void onError(Exception e) - { - } - - public void onLoaded() - { - } - - public void onUnloaded() - { - } -} diff --git a/core/java/android/speech/recognition/AbstractRecognizerListener.java b/core/java/android/speech/recognition/AbstractRecognizerListener.java deleted file mode 100644 index ee2b8d14d0668..0000000000000 --- a/core/java/android/speech/recognition/AbstractRecognizerListener.java +++ /dev/null @@ -1,83 +0,0 @@ -/*---------------------------------------------------------------------------* - * AbstractRecognizerListener.java * - * * - * Copyright 2007, 2008 Nuance Communciations, Inc. * - * * - * Licensed under the Apache License, Version 2.0 (the 'License'); * - * you may not use this file except in compliance with the License. * - * * - * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 * - * * - * Unless required by applicable law or agreed to in writing, software * - * distributed under the License is distributed on an 'AS IS' BASIS, * - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * - * See the License for the specific language governing permissions and * - * limitations under the License. * - * * - *---------------------------------------------------------------------------*/ - -package android.speech.recognition; - -import java.util.Hashtable; -import java.util.Vector; - -/** - * A RecognizerListener whose methods are empty. This class exists as - * convenience for creating listener objects. - */ -public abstract class AbstractRecognizerListener implements RecognizerListener -{ - public void onBeginningOfSpeech() - { - } - - public void onEndOfSpeech() - { - } - - public void onRecognitionSuccess(RecognitionResult result) - { - } - - public void onRecognitionFailure(FailureReason reason) - { - } - - public void onError(Exception e) - { - } - - public void onParametersGetError(Vector parameters, Exception e) - { - } - - public void onParametersSetError(Hashtable parameters, - Exception e) - { - } - - public void onParametersGet(Hashtable parameters) - { - } - - public void onParametersSet(Hashtable parameters) - { - } - - public void onStartOfSpeechTimeout() - { - } - - public void onAcousticStateReset() - { - } - - public void onStarted() - { - } - - public void onStopped() - { - } -} diff --git a/core/java/android/speech/recognition/AbstractSrecGrammarListener.java b/core/java/android/speech/recognition/AbstractSrecGrammarListener.java deleted file mode 100644 index e62e4bab16261..0000000000000 --- a/core/java/android/speech/recognition/AbstractSrecGrammarListener.java +++ /dev/null @@ -1,59 +0,0 @@ -/*---------------------------------------------------------------------------* - * AbstractSrecGrammarListener.java * - * * - * Copyright 2007, 2008 Nuance Communciations, Inc. * - * * - * Licensed under the Apache License, Version 2.0 (the 'License'); * - * you may not use this file except in compliance with the License. * - * * - * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 * - * * - * Unless required by applicable law or agreed to in writing, software * - * distributed under the License is distributed on an 'AS IS' BASIS, * - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * - * See the License for the specific language governing permissions and * - * limitations under the License. * - * * - *---------------------------------------------------------------------------*/ - -package android.speech.recognition; - -/** - * An SrecGrammarListener whose methods are empty. This class exists as - * convenience for creating listener objects. - */ -public abstract class AbstractSrecGrammarListener implements SrecGrammarListener -{ - public void onCompileAllSlots() - { - } - - public void onError(Exception e) - { - } - - public void onLoaded() - { - } - - public void onResetAllSlots() - { - } - - public void onSaved(String path) - { - } - - public void onUnloaded() - { - } - - public void onAddItemList() - { - } - - public void onAddItemListFailure(int index, Exception e) - { - } -} diff --git a/core/java/android/speech/recognition/AudioAlreadyInUseException.java b/core/java/android/speech/recognition/AudioAlreadyInUseException.java deleted file mode 100644 index 90698a7014fcb..0000000000000 --- a/core/java/android/speech/recognition/AudioAlreadyInUseException.java +++ /dev/null @@ -1,34 +0,0 @@ -/*---------------------------------------------------------------------------* - * AudioAlreadyInUseException.java * - * * - * Copyright 2007, 2008 Nuance Communciations, Inc. * - * * - * Licensed under the Apache License, Version 2.0 (the 'License'); * - * you may not use this file except in compliance with the License. * - * * - * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 * - * * - * Unless required by applicable law or agreed to in writing, software * - * distributed under the License is distributed on an 'AS IS' BASIS, * - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * - * See the License for the specific language governing permissions and * - * limitations under the License. * - * * - *---------------------------------------------------------------------------*/ - -package android.speech.recognition; - -/** - * Thrown when an AudioStream is passed into a component when another component - * is already using it. - */ -public class AudioAlreadyInUseException extends IllegalArgumentException -{ - private static final long serialVersionUID = 0L; - - public AudioAlreadyInUseException(String msg) - { - super(msg); - } -} diff --git a/core/java/android/speech/recognition/AudioDriverErrorException.java b/core/java/android/speech/recognition/AudioDriverErrorException.java deleted file mode 100644 index a755e7f1a1a4d..0000000000000 --- a/core/java/android/speech/recognition/AudioDriverErrorException.java +++ /dev/null @@ -1,33 +0,0 @@ -/*---------------------------------------------------------------------------* - * AudioDriverErrorException.java * - * * - * Copyright 2007, 2008 Nuance Communciations, Inc. * - * * - * Licensed under the Apache License, Version 2.0 (the 'License'); * - * you may not use this file except in compliance with the License. * - * * - * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 * - * * - * Unless required by applicable law or agreed to in writing, software * - * distributed under the License is distributed on an 'AS IS' BASIS, * - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * - * See the License for the specific language governing permissions and * - * limitations under the License. * - * * - *---------------------------------------------------------------------------*/ - -package android.speech.recognition; - -/** - * Thrown if an error occurs in the audio driver. - */ -public class AudioDriverErrorException extends Exception -{ - private static final long serialVersionUID = 0L; - - public AudioDriverErrorException(String msg) - { - super(msg); - } -} diff --git a/core/java/android/speech/recognition/AudioSource.java b/core/java/android/speech/recognition/AudioSource.java deleted file mode 100644 index c4cd8020c4847..0000000000000 --- a/core/java/android/speech/recognition/AudioSource.java +++ /dev/null @@ -1,45 +0,0 @@ -/*---------------------------------------------------------------------------* - * AudioSource.java * - * * - * Copyright 2007, 2008 Nuance Communciations, Inc. * - * * - * Licensed under the Apache License, Version 2.0 (the 'License'); * - * you may not use this file except in compliance with the License. * - * * - * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 * - * * - * Unless required by applicable law or agreed to in writing, software * - * distributed under the License is distributed on an 'AS IS' BASIS, * - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * - * See the License for the specific language governing permissions and * - * limitations under the License. * - * * - *---------------------------------------------------------------------------*/ - -package android.speech.recognition; - -/** - * Generates audio data. - */ -public interface AudioSource -{ - /** - * Returns an object that contains the audio samples. This object - * is passed to other components that consumes it, such a Recognizer - * or a DeviceSpeaker. - * - * @return an AudioStream instance - */ - AudioStream createAudio(); - - /** - * Tells the audio source to start collecting audio samples. - */ - void start(); - - /** - * Tells the audio source to stop collecting audio samples. - */ - void stop(); -} diff --git a/core/java/android/speech/recognition/AudioSourceListener.java b/core/java/android/speech/recognition/AudioSourceListener.java deleted file mode 100644 index 42e8ebe5ef2e9..0000000000000 --- a/core/java/android/speech/recognition/AudioSourceListener.java +++ /dev/null @@ -1,44 +0,0 @@ -/*---------------------------------------------------------------------------* - * AudioSourceListener.java * - * * - * Copyright 2007, 2008 Nuance Communciations, Inc. * - * * - * Licensed under the Apache License, Version 2.0 (the 'License'); * - * you may not use this file except in compliance with the License. * - * * - * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 * - * * - * Unless required by applicable law or agreed to in writing, software * - * distributed under the License is distributed on an 'AS IS' BASIS, * - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * - * See the License for the specific language governing permissions and * - * limitations under the License. * - * * - *---------------------------------------------------------------------------*/ - -package android.speech.recognition; - -/** - * Listens for Microphone events. - */ -public interface AudioSourceListener -{ - /** - * Invoked after the microphone starts recording. - */ - void onStarted(); - - /** - * Invoked after the microphone stops recording. - */ - void onStopped(); - - /** - * Invoked when an unexpected error occurs. This is normally followed by - * onStopped() if the component shuts down successfully. - * - * @param e the cause of the failure - */ - void onError(Exception e); -} diff --git a/core/java/android/speech/recognition/AudioStream.java b/core/java/android/speech/recognition/AudioStream.java deleted file mode 100644 index 36afe213ad4ff..0000000000000 --- a/core/java/android/speech/recognition/AudioStream.java +++ /dev/null @@ -1,35 +0,0 @@ -/*---------------------------------------------------------------------------* - * AudioStream.java * - * * - * Copyright 2007, 2008 Nuance Communciations, Inc. * - * * - * Licensed under the Apache License, Version 2.0 (the 'License'); * - * you may not use this file except in compliance with the License. * - * * - * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 * - * * - * Unless required by applicable law or agreed to in writing, software * - * distributed under the License is distributed on an 'AS IS' BASIS, * - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * - * See the License for the specific language governing permissions and * - * limitations under the License. * - * * - *---------------------------------------------------------------------------*/ - -package android.speech.recognition; - -/** - * Stream used to read audio data. - */ -public interface AudioStream -{ - /** - * Releases resources associated with the object. - * - * @deprecated this method is deprecated and has no replacement. It will be - * removed in a future release of the API. - */ - @Deprecated - void dispose(); -} diff --git a/core/java/android/speech/recognition/Codec.java b/core/java/android/speech/recognition/Codec.java deleted file mode 100644 index 18d9e150313b6..0000000000000 --- a/core/java/android/speech/recognition/Codec.java +++ /dev/null @@ -1,126 +0,0 @@ -/*---------------------------------------------------------------------------* - * Codec.java * - * * - * Copyright 2007, 2008 Nuance Communciations, Inc. * - * * - * Licensed under the Apache License, Version 2.0 (the 'License'); * - * you may not use this file except in compliance with the License. * - * * - * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 * - * * - * Unless required by applicable law or agreed to in writing, software * - * distributed under the License is distributed on an 'AS IS' BASIS, * - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * - * See the License for the specific language governing permissions and * - * limitations under the License. * - * * - *---------------------------------------------------------------------------*/ - -package android.speech.recognition; - -/** - * Audio formats. - */ -public abstract class Codec -{ - /** - * PCM, 16 bits, 8KHz. - */ - public static final Codec PCM_16BIT_8K = new Codec("PCM/16bit/8KHz") - { - @Override - public byte getBitsPerSample() - { - return 16; - } - - @Override - public int getSampleRate() - { - return 8000; - } - }; - /** - * PCM, 16 bits, 11KHz. - */ - public static final Codec PCM_16BIT_11K = new Codec("PCM/16bit/11KHz") - { - @Override - public byte getBitsPerSample() - { - return 16; - } - - @Override - public int getSampleRate() - { - return 11025; - } - }; - /** - * PCM, 16 bits, 22KHz. - */ - public static final Codec PCM_16BIT_22K = new Codec("PCM/16bit/22KHz") - { - @Override - public byte getBitsPerSample() - { - return 16; - } - - @Override - public int getSampleRate() - { - return 22050; - } - }; - /** - * ULAW, 8 bits, 8KHz. - */ - public static final Codec ULAW_8BIT_8K = new Codec("ULAW/8bit/8KHz") - { - @Override - public byte getBitsPerSample() - { - return 8; - } - - @Override - public int getSampleRate() - { - return 8000; - } - }; - private final String message; - - /** - * Creates a new Codec. - * - * @param message the message to associate with the codec - */ - private Codec(String message) - { - this.message = message; - } - - @Override - public String toString() - { - return message; - } - - /** - * Returns the codec sample-rate. - * - * @return the codec sample-rate - */ - public abstract int getSampleRate(); - - /** - * Returns the codec bitrate. - * - * @return the codec bitrate - */ - public abstract byte getBitsPerSample(); -} diff --git a/core/java/android/speech/recognition/DeviceSpeaker.java b/core/java/android/speech/recognition/DeviceSpeaker.java deleted file mode 100644 index bd1868714166e..0000000000000 --- a/core/java/android/speech/recognition/DeviceSpeaker.java +++ /dev/null @@ -1,77 +0,0 @@ -/*---------------------------------------------------------------------------* - * DeviceSpeaker.java * - * * - * Copyright 2007, 2008 Nuance Communciations, Inc. * - * * - * Licensed under the Apache License, Version 2.0 (the 'License'); * - * you may not use this file except in compliance with the License. * - * * - * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 * - * * - * Unless required by applicable law or agreed to in writing, software * - * distributed under the License is distributed on an 'AS IS' BASIS, * - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * - * See the License for the specific language governing permissions and * - * limitations under the License. * - * * - *---------------------------------------------------------------------------*/ - -package android.speech.recognition; - -import android.speech.recognition.impl.DeviceSpeakerImpl; - -/** - * A device for transforming electric signals into audible sound, most - * frequently used to reproduce speech and music. - */ -public abstract class DeviceSpeaker -{ - private static DeviceSpeaker instance; - - /** - * Returns the device speaker instance. - * - * @return an instance of a DeviceSpeaker class. - */ - public static DeviceSpeaker getInstance() - { - instance = DeviceSpeakerImpl.getInstance(); - return instance; - } - - /** - * Starts the audio playback. - * - * @param source the audio to play - * @throws IllegalStateException if the component is already started - * @throws IllegalArgumentException if source audio is null, in-use by - * another component or is empty. - * - */ - public abstract void start(AudioStream source) throws IllegalStateException, - IllegalArgumentException; - - /** - * Stops audio playback. - */ - public abstract void stop(); - - /** - * Sets the playback codec. This must be called before start() is called. - * - * @param playbackCodec the codec to use for the playback operation. - * @throws IllegalStateException if the component is already stopped - * @throws IllegalArgumentException if the specified codec is not supported - */ - public abstract void setCodec(Codec playbackCodec) throws IllegalStateException, - IllegalArgumentException; - - /** - * Sets the microphone listener. - * - * @param listener the device speaker listener. - * @throws IllegalStateException if the component is started - */ - public abstract void setListener(DeviceSpeakerListener listener) throws IllegalStateException; -} diff --git a/core/java/android/speech/recognition/DeviceSpeakerListener.java b/core/java/android/speech/recognition/DeviceSpeakerListener.java deleted file mode 100644 index e2baa2e115c7c..0000000000000 --- a/core/java/android/speech/recognition/DeviceSpeakerListener.java +++ /dev/null @@ -1,44 +0,0 @@ -/*---------------------------------------------------------------------------* - * DeviceSpeakerListener.java * - * * - * Copyright 2007, 2008 Nuance Communciations, Inc. * - * * - * Licensed under the Apache License, Version 2.0 (the 'License'); * - * you may not use this file except in compliance with the License. * - * * - * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 * - * * - * Unless required by applicable law or agreed to in writing, software * - * distributed under the License is distributed on an 'AS IS' BASIS, * - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * - * See the License for the specific language governing permissions and * - * limitations under the License. * - * * - *---------------------------------------------------------------------------*/ - -package android.speech.recognition; - -/** - * Listens for DeviceSpeaker events. - */ -public interface DeviceSpeakerListener -{ - /** - * Invoked after playback begins. - */ - void onStarted(); - - /** - * Invoked after playback terminates. - */ - void onStopped(); - - /** - * Invoked when an unexpected error occurs. This is normally followed by - * onStopped() if the component shuts down successfully. - * - * @param e the cause of the failure - */ - void onError(Exception e); -} diff --git a/core/java/android/speech/recognition/EmbeddedGrammar.java b/core/java/android/speech/recognition/EmbeddedGrammar.java deleted file mode 100644 index c6f037b5fa73c..0000000000000 --- a/core/java/android/speech/recognition/EmbeddedGrammar.java +++ /dev/null @@ -1,43 +0,0 @@ -/*---------------------------------------------------------------------------* - * EmbeddedGrammar.java * - * * - * Copyright 2007, 2008 Nuance Communciations, Inc. * - * * - * Licensed under the Apache License, Version 2.0 (the 'License'); * - * you may not use this file except in compliance with the License. * - * * - * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 * - * * - * Unless required by applicable law or agreed to in writing, software * - * distributed under the License is distributed on an 'AS IS' BASIS, * - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * - * See the License for the specific language governing permissions and * - * limitations under the License. * - * * - *---------------------------------------------------------------------------*/ - -package android.speech.recognition; - -/** - * Grammar on an embedded recognizer. - */ -public interface EmbeddedGrammar extends Grammar -{ - /** - * Compiles items that were added to any of the grammar slots. - */ - void compileAllSlots(); - - /** - * Removes all words added to all slots. - */ - void resetAllSlots(); - - /** - * Saves the compiled grammar. - * - * @param url the url to save the grammar to - */ - void save(String url); -} diff --git a/core/java/android/speech/recognition/EmbeddedGrammarListener.java b/core/java/android/speech/recognition/EmbeddedGrammarListener.java deleted file mode 100644 index 5b8c1a49b2d00..0000000000000 --- a/core/java/android/speech/recognition/EmbeddedGrammarListener.java +++ /dev/null @@ -1,58 +0,0 @@ -/*---------------------------------------------------------------------------* - * EmbeddedGrammarListener.java * - * * - * Copyright 2007, 2008 Nuance Communciations, Inc. * - * * - * Licensed under the Apache License, Version 2.0 (the 'License'); * - * you may not use this file except in compliance with the License. * - * * - * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 * - * * - * Unless required by applicable law or agreed to in writing, software * - * distributed under the License is distributed on an 'AS IS' BASIS, * - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * - * See the License for the specific language governing permissions and * - * limitations under the License. * - * * - *---------------------------------------------------------------------------*/ - -package android.speech.recognition; - -/** - * Listens for EmbeddedGrammar events. - */ -public interface EmbeddedGrammarListener extends GrammarListener -{ - /** - * Invoked after the grammar is saved. - * - * @param path the path the grammar was saved to - */ - void onSaved(String path); - - /** - * Invoked when a grammar operation fails. - * - * @param e the cause of the failure.
    - * {@link GrammarOverflowException} if the grammar slot is full and no - * further items may be added to it.
    - * {@link java.lang.UnsupportedOperationException} if different words with - * the same pronunciation are added.
    - * {@link java.lang.IllegalStateException} if reseting or compiling the - * slots fails.
    - * {@link java.io.IOException} if the grammar could not be loaded or - * saved.

    - */ - void onError(Exception e); - - /** - * Invokes after all grammar slots have been compiled. - */ - void onCompileAllSlots(); - - /** - * Invokes after all grammar slots have been reset. - */ - void onResetAllSlots(); -} diff --git a/core/java/android/speech/recognition/EmbeddedRecognizer.java b/core/java/android/speech/recognition/EmbeddedRecognizer.java deleted file mode 100644 index cd79edc68e8f8..0000000000000 --- a/core/java/android/speech/recognition/EmbeddedRecognizer.java +++ /dev/null @@ -1,66 +0,0 @@ -/*---------------------------------------------------------------------------* - * EmbeddedRecognizer.java * - * * - * Copyright 2007, 2008 Nuance Communciations, Inc. * - * * - * Licensed under the Apache License, Version 2.0 (the 'License'); * - * you may not use this file except in compliance with the License. * - * * - * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 * - * * - * Unless required by applicable law or agreed to in writing, software * - * distributed under the License is distributed on an 'AS IS' BASIS, * - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * - * See the License for the specific language governing permissions and * - * limitations under the License. * - * * - *---------------------------------------------------------------------------*/ - -package android.speech.recognition; - -import java.io.FileNotFoundException; -import java.io.IOException; -import android.speech.recognition.impl.EmbeddedRecognizerImpl; - -/** - * Embedded recognizer. - */ -public abstract class EmbeddedRecognizer implements Recognizer -{ - private static EmbeddedRecognizer instance; - - /** - * Returns the embedded recognizer. - * - * @return the embedded recognizer - */ - public static EmbeddedRecognizer getInstance() - { - instance = EmbeddedRecognizerImpl.getInstance(); - return instance; - } - - /** - * Configures the recognizer. - * - * @param config recognizer configuration file - * @throws IllegalArgumentException if config is null or an empty string - * @throws FileNotFoundException if the specified file could not be found - * @throws IOException if the specified file could not be opened - * @throws UnsatisfiedLinkError if the recognizer plugin could not be loaded - * @throws ClassNotFoundException if the recognizer plugin could not be found - */ - public abstract void configure(String config) throws IllegalArgumentException, - FileNotFoundException, IOException, UnsatisfiedLinkError, - ClassNotFoundException; - - /** - * The recognition accuracy improves over time as the recognizer adapts to - * the surrounding environment. This method enables developers to reset the - * adaptation when the environment is known to have changed. - * - * @throws IllegalArgumentException if recognizer instance is null - */ - public abstract void resetAcousticState() throws IllegalArgumentException; -} diff --git a/core/java/android/speech/recognition/Grammar.java b/core/java/android/speech/recognition/Grammar.java deleted file mode 100644 index 9f1b624b7c4ac..0000000000000 --- a/core/java/android/speech/recognition/Grammar.java +++ /dev/null @@ -1,43 +0,0 @@ -/*---------------------------------------------------------------------------* - * Grammar.java * - * * - * Copyright 2007, 2008 Nuance Communciations, Inc. * - * * - * Licensed under the Apache License, Version 2.0 (the 'License'); * - * you may not use this file except in compliance with the License. * - * * - * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 * - * * - * Unless required by applicable law or agreed to in writing, software * - * distributed under the License is distributed on an 'AS IS' BASIS, * - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * - * See the License for the specific language governing permissions and * - * limitations under the License. * - * * - *---------------------------------------------------------------------------*/ - -package android.speech.recognition; - -/** - * Speech recognition grammar. - */ -public interface Grammar { - /** - * Load the grammar sets the grammar state to active, indicating that can be used in a recognition process. - * Multiple grammars can be loaded, but only one at a time can be used by the recognizer. - * - */ - void load(); - - /** - * Unload the grammar sets the grammar state to inactive (inactive grammars can not be used as a parameter of a recognition). - */ - void unload(); - - /** - * (Optional operation) Releases resources associated with the object. The - * grammar may not be used past this point. - */ - void dispose(); -} diff --git a/core/java/android/speech/recognition/GrammarErrorException.java b/core/java/android/speech/recognition/GrammarErrorException.java deleted file mode 100644 index 607075839e2ee..0000000000000 --- a/core/java/android/speech/recognition/GrammarErrorException.java +++ /dev/null @@ -1,33 +0,0 @@ -/*---------------------------------------------------------------------------* - * GrammarErrorException.java * - * * - * Copyright 2007, 2008 Nuance Communciations, Inc. * - * * - * Licensed under the Apache License, Version 2.0 (the 'License'); * - * you may not use this file except in compliance with the License. * - * * - * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 * - * * - * Unless required by applicable law or agreed to in writing, software * - * distributed under the License is distributed on an 'AS IS' BASIS, * - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * - * See the License for the specific language governing permissions and * - * limitations under the License. * - * * - *---------------------------------------------------------------------------*/ - -package android.speech.recognition; - -/** - * Thrown if an error occurs in the audio driver. - */ -public class GrammarErrorException extends Exception -{ - private static final long serialVersionUID = 0L; - - public GrammarErrorException(String msg) - { - super(msg); - } -} diff --git a/core/java/android/speech/recognition/GrammarListener.java b/core/java/android/speech/recognition/GrammarListener.java deleted file mode 100644 index 871cbcbe423be..0000000000000 --- a/core/java/android/speech/recognition/GrammarListener.java +++ /dev/null @@ -1,45 +0,0 @@ -/*---------------------------------------------------------------------------* - * GrammarListener.java * - * * - * Copyright 2007, 2008 Nuance Communciations, Inc. * - * * - * Licensed under the Apache License, Version 2.0 (the 'License'); * - * you may not use this file except in compliance with the License. * - * * - * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 * - * * - * Unless required by applicable law or agreed to in writing, software * - * distributed under the License is distributed on an 'AS IS' BASIS, * - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * - * See the License for the specific language governing permissions and * - * limitations under the License. * - * * - *---------------------------------------------------------------------------*/ - -package android.speech.recognition; - -/** - * Listens for Grammar events. - */ -public interface GrammarListener -{ - /** - * Invoked after the Grammar is loaded. - */ - void onLoaded(); - - /** - * Invoked after the Grammar is unloaded. - */ - void onUnloaded(); - - /** - * Invoked when a grammar operation fails. - * - * @param e the cause of the failure.
    - * {@link java.io.IOException} if the grammar could not be loaded or - * saved.

    - */ - void onError(Exception e); -} diff --git a/core/java/android/speech/recognition/GrammarOverflowException.java b/core/java/android/speech/recognition/GrammarOverflowException.java deleted file mode 100644 index 227820bbdb9c9..0000000000000 --- a/core/java/android/speech/recognition/GrammarOverflowException.java +++ /dev/null @@ -1,33 +0,0 @@ -/*---------------------------------------------------------------------------* - * GrammarOverflowException.java * - * * - * Copyright 2007, 2008 Nuance Communciations, Inc. * - * * - * Licensed under the Apache License, Version 2.0 (the 'License'); * - * you may not use this file except in compliance with the License. * - * * - * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 * - * * - * Unless required by applicable law or agreed to in writing, software * - * distributed under the License is distributed on an 'AS IS' BASIS, * - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * - * See the License for the specific language governing permissions and * - * limitations under the License. * - * * - *---------------------------------------------------------------------------*/ - -package android.speech.recognition; - -/** - * Thrown if a SlotItem is added into a grammar slot that is filled to capacity. - */ -public class GrammarOverflowException extends Exception -{ - private static final long serialVersionUID = 0L; - - public GrammarOverflowException(String message) - { - super(message); - } -} diff --git a/core/java/android/speech/recognition/InvalidURLException.java b/core/java/android/speech/recognition/InvalidURLException.java deleted file mode 100644 index fec9411faf4ba..0000000000000 --- a/core/java/android/speech/recognition/InvalidURLException.java +++ /dev/null @@ -1,34 +0,0 @@ -/*---------------------------------------------------------------------------* - * InvalidURLException.java * - * * - * Copyright 2007, 2008 Nuance Communciations, Inc. * - * * - * Licensed under the Apache License, Version 2.0 (the 'License'); * - * you may not use this file except in compliance with the License. * - * * - * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 * - * * - * Unless required by applicable law or agreed to in writing, software * - * distributed under the License is distributed on an 'AS IS' BASIS, * - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * - * See the License for the specific language governing permissions and * - * limitations under the License. * - * * - *---------------------------------------------------------------------------*/ - -package android.speech.recognition; - -/** - */ -public class InvalidURLException extends Exception { - - private static final long serialVersionUID = 0L; - - /** Creates a new instance of InvalidURLException */ - public InvalidURLException(String msg) - { - super(msg); - } - -} diff --git a/core/java/android/speech/recognition/Logger.java b/core/java/android/speech/recognition/Logger.java deleted file mode 100644 index 8a09cb36960a7..0000000000000 --- a/core/java/android/speech/recognition/Logger.java +++ /dev/null @@ -1,127 +0,0 @@ -/*---------------------------------------------------------------------------* - * Logger.java * - * * - * Copyright 2007, 2008 Nuance Communciations, Inc. * - * * - * Licensed under the Apache License, Version 2.0 (the 'License'); * - * you may not use this file except in compliance with the License. * - * * - * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 * - * * - * Unless required by applicable law or agreed to in writing, software * - * distributed under the License is distributed on an 'AS IS' BASIS, * - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * - * See the License for the specific language governing permissions and * - * limitations under the License. * - * * - *---------------------------------------------------------------------------*/ - -package android.speech.recognition; - -import android.speech.recognition.impl.LoggerImpl; - -/** - * Logs debugging information. - */ -public abstract class Logger -{ - /** - * Logging level - */ - public static class LogLevel - { - /** - * Does not log. - */ - public static LogLevel LEVEL_NONE = new LogLevel("Do not log"); - /** - * Logs fatal issues. This level only logs ERROR. - */ - public static LogLevel LEVEL_ERROR = new LogLevel("log UAPI_ERROR logs"); - /** - * Logs non-fatal issues. This level also logs ERROR. - */ - public static LogLevel LEVEL_WARN = - new LogLevel("log UAPI_ERROR, UAPI_WARN logs"); - /** - * Logs debugging information, such as the values of variables. This level also logs ERROR, WARN. - */ - public static LogLevel LEVEL_INFO = - new LogLevel("log UAPI_ERROR, UAPI_WARN, UAPI_INFO logs"); - /** - * Logs when loggers are created or destroyed. This level also logs INFO, WARN, ERROR. - */ - public static LogLevel LEVEL_TRACE = - new LogLevel("log UAPI_ERROR, UAPI_WARN, UAPI_INFO, UAPI_TRACE logs"); - private String message; - - /** - * Creates a new LogLevel. - * - * @param message the message associated with the LogLevel. - */ - private LogLevel(String message) - { - this.message = message; - } - - @Override - public String toString() - { - return message; - } - } - - /** - * Returns the singleton instance. - * - * @return the singleton instance - */ - public static Logger getInstance() - { - return LoggerImpl.getInstance(); - } - - /** - * Sets the logging level. - * - * @param level the logging level - */ - public abstract void setLoggingLevel(LogLevel level); - - /** - * Sets the log path. - * - * @param path the path of the log file - */ - public abstract void setPath(String path); - - /** - * Logs an error message. - * - * @param message the message to log - */ - public abstract void error(String message); - - /** - * Logs a warning message. - * - * @param message the message to log - */ - public abstract void warn(String message); - - /** - * Logs an informational message. - * - * @param message the message to log - */ - public abstract void info(String message); - - /** - * Logs a method tracing message. - * - * @param message the message to log - */ - public abstract void trace(String message); -} diff --git a/core/java/android/speech/recognition/MediaFileReader.java b/core/java/android/speech/recognition/MediaFileReader.java deleted file mode 100644 index 216511f951b05..0000000000000 --- a/core/java/android/speech/recognition/MediaFileReader.java +++ /dev/null @@ -1,90 +0,0 @@ -/*---------------------------------------------------------------------------* - * MediaFileReader.java * - * * - * Copyright 2007, 2008 Nuance Communciations, Inc. * - * * - * Licensed under the Apache License, Version 2.0 (the 'License'); * - * you may not use this file except in compliance with the License. * - * * - * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 * - * * - * Unless required by applicable law or agreed to in writing, software * - * distributed under the License is distributed on an 'AS IS' BASIS, * - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * - * See the License for the specific language governing permissions and * - * limitations under the License. * - * * - *---------------------------------------------------------------------------*/ - -package android.speech.recognition; - -import android.speech.recognition.impl.MediaFileReaderImpl; - -/** - * Reads audio from a file. - */ -public abstract class MediaFileReader implements AudioSource -{ - /** - * Reading mode - */ - public static class Mode - { - /** - * Read the file in "real time". - */ - public static Mode REAL_TIME = new Mode("real-time"); - /** - * Read the file all at once. - */ - public static Mode ALL_AT_ONCE = new Mode("all at once"); - private String message; - - /** - * Creates a new Mode. - * - * @param message the message associated with the reading mode. - */ - private Mode(String message) - { - this.message = message; - } - } - - /** - * Creates a new MediaFileReader to read audio samples from a file. - * - * @param filename the name of the file to read from Note: The file MUST be of type Microsoft WAVE RIFF - * format (PCM 16 bits 8000 Hz or PCM 16 bits 11025 Hz). - * @param listener listens for MediaFileReader events - * @return a new MediaFileReader - * @throws IllegalArgumentException if filename is null or is an empty string. Or if offset > file length. Or if codec is null or invalid - */ - public static MediaFileReader create(String filename, AudioSourceListener listener) throws IllegalArgumentException - { - return new MediaFileReaderImpl(filename, listener); - } - - /** - * Sets the reading mode. - * - * @param mode the reading mode - */ - public abstract void setMode(Mode mode); - - /** - * Creates an audio source. - */ - public abstract AudioStream createAudio(); - - /** - * Starts collecting audio samples. - */ - public abstract void start(); - - /** - * Stops collecting audio samples. - */ - public abstract void stop(); -} diff --git a/core/java/android/speech/recognition/MediaFileReaderListener.java b/core/java/android/speech/recognition/MediaFileReaderListener.java deleted file mode 100644 index f76e65f86057d..0000000000000 --- a/core/java/android/speech/recognition/MediaFileReaderListener.java +++ /dev/null @@ -1,29 +0,0 @@ -/*---------------------------------------------------------------------------* - * MediaFileReaderListener.java * - * * - * Copyright 2007, 2008 Nuance Communciations, Inc. * - * * - * Licensed under the Apache License, Version 2.0 (the 'License'); * - * you may not use this file except in compliance with the License. * - * * - * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 * - * * - * Unless required by applicable law or agreed to in writing, software * - * distributed under the License is distributed on an 'AS IS' BASIS, * - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * - * See the License for the specific language governing permissions and * - * limitations under the License. * - * * - *---------------------------------------------------------------------------*/ - -package android.speech.recognition; - -import android.speech.recognition.AudioSourceListener; - -/** - * Listens for MediaFileReader events. - */ -public interface MediaFileReaderListener extends AudioSourceListener -{ -} diff --git a/core/java/android/speech/recognition/MediaFileWriter.java b/core/java/android/speech/recognition/MediaFileWriter.java deleted file mode 100644 index b2d627c07b93e..0000000000000 --- a/core/java/android/speech/recognition/MediaFileWriter.java +++ /dev/null @@ -1,49 +0,0 @@ -/*---------------------------------------------------------------------------* - * MediaFileWriter.java * - * * - * Copyright 2007, 2008 Nuance Communciations, Inc. * - * * - * Licensed under the Apache License, Version 2.0 (the 'License'); * - * you may not use this file except in compliance with the License. * - * * - * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 * - * * - * Unless required by applicable law or agreed to in writing, software * - * distributed under the License is distributed on an 'AS IS' BASIS, * - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * - * See the License for the specific language governing permissions and * - * limitations under the License. * - * * - *---------------------------------------------------------------------------*/ - -package android.speech.recognition; - -import android.speech.recognition.impl.MediaFileWriterImpl; - -/** - * Writes audio to a file. - */ -public abstract class MediaFileWriter -{ - /** - * Creates a new MediaFileWriter to write audio samples into a file. - * - * @param listener listens for MediaFileWriter events - * @return a new MediaFileWriter - */ - public static MediaFileWriter create(MediaFileWriterListener listener) - { - return new MediaFileWriterImpl(listener); - } - - /** - * Saves audio to a file. - * - * @param source the audio stream to write - * @param filename the file to write to - * @throws IllegalArgumentException if source is null, in-use by another - * component or contains no data. Or if filename is null or is empty. - */ - public abstract void save(AudioStream source, String filename) throws IllegalArgumentException; -} diff --git a/core/java/android/speech/recognition/MediaFileWriterListener.java b/core/java/android/speech/recognition/MediaFileWriterListener.java deleted file mode 100644 index e2104c874e1a8..0000000000000 --- a/core/java/android/speech/recognition/MediaFileWriterListener.java +++ /dev/null @@ -1,40 +0,0 @@ -/*---------------------------------------------------------------------------* - * MediaFileWriterListener.java * - * * - * Copyright 2007, 2008 Nuance Communciations, Inc. * - * * - * Licensed under the Apache License, Version 2.0 (the 'License'); * - * you may not use this file except in compliance with the License. * - * * - * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 * - * * - * Unless required by applicable law or agreed to in writing, software * - * distributed under the License is distributed on an 'AS IS' BASIS, * - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * - * See the License for the specific language governing permissions and * - * limitations under the License. * - * * - *---------------------------------------------------------------------------*/ - -package android.speech.recognition; - -/** - * Listens for MediaFileWriter events. - */ -public interface MediaFileWriterListener -{ - /** - * Invoked after the save() operation terminates - */ - void onStopped(); - - /** - * Invoked when an unexpected error occurs. This is normally followed by - * onStopped() if the component shuts down successfully. - * - * @param e the cause of the failure.
    - * {@link java.io.IOException} if an error occured opening or writing to the file - */ - void onError(Exception e); -} diff --git a/core/java/android/speech/recognition/Microphone.java b/core/java/android/speech/recognition/Microphone.java deleted file mode 100644 index 1b713f547b13f..0000000000000 --- a/core/java/android/speech/recognition/Microphone.java +++ /dev/null @@ -1,76 +0,0 @@ -/*---------------------------------------------------------------------------* - * Microphone.java * - * * - * Copyright 2007, 2008 Nuance Communciations, Inc. * - * * - * Licensed under the Apache License, Version 2.0 (the 'License'); * - * you may not use this file except in compliance with the License. * - * * - * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 * - * * - * Unless required by applicable law or agreed to in writing, software * - * distributed under the License is distributed on an 'AS IS' BASIS, * - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * - * See the License for the specific language governing permissions and * - * limitations under the License. * - * * - *---------------------------------------------------------------------------*/ - -package android.speech.recognition; - -import android.speech.recognition.impl.MicrophoneImpl; - -/** - * Records live audio. - */ -public abstract class Microphone implements AudioSource -{ - private static Microphone instance; - - /** - * Returns the microphone instance - * - * @return an instance of a Microphone class. - */ - public static Microphone getInstance() - { - instance = MicrophoneImpl.getInstance(); - return instance; - } - - /** - * Sets the recording codec. This must be called before start() is called. - * - * @param recordingCodec the codec in which the samples will be recorded. - * @throws IllegalStateException if Microphone is started - * @throws IllegalArgumentException if codec is not supported - */ - public abstract void setCodec(Codec recordingCodec) throws IllegalStateException, - IllegalArgumentException; - - /** - * Sets the microphone listener. - * - * @param listener the microphone listener. - * @throws IllegalStateException if Microphone is started - */ - public abstract void setListener(AudioSourceListener listener) throws IllegalStateException; - - /** - * Creates an audio source - */ - public abstract AudioStream createAudio(); - - /** - * Start recording audio. - * - * @throws IllegalStateException if Microphone is already started - */ - public abstract void start() throws IllegalStateException; - - /** - * Stops recording audio. - */ - public abstract void stop(); -} diff --git a/core/java/android/speech/recognition/MicrophoneListener.java b/core/java/android/speech/recognition/MicrophoneListener.java deleted file mode 100644 index f43eff9ad2183..0000000000000 --- a/core/java/android/speech/recognition/MicrophoneListener.java +++ /dev/null @@ -1,29 +0,0 @@ -/*---------------------------------------------------------------------------* - * MicrophoneListener.java * - * * - * Copyright 2007, 2008 Nuance Communciations, Inc. * - * * - * Licensed under the Apache License, Version 2.0 (the 'License'); * - * you may not use this file except in compliance with the License. * - * * - * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 * - * * - * Unless required by applicable law or agreed to in writing, software * - * distributed under the License is distributed on an 'AS IS' BASIS, * - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * - * See the License for the specific language governing permissions and * - * limitations under the License. * - * * - *---------------------------------------------------------------------------*/ - -package android.speech.recognition; - -import android.speech.recognition.AudioSourceListener; - -/** - * Listens for Microphone events. - */ -public interface MicrophoneListener extends AudioSourceListener -{ -} diff --git a/core/java/android/speech/recognition/NBestRecognitionResult.java b/core/java/android/speech/recognition/NBestRecognitionResult.java deleted file mode 100644 index e679c193ba5c3..0000000000000 --- a/core/java/android/speech/recognition/NBestRecognitionResult.java +++ /dev/null @@ -1,113 +0,0 @@ -/*---------------------------------------------------------------------------* - * NBestRecognitionResult.java * - * * - * Copyright 2007, 2008 Nuance Communciations, Inc. * - * * - * Licensed under the Apache License, Version 2.0 (the 'License'); * - * you may not use this file except in compliance with the License. * - * * - * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 * - * * - * Unless required by applicable law or agreed to in writing, software * - * distributed under the License is distributed on an 'AS IS' BASIS, * - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * - * See the License for the specific language governing permissions and * - * limitations under the License. * - * * - *---------------------------------------------------------------------------*/ - -package android.speech.recognition; - -import java.util.Enumeration; - -/** - * N-Best recognition results. Entries are sorted in decreasing order according - * to their probability, from the most probable result to the least probable - * result. - */ -public interface NBestRecognitionResult extends RecognitionResult -{ - /** - * Recognition result entry - */ - public static interface Entry - { - /** - * Returns the semantic meaning of a recognition result (i.e. the application-specific value - * associated with what the user said). In an example where a person's name is mapped - * to a phone-number, the phone-number is the semantic meaning. - * - * @return the semantic meaning of a recognition result. - * @throws IllegalStateException if the object has been disposed - */ - String getSemanticMeaning() throws IllegalStateException; - - /** - * The confidence score of a recognition result. Values range from 0 to 100 - * (inclusive). - * - * @return the confidence score of a recognition result. - * @throws IllegalStateException if the object has been disposed - */ - byte getConfidenceScore() throws IllegalStateException; - - /** - * Returns the literal meaning of a recognition result (i.e. literally - * what the user said). In an example where a person's name is mapped to a - * phone-number, the person's name is the literal meaning. - * - * @return the literal meaning of a recognition result. - * @throws IllegalStateException if the object has been disposed - */ - String getLiteralMeaning() throws IllegalStateException; - - /** - * Returns the value associated with the specified key. - * - * @param key the key to look up - * @return the associated value or null if this entry does not contain - * any mapping for the key - */ - String get(String key); - - /** - * Returns an enumeration of the keys in this Entry. - * - * @return an enumeration of the keys in this Entry. - */ - Enumeration keys(); - } - - /** - * Returns the number of entries in the n-best list. - * - * @return the number of entries in the n-best list - */ - int getSize(); - - /** - * Returns the n-best entry that contains key-value pairs associated with the - * recognition result. - * - * @param index the index of the n-best entry - * @return null if all active GrammarConfiguration.grammarToMeaning() return - * null - * @throws ArrayIndexOutOfBoundsException if index is greater than size of - * entries - */ - Entry getEntry(int index) throws ArrayIndexOutOfBoundsException; - - /** - * Creates a new VoicetagItem if the last recognition was an enrollment - * operation. - * - * @param VoicetagId string voicetag unique id value. - * @param listener listens for Voicetag events - * @return the resulting VoicetagItem - * @throws IllegalArgumentException if VoicetagId is null or an empty string. - * @throws IllegalStateException if the last recognition was not an - * enrollment operation - */ - VoicetagItem createVoicetagItem(String VoicetagId, VoicetagItemListener listener) throws IllegalArgumentException,IllegalStateException; -} diff --git a/core/java/android/speech/recognition/ParameterErrorException.java b/core/java/android/speech/recognition/ParameterErrorException.java deleted file mode 100644 index 042ed31bf9f6b..0000000000000 --- a/core/java/android/speech/recognition/ParameterErrorException.java +++ /dev/null @@ -1,33 +0,0 @@ -/*---------------------------------------------------------------------------* - * ParameterErrorException.java * - * * - * Copyright 2007, 2008 Nuance Communciations, Inc. * - * * - * Licensed under the Apache License, Version 2.0 (the 'License'); * - * you may not use this file except in compliance with the License. * - * * - * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 * - * * - * Unless required by applicable law or agreed to in writing, software * - * distributed under the License is distributed on an 'AS IS' BASIS, * - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * - * See the License for the specific language governing permissions and * - * limitations under the License. * - * * - *---------------------------------------------------------------------------*/ - -package android.speech.recognition; - -/** - * Thrown if an error occurs in the audio driver. - */ -public class ParameterErrorException extends Exception -{ - private static final long serialVersionUID = 0L; - - public ParameterErrorException(String msg) - { - super(msg); - } -} diff --git a/core/java/android/speech/recognition/ParametersListener.java b/core/java/android/speech/recognition/ParametersListener.java deleted file mode 100644 index bdb551ebab19f..0000000000000 --- a/core/java/android/speech/recognition/ParametersListener.java +++ /dev/null @@ -1,63 +0,0 @@ -/*---------------------------------------------------------------------------* - * ParametersListener.java * - * * - * Copyright 2007, 2008 Nuance Communciations, Inc. * - * * - * Licensed under the Apache License, Version 2.0 (the 'License'); * - * you may not use this file except in compliance with the License. * - * * - * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 * - * * - * Unless required by applicable law or agreed to in writing, software * - * distributed under the License is distributed on an 'AS IS' BASIS, * - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * - * See the License for the specific language governing permissions and * - * limitations under the License. * - * * - *---------------------------------------------------------------------------*/ - -package android.speech.recognition; - -import java.util.Hashtable; -import java.util.Vector; - -/** - * Listens for parameter events. - */ -public interface ParametersListener -{ - /** - * Invoked if retrieving parameters has failed. - * - * @param parameters the parameters that could not be retrieved - * @param e the failure reason - */ - void onParametersGetError(Vector parameters, Exception e); - - /** - * Invoked if setting parameters has failed. - * - * @param parameters the parameters that could not be set - * @param e the failure reason - */ - void onParametersSetError(Hashtable parameters, Exception e); - - /** - * This method is called when the parameters specified in setParameters have - * successfully been set. This method is guaranteed to be invoked after - * onParametersSetError, even if count==0. - * - * @param parameters the set parameters - */ - void onParametersSet(Hashtable parameters); - - /** - * This method is called when the parameters specified in getParameters have - * successfully been retrieved. This method is guaranteed to be invoked after - * onParametersGetError, even if count==0. - * - * @param parameters the retrieved parameters - */ - void onParametersGet(Hashtable parameters); -} diff --git a/core/java/android/speech/recognition/ParseErrorException.java b/core/java/android/speech/recognition/ParseErrorException.java deleted file mode 100644 index 2288a90bec39c..0000000000000 --- a/core/java/android/speech/recognition/ParseErrorException.java +++ /dev/null @@ -1,33 +0,0 @@ -/*---------------------------------------------------------------------------* - * ParseErrorException.java * - * * - * Copyright 2007, 2008 Nuance Communciations, Inc. * - * * - * Licensed under the Apache License, Version 2.0 (the 'License'); * - * you may not use this file except in compliance with the License. * - * * - * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 * - * * - * Unless required by applicable law or agreed to in writing, software * - * distributed under the License is distributed on an 'AS IS' BASIS, * - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * - * See the License for the specific language governing permissions and * - * limitations under the License. * - * * - *---------------------------------------------------------------------------*/ - -package android.speech.recognition; - -/** - * Thrown if an error occurs in the audio driver. - */ -public class ParseErrorException extends Exception -{ - private static final long serialVersionUID = 0L; - - public ParseErrorException(String msg) - { - super(msg); - } -} diff --git a/core/java/android/speech/recognition/RecognitionResult.java b/core/java/android/speech/recognition/RecognitionResult.java deleted file mode 100644 index cbbc938bdec57..0000000000000 --- a/core/java/android/speech/recognition/RecognitionResult.java +++ /dev/null @@ -1,27 +0,0 @@ -/*---------------------------------------------------------------------------* - * RecognitionResult.java * - * * - * Copyright 2007, 2008 Nuance Communciations, Inc. * - * * - * Licensed under the Apache License, Version 2.0 (the 'License'); * - * you may not use this file except in compliance with the License. * - * * - * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 * - * * - * Unless required by applicable law or agreed to in writing, software * - * distributed under the License is distributed on an 'AS IS' BASIS, * - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * - * See the License for the specific language governing permissions and * - * limitations under the License. * - * * - *---------------------------------------------------------------------------*/ - -package android.speech.recognition; - -/** - * Recognition result interface. - */ -public interface RecognitionResult -{ -} diff --git a/core/java/android/speech/recognition/Recognizer.java b/core/java/android/speech/recognition/Recognizer.java deleted file mode 100644 index ab7f8f442f4f8..0000000000000 --- a/core/java/android/speech/recognition/Recognizer.java +++ /dev/null @@ -1,102 +0,0 @@ -/*---------------------------------------------------------------------------* - * Recognizer.java * - * * - * Copyright 2007, 2008 Nuance Communciations, Inc. * - * * - * Licensed under the Apache License, Version 2.0 (the 'License'); * - * you may not use this file except in compliance with the License. * - * * - * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 * - * * - * Unless required by applicable law or agreed to in writing, software * - * distributed under the License is distributed on an 'AS IS' BASIS, * - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * - * See the License for the specific language governing permissions and * - * limitations under the License. * - * * - *---------------------------------------------------------------------------*/ - -package android.speech.recognition; - -import java.util.Hashtable; -import java.util.Vector; - -/** - * Speech recognizer interface. - */ -public interface Recognizer -{ - /** - * Sets the recognizer event listener. - * - * @param listener listens for recognizer events - */ - void setListener(RecognizerListener listener); - - /** - * Creates an embedded grammar. - * - * @param value value of that grammarType. Could be a URL or an inline grammar. - * @return a grammar - * @throws IllegalArgumentException if value is null or listener is not of type - * GrammarListener. - */ - Grammar createGrammar(String value, GrammarListener listener) throws IllegalArgumentException; - - /** - * Begins speech recognition. - * - * @param audio the audio stream to recognizer - * @param grammars a collection of grammar sets to recognize against - * @see #recognize(AudioStream, Grammar) - * @throws IllegalStateException if any of the grammars are not loaded - * @throws IllegalArgumentException if audio is null, in-use by another - * component or empty. Or if grammars is null or grammars count is less than - * one. Or if the audio codec differs from recognizer codec. - * @throws UnsupportedOperationException if the recognizer does not support - * the number of grammars specified. - */ - void recognize(AudioStream audio, - Vector grammars) throws IllegalStateException, - IllegalArgumentException, UnsupportedOperationException; - - /** - * This convenience method is equivalent to invoking - * recognize(audio, grammars) with a single grammar. - * - * @param audio the audio to recognizer - * @param grammar a grammar to recognize against - * @see #recognize(AudioStream, Vector) - * @throws IllegalStateException if grammar is not loaded - * @throws IllegalArgumentException if audio is null, in-use by another - * component or is empty. Or if grammar is null or if the audio codec differs - * from the recognizer codec. - */ - void recognize(AudioStream audio, Grammar grammar) throws IllegalStateException, - IllegalArgumentException; - - /** - * Terminates a recognition if one is in-progress. - * This must not be called until the recognize method - * returns; otherwise the result is not defined. - * - * @see RecognizerListener#onStopped - */ - void stop(); - - /** - * Sets the values of recognition parameters. - * - * @param parameters the parameter key-value pairs to set - */ - void setParameters(Hashtable parameters); - - /** - * Retrieves the values of recognition parameters. - * - * @param parameters the names of the parameters to retrieve - */ - void getParameters(Vector parameters); - -} diff --git a/core/java/android/speech/recognition/RecognizerListener.java b/core/java/android/speech/recognition/RecognizerListener.java deleted file mode 100644 index d7bbda9558df5..0000000000000 --- a/core/java/android/speech/recognition/RecognizerListener.java +++ /dev/null @@ -1,142 +0,0 @@ -/*---------------------------------------------------------------------------* - * RecognizerListener.java * - * * - * Copyright 2007, 2008 Nuance Communciations, Inc. * - * * - * Licensed under the Apache License, Version 2.0 (the 'License'); * - * you may not use this file except in compliance with the License. * - * * - * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 * - * * - * Unless required by applicable law or agreed to in writing, software * - * distributed under the License is distributed on an 'AS IS' BASIS, * - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * - * See the License for the specific language governing permissions and * - * limitations under the License. * - * * - *---------------------------------------------------------------------------*/ - -package android.speech.recognition; - -/** - * Listens for recognizer events. - */ -public interface RecognizerListener extends ParametersListener -{ - /** - * Recognition failure. - */ - public static class FailureReason - { - /** - * The audio did not generate any results. - */ - public static FailureReason NO_MATCH = - new FailureReason("The audio did not generate any results"); - /** - * Beginning of speech occured too soon. - */ - public static FailureReason SPOKE_TOO_SOON = - new FailureReason("Beginning of speech occurred too soon"); - /** - * A timeout occured before the beginning of speech. - */ - public static FailureReason BEGINNING_OF_SPEECH_TIMEOUT = - new FailureReason("A timeout occurred before the beginning of " + "speech"); - /** - * A timeout occured before the recognition could complete. - */ - public static FailureReason RECOGNITION_TIMEOUT = - new FailureReason("A timeout occurred before the recognition " + - "could complete"); - /** - * The recognizer encountered more audio than was acceptable according to - * its configuration. - */ - public static FailureReason TOO_MUCH_SPEECH = - new FailureReason("The " + - "recognizer encountered more audio than was acceptable according to " + - "its configuration"); - - public static FailureReason UNKNOWN = - new FailureReason("unknown failure reason"); - - private final String message; - - private FailureReason(String message) - { - this.message = message; - } - - @Override - public String toString() - { - return message; - } - } - - /** - * Invoked after recognition begins. - */ - void onStarted(); - - /** - * Invoked if the recognizer detects the beginning of speech. - */ - void onBeginningOfSpeech(); - - /** - * Invoked if the recognizer detects the end of speech. - */ - void onEndOfSpeech(); - - /** - * Invoked if the recognizer does not detect speech within the configured - * timeout period. - */ - void onStartOfSpeechTimeout(); - - /** - * Invoked when the recognizer acoustic state is reset. - * - * @see android.speech.recognition.EmbeddedRecognizer#resetAcousticState() - */ - void onAcousticStateReset(); - - /** - * Invoked when a recognition result is generated. - * - * @param result the recognition result. The result object can not be - * used outside of the scope of the onRecognitionSuccess() callback method. - * To be able to do so, copy it's contents to an user-defined object.
    - * An example of this object could be a vector of string arrays; where the - * vector represents a list of recognition result entries and each entry - * is an array of strings to hold the entry's values (the semantic - * meaning, confidence score and literal meaning). - */ - void onRecognitionSuccess(RecognitionResult result); - - /** - * Invoked when a recognition failure occurs. - * - * @param reason the failure reason - */ - void onRecognitionFailure(FailureReason reason); - - /** - * Invoked when an unexpected error occurs. This is normally followed by - * onStopped() if the component shuts down successfully. - * - * @param e the cause of the failure - */ - void onError(Exception e); - - /** - * Invoked when the recognizer stops (due to normal termination or an error). - * - * Invoking stop() on a recognizer that is already stopped will not result - * in a onStopped() event. - */ - void onStopped(); -} diff --git a/core/java/android/speech/recognition/SlotItem.java b/core/java/android/speech/recognition/SlotItem.java deleted file mode 100644 index 3abd27a255a1f..0000000000000 --- a/core/java/android/speech/recognition/SlotItem.java +++ /dev/null @@ -1,27 +0,0 @@ -/*---------------------------------------------------------------------------* - * SlotItem.java * - * * - * Copyright 2007, 2008 Nuance Communciations, Inc. * - * * - * Licensed under the Apache License, Version 2.0 (the 'License'); * - * you may not use this file except in compliance with the License. * - * * - * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 * - * * - * Unless required by applicable law or agreed to in writing, software * - * distributed under the License is distributed on an 'AS IS' BASIS, * - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * - * See the License for the specific language governing permissions and * - * limitations under the License. * - * * - *---------------------------------------------------------------------------*/ - -package android.speech.recognition; - -/** - * Item that may be inserted into an embedded grammar slot. - */ -public interface SlotItem -{ -} diff --git a/core/java/android/speech/recognition/SrecGrammar.java b/core/java/android/speech/recognition/SrecGrammar.java deleted file mode 100644 index c591e05e428b8..0000000000000 --- a/core/java/android/speech/recognition/SrecGrammar.java +++ /dev/null @@ -1,81 +0,0 @@ -/*---------------------------------------------------------------------------* - * SrecGrammar.java * - * * - * Copyright 2007, 2008 Nuance Communciations, Inc. * - * * - * Licensed under the Apache License, Version 2.0 (the 'License'); * - * you may not use this file except in compliance with the License. * - * * - * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 * - * * - * Unless required by applicable law or agreed to in writing, software * - * distributed under the License is distributed on an 'AS IS' BASIS, * - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * - * See the License for the specific language governing permissions and * - * limitations under the License. * - * * - *---------------------------------------------------------------------------*/ - -package android.speech.recognition; -import java.util.Vector; - -/** - * Grammar on an SREC recognizer. - */ -public interface SrecGrammar extends EmbeddedGrammar -{ - /** - * SrecGrammar Item - */ - public class Item - { - public SlotItem _item; - public int _weight; - public String _semanticMeaning; - - /** - * Creates a grammar item. - * - * @param item the Slotitem. - * @param weight the weight of the item. Smaller values are more likely to get recognized. This should be >= 0. - * @param semanticMeaning the value that will be returned if this item is recognized. - * @throws IllegalArgumentException if item or semanticMeaning are null; if semanticMeaning is empty." - */ - public Item(SlotItem item, int weight, String semanticMeaning) - throws IllegalArgumentException - { - if (item == null) - throw new IllegalArgumentException("Item(): item can't be null."); - if (semanticMeaning == null || semanticMeaning.length()==0) - throw new IllegalArgumentException("Item(): semanticMeaning is null or empty."); - _item = item; - _weight = weight; - _semanticMeaning = semanticMeaning; - - } - } - - /** - * Adds an item to a slot. - * - * @param slotName the name of the slot - * @param item the item to add to the slot. - * @param weight the weight of the item. Smaller values are more likely to get recognized. This should be >= 0. - * @param semanticMeaning the value that will be returned if this item is recognized. - * @throws IllegalArgumentException if slotName, item or semanticMeaning are null; if semanticMeaning is not of the format "V='Jen_Parker'" - */ - public void addItem(String slotName, SlotItem item, int weight, - String semanticMeaning) throws IllegalArgumentException; - - /** - * Add a list of item to a slot. - * - * @param slotName the name of the slot - * @param items the vector of SrecGrammar.Item to add to the slot. - * @throws IllegalArgumentException if slotName,items are null or any element in the items(_item, _semanticMeaning) is null; if any semanticMeaning of the list is not of the format "key='value'" - */ - public void addItemList(String slotName, Vector items) - throws IllegalArgumentException; - -} diff --git a/core/java/android/speech/recognition/SrecGrammarListener.java b/core/java/android/speech/recognition/SrecGrammarListener.java deleted file mode 100644 index e1f7d3f5f1edf..0000000000000 --- a/core/java/android/speech/recognition/SrecGrammarListener.java +++ /dev/null @@ -1,58 +0,0 @@ -/*---------------------------------------------------------------------------* - * SrecGrammarListener.java * - * * - * Copyright 2007, 2008 Nuance Communciations, Inc. * - * * - * Licensed under the Apache License, Version 2.0 (the 'License'); * - * you may not use this file except in compliance with the License. * - * * - * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 * - * * - * Unless required by applicable law or agreed to in writing, software * - * distributed under the License is distributed on an 'AS IS' BASIS, * - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * - * See the License for the specific language governing permissions and * - * limitations under the License. * - * * - *---------------------------------------------------------------------------*/ - -package android.speech.recognition; - -/** - * Listens for SrecGrammar events. - */ -public interface SrecGrammarListener extends EmbeddedGrammarListener { - - /** - * Invokes after all items of the list have been added. - */ - void onAddItemList(); - - /** - * Invoked when adding a SlotItem from a list fails. - * This callback will be trigger for each element in the list that fails to be - * add in the slot, unless there is a grammar fail operation, which will be - * reported in the onError callback. - * @param index of the list that could not be added to the slot - * @param e the cause of the failure. - */ - void onAddItemListFailure(int index, Exception e); - - - /** - * Invoked when a grammar related operation fails. - * - * @param e the cause of the failure.
    - * {@link GrammarOverflowException} if the grammar slot is full and no - * further items may be added to it.
    - * {@link java.lang.UnsupportedOperationException} if different words with - * the same pronunciation are added.
    - * {@link java.lang.IllegalStateException} if reseting or compiling the - * slots fails.
    - * {@link java.io.IOException} if the grammar could not be loaded or - * saved.

    - */ - void onError(Exception e); - -} diff --git a/core/java/android/speech/recognition/VoicetagItem.java b/core/java/android/speech/recognition/VoicetagItem.java deleted file mode 100644 index 0b89639d03890..0000000000000 --- a/core/java/android/speech/recognition/VoicetagItem.java +++ /dev/null @@ -1,82 +0,0 @@ -/*---------------------------------------------------------------------------* - * VoicetagItem.java * - * * - * Copyright 2007, 2008 Nuance Communciations, Inc. * - * * - * Licensed under the Apache License, Version 2.0 (the 'License'); * - * you may not use this file except in compliance with the License. * - * * - * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 * - * * - * Unless required by applicable law or agreed to in writing, software * - * distributed under the License is distributed on an 'AS IS' BASIS, * - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * - * See the License for the specific language governing permissions and * - * limitations under the License. * - * * - *---------------------------------------------------------------------------*/ - -package android.speech.recognition; - -import android.speech.recognition.impl.VoicetagItemImpl; -import java.io.FileNotFoundException; -import java.io.IOException; -/** - * Voicetag that may be inserted into an embedded grammar slot. - */ -public abstract class VoicetagItem implements SlotItem -{ - /** - * Creates a VoicetagItem from a file - * - * @param filename filename for Voicetag - * @param listener listens for Voicetag events - * @return the resulting VoicetagItem - * @throws IllegalArgumentException if filename is null or an empty string. - * @throws FileNotFoundException if the specified filename could not be found - * @throws IOException if the specified filename could not be opened - */ - public static VoicetagItem create(String filename, VoicetagItemListener listener) throws IllegalArgumentException,FileNotFoundException,IOException - { - return VoicetagItemImpl.create(filename,listener); - } - /** - * Returns the audio used to construct the VoicetagItem. - * The audio is in PCM format and is start-pointed and end-pointed. The audio - * is only generated if the enableGetWaveform recognition parameter - * is set prior to recognition. - * - * @throws IllegalStateException if the recognition parameter 'enableGetWaveform' is not set - * @return the audio used to construct the VoicetagItem. - */ - public abstract byte[] getAudio() throws IllegalStateException; - - /** - * Sets the audio used to construct the Voicetag. The - * audio is in PCM format and is start-pointed and end-pointed. The audio is - * only generated if the enableGetWaveform recognition parameter is set - * prior to recognition. - * - * @param waveform the endpointed waveform - * @throws IllegalArgumentException if waveform is null or empty. - * @throws IllegalStateException if the recognition parameter 'enableGetWaveform' is not set - */ - public abstract void setAudio(byte[] waveform) throws IllegalArgumentException,IllegalStateException; - - /** - * Save the Voicetag Item. - * - * @param path where the Voicetag will be saved. We strongly recommend to set the filename with the same value of the VoicetagId. - * @throws IllegalArgumentException if path is null or an empty string. - */ - public abstract void save(String path) throws IllegalArgumentException,IllegalStateException; - - /** - * Load a Voicetag Item. - * - * @throws IllegalStateException if voicetag has not been created from a file. - */ - public abstract void load() throws IllegalStateException; - -} diff --git a/core/java/android/speech/recognition/VoicetagItemListener.java b/core/java/android/speech/recognition/VoicetagItemListener.java deleted file mode 100644 index 610d1c79ca319..0000000000000 --- a/core/java/android/speech/recognition/VoicetagItemListener.java +++ /dev/null @@ -1,49 +0,0 @@ -/*---------------------------------------------------------------------------* - * VoicetagItemListener.java * - * * - * Copyright 2007, 2008 Nuance Communciations, Inc. * - * * - * Licensed under the Apache License, Version 2.0 (the 'License'); * - * you may not use this file except in compliance with the License. * - * * - * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 * - * * - * Unless required by applicable law or agreed to in writing, software * - * distributed under the License is distributed on an 'AS IS' BASIS, * - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * - * See the License for the specific language governing permissions and * - * limitations under the License. * - * * - *---------------------------------------------------------------------------*/ - -package android.speech.recognition; - -/** - * Listens for VoicetagItem events. - */ -public interface VoicetagItemListener -{ - /** - * Invoked after the Voicetag is saved. - * - * @param path the path the Voicetag was saved to - */ - void onSaved(String path); - - /** - * Invoked after the Voicetag is loaded. - */ - void onLoaded(); - - /** - * Invoked when a grammar operation fails. - * - * @param e the cause of the failure.
    - * {@link java.io.IOException} if the Voicetag could not be loaded or - * saved.

    - * {@link java.io.FileNotFoundException} if the specified file could not be found - */ - void onError(Exception e); - -} diff --git a/core/java/android/speech/recognition/WordItem.java b/core/java/android/speech/recognition/WordItem.java deleted file mode 100644 index 5c21c989865bf..0000000000000 --- a/core/java/android/speech/recognition/WordItem.java +++ /dev/null @@ -1,58 +0,0 @@ -/*---------------------------------------------------------------------------* - * WordItem.java * - * * - * Copyright 2007, 2008 Nuance Communciations, Inc. * - * * - * Licensed under the Apache License, Version 2.0 (the 'License'); * - * you may not use this file except in compliance with the License. * - * * - * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 * - * * - * Unless required by applicable law or agreed to in writing, software * - * distributed under the License is distributed on an 'AS IS' BASIS, * - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * - * See the License for the specific language governing permissions and * - * limitations under the License. * - * * - *---------------------------------------------------------------------------*/ - -package android.speech.recognition; - -import android.speech.recognition.impl.WordItemImpl; - -/** - * Word that may be inserted into an embedded grammar slot. - */ -public abstract class WordItem implements SlotItem -{ - /** - * Creates a new WordItem. - * - * @param word the word to insert - * @param pronunciations the pronunciations to associated with the item. If the list is - * is empty (example:new String[0]) the recognizer will attempt to guess the pronunciations. - * @return the WordItem - * @throws IllegalArgumentException if word is null or if pronunciations is - * null or pronunciations contains an element equal to null or empty string. - */ - public static WordItem valueOf(String word, String[] pronunciations) throws IllegalArgumentException - { - return WordItemImpl.valueOf(word, pronunciations); - } - - /** - * Creates a new WordItem. - * - * @param word the word to insert - * @param pronunciation the pronunciation to associate with the item. If it - * is null the recognizer will attempt to guess the pronunciations. - * @return the WordItem - * @throws IllegalArgumentException if word is null or if pronunciation is - * an empty string - */ - public static WordItem valueOf(String word, String pronunciation) throws IllegalArgumentException - { - return WordItemImpl.valueOf(word, pronunciation); - } -} diff --git a/core/java/android/speech/recognition/impl/AudioStreamImpl.java b/core/java/android/speech/recognition/impl/AudioStreamImpl.java deleted file mode 100644 index 730e2d937349c..0000000000000 --- a/core/java/android/speech/recognition/impl/AudioStreamImpl.java +++ /dev/null @@ -1,84 +0,0 @@ -/*---------------------------------------------------------------------------* - * AudioStreamImpl.java * - * * - * Copyright 2007, 2008 Nuance Communciations, Inc. * - * * - * Licensed under the Apache License, Version 2.0 (the 'License'); * - * you may not use this file except in compliance with the License. * - * * - * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 * - * * - * Unless required by applicable law or agreed to in writing, software * - * distributed under the License is distributed on an 'AS IS' BASIS, * - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * - * See the License for the specific language governing permissions and * - * limitations under the License. * - * * - *---------------------------------------------------------------------------*/ - -package android.speech.recognition.impl; - -import android.speech.recognition.AudioStream; - -/** - */ -public class AudioStreamImpl implements AudioStream, Runnable -{ - /** - * Reference to the native object. - */ - private long nativeObject; - - /** - * Creates a new AudioStreamImpl. - * - * @param nativeObj a reference to the native object - */ - public AudioStreamImpl(long nativeObj) - { - nativeObject = nativeObj; - } - - public synchronized void run() - { - dispose(); - } - - public long getNativeObject() { - synchronized (AudioStreamImpl.class) - { - return nativeObject; - } - } - - /** - * Releases the native resources associated with the object. - */ - @SuppressWarnings("deprecation") - public void dispose() - { - synchronized (AudioStreamImpl.class) - { - if (nativeObject != 0) - { - deleteNativeObject(nativeObject); - nativeObject = 0; - } - } - } - - @Override - protected void finalize() throws Throwable - { - dispose(); - super.finalize(); - } - - /** - * Deletes a native object. - * - * @param nativeObject pointer to the native object - */ - private native void deleteNativeObject(long nativeObject); -} diff --git a/core/java/android/speech/recognition/impl/DeviceSpeakerImpl.java b/core/java/android/speech/recognition/impl/DeviceSpeakerImpl.java deleted file mode 100644 index 5d721102f81d3..0000000000000 --- a/core/java/android/speech/recognition/impl/DeviceSpeakerImpl.java +++ /dev/null @@ -1,164 +0,0 @@ -/*---------------------------------------------------------------------------* - * DeviceSpeakerImpl.java * - * * - * Copyright 2007, 2008 Nuance Communciations, Inc. * - * * - * Licensed under the Apache License, Version 2.0 (the 'License'); * - * you may not use this file except in compliance with the License. * - * * - * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 * - * * - * Unless required by applicable law or agreed to in writing, software * - * distributed under the License is distributed on an 'AS IS' BASIS, * - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * - * See the License for the specific language governing permissions and * - * limitations under the License. * - * * - *---------------------------------------------------------------------------*/ - -package android.speech.recognition.impl; - -import android.speech.recognition.AudioStream; -import android.speech.recognition.Codec; -import android.speech.recognition.DeviceSpeaker; -import android.speech.recognition.DeviceSpeakerListener; - -/** - */ -public class DeviceSpeakerImpl extends DeviceSpeaker implements Runnable -{ - private static DeviceSpeakerImpl instance; - /** - * Reference to the native object. - */ - private long nativeObject; - private DeviceSpeakerListener locallistener; - - /** - * Private constructor - */ - private DeviceSpeakerImpl() - { - System system = System.getInstance(); - nativeObject = initNativeObject(); - if (nativeObject != 0) - system.register(this); - } - - public void run() - { - dispose(); - } - - /** - * Returns the singleton instance. - * - * @return the singleton instance - */ - public static DeviceSpeakerImpl getInstance() - { - synchronized (DeviceSpeakerImpl.class) - { - if (instance == null) - instance = new DeviceSpeakerImpl(); - return instance; - } - } - - /** - * Start audio playback. - * - * @param source the audio to play - */ - public void start(AudioStream source) - { - synchronized (DeviceSpeakerImpl.class) - { - if (nativeObject == 0) - throw new IllegalStateException("Object was destroyed."); - AudioStreamImpl src = (AudioStreamImpl)source; - startProxy(nativeObject,src.getNativeObject()); - src = null; - } - } - - /** - * Stops audio playback. - */ - public void stop() - { - synchronized (DeviceSpeakerImpl.class) - { - if (nativeObject == 0) - throw new IllegalStateException("Object was destroyed."); - stopProxy(nativeObject); - } - } - - /** - * Set the playback codec. This must be called before start is called. - * @param playbackCodec the codec to use for the playback operation. - */ - public void setCodec(Codec playbackCodec) - { - synchronized (DeviceSpeakerImpl.class) - { - if (nativeObject == 0) - throw new IllegalStateException("Object was destroyed."); - setCodecProxy(nativeObject,playbackCodec); - } - } - - /** - * set the microphone listener. - * @param listener the device speaker listener. - */ - public void setListener(DeviceSpeakerListener listener) - { - synchronized (DeviceSpeakerImpl.class) - { - if (nativeObject == 0) - throw new IllegalStateException("Object was destroyed."); - locallistener = listener; - setListenerProxy(nativeObject,listener); - } - } - - /** - * Releases the native resources associated with the object. - */ - private void dispose() - { - synchronized (DeviceSpeakerImpl.class) - { - if (nativeObject != 0) - { - deleteNativeObject(nativeObject); - nativeObject = 0; - instance = null; - locallistener = null; - System.getInstance().unregister(this); - } - } - } - - @Override - protected void finalize() throws Throwable - { - dispose(); - super.finalize(); - } - - private native long initNativeObject(); - - private native void startProxy(long nativeObject, long audioNativeObject); - - private native void stopProxy(long nativeObject); - - private native void setCodecProxy(long nativeObject,Codec playbackCodec); - - private native void setListenerProxy(long nativeObject,DeviceSpeakerListener listener); - - private native void deleteNativeObject(long nativeObject); -} diff --git a/core/java/android/speech/recognition/impl/EmbeddedGrammarImpl.java b/core/java/android/speech/recognition/impl/EmbeddedGrammarImpl.java deleted file mode 100644 index 0b88cb2e110b6..0000000000000 --- a/core/java/android/speech/recognition/impl/EmbeddedGrammarImpl.java +++ /dev/null @@ -1,73 +0,0 @@ -/*---------------------------------------------------------------------------* - * EmbeddedGrammarImpl.java * - * * - * Copyright 2007, 2008 Nuance Communciations, Inc. * - * * - * Licensed under the Apache License, Version 2.0 (the 'License'); * - * you may not use this file except in compliance with the License. * - * * - * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 * - * * - * Unless required by applicable law or agreed to in writing, software * - * distributed under the License is distributed on an 'AS IS' BASIS, * - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * - * See the License for the specific language governing permissions and * - * limitations under the License. * - * * - *---------------------------------------------------------------------------*/ - -package android.speech.recognition.impl; - -import android.speech.recognition.EmbeddedGrammar; - -/** - */ -public class EmbeddedGrammarImpl extends GrammarImpl implements EmbeddedGrammar -{ - /** - * Creates a new EmbeddedGrammarImpl. - * - * @param nativeObject a reference to the native object - */ - public EmbeddedGrammarImpl(long nativeObject) - { - super(nativeObject); - } - - public void compileAllSlots() - { - synchronized (GrammarImpl.class) - { - if (nativeObject == 0) - throw new IllegalStateException("Object was destroyed."); - compileAllSlotsProxy(nativeObject); - } - } - - public void resetAllSlots() - { - synchronized (GrammarImpl.class) - { - if (nativeObject == 0) - throw new IllegalStateException("Object was destroyed."); - resetAllSlotsProxy(nativeObject); - } - } - - public void save(String url) - { - synchronized (GrammarImpl.class) - { - if (nativeObject == 0) - throw new IllegalStateException("Object was destroyed."); - saveProxy(nativeObject, url.toString()); - } - } - - private native void compileAllSlotsProxy(long nativeObject); - - private native void resetAllSlotsProxy(long nativeObject); - - private native void saveProxy(long nativeObject, String url); -} diff --git a/core/java/android/speech/recognition/impl/EmbeddedRecognizerImpl.java b/core/java/android/speech/recognition/impl/EmbeddedRecognizerImpl.java deleted file mode 100644 index f04bfe4e17d9d..0000000000000 --- a/core/java/android/speech/recognition/impl/EmbeddedRecognizerImpl.java +++ /dev/null @@ -1,246 +0,0 @@ -/*---------------------------------------------------------------------------* - * EmbeddedRecognizerImpl.java * - * * - * Copyright 2007, 2008 Nuance Communciations, Inc. * - * * - * Licensed under the Apache License, Version 2.0 (the 'License'); * - * you may not use this file except in compliance with the License. * - * * - * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 * - * * - * Unless required by applicable law or agreed to in writing, software * - * distributed under the License is distributed on an 'AS IS' BASIS, * - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * - * See the License for the specific language governing permissions and * - * limitations under the License. * - * * - *---------------------------------------------------------------------------*/ - -package android.speech.recognition.impl; - -import java.io.FileNotFoundException; -import java.io.IOException; -import java.util.Hashtable; -import java.util.Vector; -import android.speech.recognition.EmbeddedRecognizer; -import android.speech.recognition.Grammar; -import android.speech.recognition.AudioStream; -import android.speech.recognition.Grammar; -import android.speech.recognition.RecognizerListener; -import android.speech.recognition.GrammarListener; - -/** - */ -public class EmbeddedRecognizerImpl extends EmbeddedRecognizer implements Runnable -{ - /** - * Reference to the native object. - */ - private long nativeObject; - /** - * The singleton instance. - */ - private static EmbeddedRecognizerImpl instance; - - /** - * Creates a new instance. - */ - EmbeddedRecognizerImpl() - { - System system = System.getInstance(); - nativeObject = getInstanceProxy(); - if (nativeObject != 0) - system.register(this); - } - - /** - * Returns the singleton instance. - * - * @return the singleton instance - */ - public synchronized static EmbeddedRecognizerImpl getInstance() - { - synchronized (EmbeddedRecognizerImpl.class) - { - if (instance == null) - instance = new EmbeddedRecognizerImpl(); - return instance; - } - } - - public void run() - { - dispose(); - } - - /** - * Releases the native resources associated with the object. - */ - private void dispose() - { - synchronized (EmbeddedRecognizerImpl.class) - { - if (instance != null) - { - deleteNativeObject(nativeObject); - nativeObject = 0; - instance = null; - System.getInstance().unregister(this); - } - } - } - - public void configure(String config) throws IllegalArgumentException, - FileNotFoundException, IOException, UnsatisfiedLinkError, - ClassNotFoundException - { - synchronized (EmbeddedRecognizerImpl.class) - { - if (nativeObject == 0) - throw new IllegalStateException("Object was destroyed."); - if (config == null) - throw new IllegalArgumentException("Configuration Is Null."); - configureProxy(nativeObject,config); - } - } - - public void setListener(RecognizerListener listener) - { - synchronized (EmbeddedRecognizerImpl.class) - { - if (nativeObject == 0) - throw new IllegalStateException("Object was destroyed."); - setListenerProxy(nativeObject,listener); - } - } - - public Grammar createGrammar(String value, GrammarListener listener) - throws IllegalArgumentException - { - synchronized (EmbeddedRecognizerImpl.class) - { - if (nativeObject == 0) - throw new IllegalStateException("Object was destroyed."); - long nativeGrammar = createEmbeddedGrammarProxy(nativeObject,value.toString(), listener); - return new SrecGrammarImpl(nativeGrammar); - } - } - - public void resetAcousticState() - { - synchronized (EmbeddedRecognizerImpl.class) - { - if (nativeObject == 0) - throw new IllegalStateException("Object was destroyed."); - resetAcousticStateProxy(nativeObject); - } - } - - public void recognize(AudioStream audio, - Vector grammars) - { - synchronized (EmbeddedRecognizerImpl.class) - { - if (nativeObject == 0) - throw new IllegalStateException("Object was destroyed."); - - if (audio == null) - throw new IllegalArgumentException("AudioStream cannot be null."); - - if (grammars == null || grammars.isEmpty() == true) - throw new IllegalArgumentException("Grammars are null or empty."); - int grammarCount = grammars.size(); - - long[] nativeGrammars = new long[grammarCount]; - - for (int i = 0; i < grammarCount; ++i) - nativeGrammars[i] = ((GrammarImpl) grammars.get(i)).getNativeObject(); - - recognizeProxy(nativeObject,((AudioStreamImpl)audio).getNativeObject(), nativeGrammars); - } - } - - public void recognize(AudioStream audio, - Grammar grammar) - { - synchronized (EmbeddedRecognizerImpl.class) - { - if (nativeObject == 0) - throw new IllegalStateException("Object was destroyed."); - } - Vector grammars = new Vector(); - grammars.add(grammar); - recognize(audio, grammars); - } - - public void stop() - { - synchronized (EmbeddedRecognizerImpl.class) - { - if (nativeObject == 0) - throw new IllegalStateException("Object was destroyed."); - stopProxy(nativeObject); - } - } - - public void setParameters(Hashtable params) - { - synchronized (EmbeddedRecognizerImpl.class) - { - if (nativeObject == 0) - throw new IllegalStateException("Object was destroyed."); - setParametersProxy(nativeObject,params); - } - } - - public void getParameters(Vector params) - { - synchronized (EmbeddedRecognizerImpl.class) - { - if (nativeObject == 0) - throw new IllegalStateException("Object was destroyed."); - getParametersProxy(nativeObject,params); - } - } - - /** - * Returns the native EmbeddedRecognizer. - * - * @return a reference to the native object - */ - private native long getInstanceProxy(); - - /** - * Configures the recognizer instance. - * - * @param config the recognizer configuration file - */ - private native void configureProxy(long nativeObject, String config) throws IllegalArgumentException, - FileNotFoundException, IOException, UnsatisfiedLinkError, - ClassNotFoundException; - - /** - * Sets the recognizer listener. - * - * @param listener listens for recognizer events - */ - private native void setListenerProxy(long nativeObject, RecognizerListener listener); - - private native void recognizeProxy(long nativeObject, long audioNativeObject, - long[] pGrammars); - - private native long createEmbeddedGrammarProxy(long nativeObject, String url, - GrammarListener listener); - - private native void stopProxy(long nativeObject); - - private native void deleteNativeObject(long nativeObject); - - private native void setParametersProxy(long nativeObject, Hashtable params); - - private native void getParametersProxy(long nativeObject, Vector params); - - private native void resetAcousticStateProxy(long nativeObject); - -} diff --git a/core/java/android/speech/recognition/impl/EntryImpl.java b/core/java/android/speech/recognition/impl/EntryImpl.java deleted file mode 100644 index 91b2b788013e3..0000000000000 --- a/core/java/android/speech/recognition/impl/EntryImpl.java +++ /dev/null @@ -1,147 +0,0 @@ -/*---------------------------------------------------------------------------* - * EntryImpl.java * - * * - * Copyright 2007, 2008 Nuance Communciations, Inc. * - * * - * Licensed under the Apache License, Version 2.0 (the 'License'); * - * you may not use this file except in compliance with the License. * - * * - * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 * - * * - * Unless required by applicable law or agreed to in writing, software * - * distributed under the License is distributed on an 'AS IS' BASIS, * - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * - * See the License for the specific language governing permissions and * - * limitations under the License. * - * * - *---------------------------------------------------------------------------*/ - -package android.speech.recognition.impl; - -import android.speech.recognition.NBestRecognitionResult; -import java.util.Enumeration; - -/** - */ -public class EntryImpl implements NBestRecognitionResult.Entry, Runnable -{ - private long nativeObject; - - /** - * This implementation is a work-around to solve Q bug with - * nested classes. - * - * @param nativeObject the native NBestRecognitionResult.Entry object - */ - public EntryImpl(long nativeObject) - { - this.nativeObject = nativeObject; - } - - public void run() - { - dispose(); - } - - public byte getConfidenceScore() throws IllegalStateException - { - synchronized (EntryImpl.class) - { - if (nativeObject == 0) - throw new IllegalStateException("Object has been disposed"); - return getConfidenceScoreProxy(nativeObject); - } - } - - public String getLiteralMeaning() throws IllegalStateException - { - synchronized (EntryImpl.class) - { - if (nativeObject == 0) - throw new IllegalStateException("Object has been disposed"); - return getLiteralMeaningProxy(nativeObject); - } - } - - public String getSemanticMeaning() throws IllegalStateException - { - synchronized (EntryImpl.class) - { - if (nativeObject == 0) - throw new IllegalStateException("Object has been disposed"); - return getSemanticMeaningProxy(nativeObject); - } - } - - public String get(String key) - { - synchronized (EntryImpl.class) - { - if (nativeObject == 0) - throw new IllegalStateException("Object has been disposed"); - return getProxy(nativeObject,key); - } - } - - public Enumeration keys() - { - synchronized (EntryImpl.class) - { - if (nativeObject == 0) - throw new IllegalStateException("Object has been disposed"); - - return new Enumeration() - { - private String[] keys = keysProxy(nativeObject); - private int indexOfNextRead = 0; - - public boolean hasMoreElements() - { - return indexOfNextRead <= keys.length-1; - } - - public Object nextElement() - { - return keys[indexOfNextRead++]; - } - }; - } - } - - - /** - * Releases the native resources associated with the object. - */ - private void dispose() - { - synchronized (EntryImpl.class) - { - if (nativeObject != 0) - { - deleteNativeObject(nativeObject); - nativeObject = 0; - } - } - } - - @Override - protected void finalize() throws Throwable - { - dispose(); - super.finalize(); - } - - private native void deleteNativeObject(long nativeObject); - - private native String getLiteralMeaningProxy(long nativeObject); - - private native String getSemanticMeaningProxy(long nativeObject); - - private native byte getConfidenceScoreProxy(long nativeObject); - - private native String getProxy(long nativeObject,String key); - - private native String[] keysProxy(long nativeObject); - -} diff --git a/core/java/android/speech/recognition/impl/GrammarImpl.java b/core/java/android/speech/recognition/impl/GrammarImpl.java deleted file mode 100644 index 563d5d9db7687..0000000000000 --- a/core/java/android/speech/recognition/impl/GrammarImpl.java +++ /dev/null @@ -1,114 +0,0 @@ -/*---------------------------------------------------------------------------* - * GrammarImpl.java * - * * - * Copyright 2007, 2008 Nuance Communciations, Inc. * - * * - * Licensed under the Apache License, Version 2.0 (the 'License'); * - * you may not use this file except in compliance with the License. * - * * - * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 * - * * - * Unless required by applicable law or agreed to in writing, software * - * distributed under the License is distributed on an 'AS IS' BASIS, * - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * - * See the License for the specific language governing permissions and * - * limitations under the License. * - * * - *---------------------------------------------------------------------------*/ - -package android.speech.recognition.impl; - -import android.speech.recognition.Grammar; - -/** - */ -public class GrammarImpl implements Grammar, Runnable -{ - /** - * Reference to the native object. - */ - protected long nativeObject; - - /** - * Creates a new GrammarImpl. - * - * @param nativeObj a reference to the native object - */ - public GrammarImpl(long nativeObj) - { - nativeObject = nativeObj; - } - - public void run() - { - dispose(); - } - - public long getNativeObject() - { - synchronized (GrammarImpl.class) - { - return nativeObject; - } - } - - /** - * Indicates that the grammar will be used in the near future. - */ - public void load() - { - synchronized (GrammarImpl.class) - { - if (nativeObject == 0) - throw new IllegalStateException("Object has been disposed"); - loadProxy(nativeObject); - } - } - - /** - * The grammar will be removed from use. - */ - public void unload() - { - synchronized (GrammarImpl.class) - { - if (nativeObject == 0) - throw new IllegalStateException("Object has been disposed"); - unloadProxy(nativeObject); - } - } - - /** - * Releases the native resources associated with the object. - */ - public void dispose() - { - synchronized (GrammarImpl.class) - { - if (nativeObject != 0) - { - deleteNativeObject(nativeObject); - nativeObject = 0; - } - } - } - - @Override - protected void finalize() throws Throwable - { - dispose(); - super.finalize(); - } - - /** - * Deletes a native object. - * - * @param nativeObject pointer to the native object - */ - private native void deleteNativeObject(long nativeObject); - - private native void loadProxy(long nativeObject); - - private native void unloadProxy(long nativeObject); -} diff --git a/core/java/android/speech/recognition/impl/LoggerImpl.java b/core/java/android/speech/recognition/impl/LoggerImpl.java deleted file mode 100644 index 9933c56b9be98..0000000000000 --- a/core/java/android/speech/recognition/impl/LoggerImpl.java +++ /dev/null @@ -1,166 +0,0 @@ -/*---------------------------------------------------------------------------* - * LoggerImpl.java * - * * - * Copyright 2007, 2008 Nuance Communciations, Inc. * - * * - * Licensed under the Apache License, Version 2.0 (the 'License'); * - * you may not use this file except in compliance with the License. * - * * - * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 * - * * - * Unless required by applicable law or agreed to in writing, software * - * distributed under the License is distributed on an 'AS IS' BASIS, * - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * - * See the License for the specific language governing permissions and * - * limitations under the License. * - * * - *---------------------------------------------------------------------------*/ - -package android.speech.recognition.impl; - -import android.speech.recognition.Logger; - -/** - */ -public class LoggerImpl extends Logger implements Runnable -{ - private static LoggerImpl instance; - /** - * Reference to the native object. - */ - private long nativeObject; - - /** - * Creates a new instance of LoggerImpl. - * - * @param function the name of the enclosing function - */ - private LoggerImpl() - { - System system = System.getInstance(); - nativeObject = initNativeObject(); - if (nativeObject!=0) - system.register(this); - } - - public void run() - { - dispose(); - } - - /** - * Returns the singleton instance. - * - * @return the singleton instance - */ - public static LoggerImpl getInstance() - { - synchronized (LoggerImpl.class) - { - if (instance == null) - instance = new LoggerImpl(); - return instance; - } - } - - public void setLoggingLevel(LogLevel level) - { - synchronized (LoggerImpl.class) - { - if (nativeObject == 0) - throw new IllegalStateException("Object has been disposed"); - setLoggingLevelProxy(nativeObject,level); - } - } - - public void setPath(String path) - { - synchronized (LoggerImpl.class) - { - if (nativeObject == 0) - throw new IllegalStateException("Object has been disposed"); - setPathProxy(nativeObject,path); - } - } - - public void error(String message) - { - synchronized (LoggerImpl.class) - { - if (nativeObject == 0) - throw new IllegalStateException("Object has been disposed"); - errorProxy(nativeObject,message); - } - } - - public void warn(String message) - { - synchronized (LoggerImpl.class) - { - if (nativeObject == 0) - throw new IllegalStateException("Object has been disposed"); - warnProxy(nativeObject,message); - } - } - - public void info(String message) - { - synchronized (LoggerImpl.class) - { - if (nativeObject == 0) - throw new IllegalStateException("Object has been disposed"); - infoProxy(nativeObject,message); - } - } - - public void trace(String message) - { - synchronized (LoggerImpl.class) - { - if (nativeObject == 0) - throw new IllegalStateException("Object has been disposed"); - traceProxy(nativeObject,message); - } - } - - /** - * Releases the native resources associated with the object. - */ - private void dispose() - { - synchronized (LoggerImpl.class) - { - if (nativeObject!=0) - { - deleteNativeObject(nativeObject); - System.getInstance().unregister(this); - } - nativeObject = 0; - instance = null; - } - } - - @Override - protected void finalize() throws Throwable - { - dispose(); - super.finalize(); - } - - private native long initNativeObject(); - - private native void setLoggingLevelProxy(long nativeObject, LogLevel level); - - private native void setPathProxy(long nativeObject, String filename); - - private native void errorProxy(long nativeObject, String message); - - private native void warnProxy(long nativeObject, String message); - - private native void infoProxy(long nativeObject, String message); - - private native void traceProxy(long nativeObject,String message); - - private native void deleteNativeObject(long nativeObject); -} diff --git a/core/java/android/speech/recognition/impl/MediaFileReaderImpl.java b/core/java/android/speech/recognition/impl/MediaFileReaderImpl.java deleted file mode 100644 index 8ce643df0c729..0000000000000 --- a/core/java/android/speech/recognition/impl/MediaFileReaderImpl.java +++ /dev/null @@ -1,156 +0,0 @@ -/*---------------------------------------------------------------------------* - * MediaFileReaderImpl.java * - * * - * Copyright 2007, 2008 Nuance Communciations, Inc. * - * * - * Licensed under the Apache License, Version 2.0 (the 'License'); * - * you may not use this file except in compliance with the License. * - * * - * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 * - * * - * Unless required by applicable law or agreed to in writing, software * - * distributed under the License is distributed on an 'AS IS' BASIS, * - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * - * See the License for the specific language governing permissions and * - * limitations under the License. * - * * - *---------------------------------------------------------------------------*/ - -package android.speech.recognition.impl; - -import android.speech.recognition.MediaFileReader; -import android.speech.recognition.AudioStream; -import android.speech.recognition.Codec; -import android.speech.recognition.AudioSourceListener; - -/** - */ -public class MediaFileReaderImpl extends MediaFileReader implements Runnable -{ - /** - * Reference to the native object. - */ - private long nativeObject; - - /** - * Creates a new MediaFileReaderImpl. - * - * @param filename the name of the file to read from - * @param listener listens for MediaFileReader events - */ - public MediaFileReaderImpl(String filename, AudioSourceListener listener) - { - System system = System.getInstance(); - nativeObject = - createMediaFileReaderProxy(filename, listener); - if (nativeObject != 0) - system.register(this); - } - - public void run() - { - dispose(); - } - - /** - * Set the reading mode - */ - public void setMode(Mode mode) - { - synchronized (MediaFileReaderImpl.class) - { - if (nativeObject == 0) - throw new IllegalStateException("Object has been disposed"); - setModeProxy(nativeObject,mode); - } - } - - /** - * Creates an audioStream source - */ - public AudioStream createAudio() - { - synchronized (MediaFileReaderImpl.class) - { - if (nativeObject == 0) - throw new IllegalStateException("Object has been disposed"); - return new AudioStreamImpl(createAudioProxy(nativeObject)); - } - } - - /** - * Tells the audio source to start collecting audio samples. - */ - public void start() - { - synchronized (MediaFileReaderImpl.class) - { - if (nativeObject == 0) - throw new IllegalStateException("Object has been disposed"); - startProxy(nativeObject); - } - } - - /** - * Stops this source from collecting audio samples. - */ - public void stop() - { - synchronized (MediaFileReaderImpl.class) - { - if (nativeObject == 0) - throw new IllegalStateException("Object has been disposed"); - stopProxy(nativeObject); - } - } - - /** - * Releases the native resources associated with the object. - */ - public void dispose() - { - synchronized (MediaFileReaderImpl.class) - { - if (nativeObject != 0) - { - deleteNativeObject(nativeObject); - nativeObject = 0; - System.getInstance().unregister(this); - } - } - } - - @Override - protected void finalize() throws Throwable - { - dispose(); - super.finalize(); - } - - /** - * Deletes a native object. - * - * @param nativeObject pointer to the native object - */ - private native void deleteNativeObject(long nativeObject); - - /** - * Creates a native MediaFileReader. - * - * @param filename the name of the file to read from - * @param offset the offset to begin reading from - * @param codec the file audio format - * @param listener listens for MediaFileReader events - * @return a reference to the native object - */ - private native long createMediaFileReaderProxy(String filename, AudioSourceListener listener); - - private native void setModeProxy(long nativeObject,Mode mode); - - private native long createAudioProxy(long nativeObject); - - private native void startProxy(long nativeObject); - - private native void stopProxy(long nativeObject); -} diff --git a/core/java/android/speech/recognition/impl/MediaFileWriterImpl.java b/core/java/android/speech/recognition/impl/MediaFileWriterImpl.java deleted file mode 100644 index c4bd836b396c2..0000000000000 --- a/core/java/android/speech/recognition/impl/MediaFileWriterImpl.java +++ /dev/null @@ -1,102 +0,0 @@ -/*---------------------------------------------------------------------------* - * MediaFileWriterImpl.java * - * * - * Copyright 2007, 2008 Nuance Communciations, Inc. * - * * - * Licensed under the Apache License, Version 2.0 (the 'License'); * - * you may not use this file except in compliance with the License. * - * * - * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 * - * * - * Unless required by applicable law or agreed to in writing, software * - * distributed under the License is distributed on an 'AS IS' BASIS, * - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * - * See the License for the specific language governing permissions and * - * limitations under the License. * - * * - *---------------------------------------------------------------------------*/ - -package android.speech.recognition.impl; - -import android.speech.recognition.AudioStream; -import android.speech.recognition.MediaFileWriter; -import android.speech.recognition.MediaFileWriterListener; - -/** - */ -public class MediaFileWriterImpl extends MediaFileWriter implements Runnable -{ - /** - * Reference to the native object. - */ - private long nativeObject; - - /** - * Creates a new MediaFileWriterImpl. - * - * @param listener listens for MediaFileWriter events - */ - public MediaFileWriterImpl(MediaFileWriterListener listener) - { - System system = System.getInstance(); - nativeObject = createMediaFileWriterProxy(listener); - if (nativeObject != 0) - system.register(this); - } - - public void run() - { - dispose(); - } - - public void save(AudioStream source, String filename) - { - synchronized (MediaFileWriterImpl.class) - { - if (nativeObject == 0) - throw new IllegalStateException("Object has been disposed"); - saveProxy(nativeObject,((AudioStreamImpl)source).getNativeObject(), filename); - } - } - - /** - * Releases the native resources associated with the object. - */ - public synchronized void dispose() - { - synchronized (MediaFileWriterImpl.class) - { - if (nativeObject != 0) - { - deleteNativeObject(nativeObject); - nativeObject = 0; - System.getInstance().unregister(this); - } - } - } - - @Override - protected void finalize() throws Throwable - { - dispose(); - super.finalize(); - } - - /** - * Creates a native MediaFileWriter. - * - * @param listener listens for MediaFileReader events - * @return a reference to the native object - */ - private native long createMediaFileWriterProxy(MediaFileWriterListener listener); - - /** - * Deletes a native object. - * - * @param nativeObject pointer to the native object - */ - private native void deleteNativeObject(long nativeObject); - - private native void saveProxy(long nativeObject, long audioNativeObject, String filename); -} diff --git a/core/java/android/speech/recognition/impl/MicrophoneImpl.java b/core/java/android/speech/recognition/impl/MicrophoneImpl.java deleted file mode 100644 index a91548404cfb3..0000000000000 --- a/core/java/android/speech/recognition/impl/MicrophoneImpl.java +++ /dev/null @@ -1,165 +0,0 @@ -/*---------------------------------------------------------------------------* - * MicrophoneImpl.java * - * * - * Copyright 2007, 2008 Nuance Communciations, Inc. * - * * - * Licensed under the Apache License, Version 2.0 (the 'License'); * - * you may not use this file except in compliance with the License. * - * * - * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 * - * * - * Unless required by applicable law or agreed to in writing, software * - * distributed under the License is distributed on an 'AS IS' BASIS, * - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * - * See the License for the specific language governing permissions and * - * limitations under the License. * - * * - *---------------------------------------------------------------------------*/ - -package android.speech.recognition.impl; - -import android.speech.recognition.AudioStream; -import android.speech.recognition.Codec; -import android.speech.recognition.Microphone; -import android.speech.recognition.AudioSourceListener; - -/** - */ -public class MicrophoneImpl extends Microphone implements Runnable -{ - private static MicrophoneImpl instance; - /** - * Reference to the native object. - */ - private long nativeObject; - - /** - * Creates a new MicrophoneImpl. - * - * @param nativeObj a reference to the native object - */ - private MicrophoneImpl() - { - System system = System.getInstance(); - nativeObject = initNativeObject(); - if (nativeObject != 0) - system.register(this); - } - - public void run() - { - dispose(); - } - - /** - * Returns the singleton instance. - * - * @return the singleton instance - */ - public static MicrophoneImpl getInstance() - { - synchronized (MicrophoneImpl.class) - { - if (instance == null) - instance = new MicrophoneImpl(); - return instance; - } - } - - /** - * set the recording codec. This must be called before Start is called. - * @param recordingCodec the codec in which the samples will be recorded. - */ - public void setCodec(Codec recordingCodec) - { - synchronized (MicrophoneImpl.class) - { - if (nativeObject == 0) - throw new IllegalStateException("Object has been disposed"); - setCodecProxy(nativeObject,recordingCodec); - } - } - - /** - * set the microphone listener. - * @param listener the microphone listener. - */ - public void setListener(AudioSourceListener listener) - { - synchronized (MicrophoneImpl.class) - { - if (nativeObject == 0) - throw new IllegalStateException("Object has been disposed"); - setListenerProxy(nativeObject,listener); - } - } - - public AudioStream createAudio() - { - synchronized (MicrophoneImpl.class) - { - if (nativeObject == 0) - throw new IllegalStateException("Object has been disposed"); - return new AudioStreamImpl(createAudioProxy(nativeObject)); - } - } - - public void start() - { - synchronized (MicrophoneImpl.class) - { - if (nativeObject == 0) - throw new IllegalStateException("Object has been disposed"); - startProxy(nativeObject); - } - } - - public void stop() - { - synchronized (MicrophoneImpl.class) - { - if (nativeObject == 0) - throw new IllegalStateException("Object has been disposed"); - stopProxy(nativeObject); - } - } - - /** - * Releases the native resources associated with the object. - */ - private void dispose() - { - synchronized (MicrophoneImpl.class) - { - if (nativeObject != 0) - { - deleteNativeObject(nativeObject); - nativeObject = 0; - instance = null; - System.getInstance().unregister(this); - } - } - } - - @Override - protected void finalize() throws Throwable - { - dispose(); - super.finalize(); - } - - private native long initNativeObject(); - - private native void setCodecProxy(long nativeObject,Codec recordingCodec); - - private native void setListenerProxy(long nativeObject, AudioSourceListener listener); - - private native long createAudioProxy(long nativeObject); - - private native void startProxy(long nativeObject); - - private native void stopProxy(long nativeObject); - - private native void deleteNativeObject(long nativeObject); -} diff --git a/core/java/android/speech/recognition/impl/NBestRecognitionResultImpl.java b/core/java/android/speech/recognition/impl/NBestRecognitionResultImpl.java deleted file mode 100644 index 4d2e00a38353d..0000000000000 --- a/core/java/android/speech/recognition/impl/NBestRecognitionResultImpl.java +++ /dev/null @@ -1,106 +0,0 @@ -/*---------------------------------------------------------------------------* - * NBestRecognitionResultImpl.java * - * * - * Copyright 2007, 2008 Nuance Communciations, Inc. * - * * - * Licensed under the Apache License, Version 2.0 (the 'License'); * - * you may not use this file except in compliance with the License. * - * * - * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 * - * * - * Unless required by applicable law or agreed to in writing, software * - * distributed under the License is distributed on an 'AS IS' BASIS, * - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * - * See the License for the specific language governing permissions and * - * limitations under the License. * - * * - *---------------------------------------------------------------------------*/ - -package android.speech.recognition.impl; - -import android.speech.recognition.NBestRecognitionResult; -import android.speech.recognition.VoicetagItem; -import android.speech.recognition.VoicetagItemListener; -/** - */ -public class NBestRecognitionResultImpl implements NBestRecognitionResult -{ - /** - * Reference to the native object. - */ - private long nativeObject; - - /** - * Creates a new NBestRecognitionResultImpl. - * - * @param nativeObject a reference to the native object - */ - public NBestRecognitionResultImpl(long nativeObject) - { - this.nativeObject = nativeObject; - } - - public int getSize() - { - synchronized (NBestRecognitionResultImpl.class) - { - if (nativeObject == 0) - throw new IllegalStateException("Object has been disposed"); - return getSizeProxy(nativeObject); - } - } - - public Entry getEntry(int index) - { - synchronized (NBestRecognitionResultImpl.class) - { - if (nativeObject == 0) - throw new IllegalStateException("Object has been disposed"); - long nativeEntryObject = getEntryProxy(nativeObject,index); - if (nativeEntryObject==0) - return null; - else - return new EntryImpl(nativeEntryObject); - } - } - - public VoicetagItem createVoicetagItem(String VoicetagId, VoicetagItemListener listener) - { - synchronized (NBestRecognitionResultImpl.class) - { - if (nativeObject == 0) - throw new IllegalStateException("Object has been disposed"); - if ((VoicetagId == null) || (VoicetagId.length() == 0)) - throw new IllegalArgumentException("VoicetagId may not be null or empty string."); - return new VoicetagItemImpl(createVoicetagItemProxy(nativeObject,VoicetagId,listener),false); - } - } - - /** - * Releases the native resources associated with the object. - */ - private void dispose() - { - synchronized (NBestRecognitionResultImpl.class) - { - nativeObject = 0; - } - } - - @Override - protected void finalize() throws Throwable - { - dispose(); - super.finalize(); - } - - /** - * Returns a reference to the native VoicetagItem. - */ - private native long createVoicetagItemProxy(long nativeObject, String VoicetagId, VoicetagItemListener listener); - - private native long getEntryProxy(long nativeObject, int index); - - private native int getSizeProxy(long nativeObject); -} diff --git a/core/java/android/speech/recognition/impl/SrecGrammarImpl.java b/core/java/android/speech/recognition/impl/SrecGrammarImpl.java deleted file mode 100644 index cb6f4c65930b2..0000000000000 --- a/core/java/android/speech/recognition/impl/SrecGrammarImpl.java +++ /dev/null @@ -1,120 +0,0 @@ -/*---------------------------------------------------------------------------* - * SrecGrammarImpl.java * - * * - * Copyright 2007, 2008 Nuance Communciations, Inc. * - * * - * Licensed under the Apache License, Version 2.0 (the 'License'); * - * you may not use this file except in compliance with the License. * - * * - * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 * - * * - * Unless required by applicable law or agreed to in writing, software * - * distributed under the License is distributed on an 'AS IS' BASIS, * - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * - * See the License for the specific language governing permissions and * - * limitations under the License. * - * * - *---------------------------------------------------------------------------*/ - -package android.speech.recognition.impl; - -import android.speech.recognition.SrecGrammar; -import android.speech.recognition.SlotItem; -import android.speech.recognition.VoicetagItem; -import android.speech.recognition.WordItem; - -import java.util.Vector; - -/** - */ -public class SrecGrammarImpl extends EmbeddedGrammarImpl implements SrecGrammar -{ - /** - * Creates a new SrecGrammarImpl. - * - * @param nativeObject the native object - */ - public SrecGrammarImpl(long nativeObject) - { - super(nativeObject); - } - - public void addItem(String slotName, SlotItem item, int weight, - String semanticValue) - { - synchronized (GrammarImpl.class) - { - if (nativeObject == 0) - throw new IllegalStateException("Object has been disposed"); - - if (slotName == null || slotName.length()==0) - throw new IllegalArgumentException("addItem() - Slot name is null or empty."); - if (item == null) - throw new IllegalArgumentException("addItem() - item can't be null."); - if (semanticValue == null || semanticValue.length()==0) - throw new IllegalArgumentException("addItem() - semanticValue is null or empty."); - - long itemNativeObject = 0; - if (item instanceof VoicetagItem) - itemNativeObject = ((VoicetagItemImpl)item).getNativeObject(); - else if (item instanceof WordItem) - itemNativeObject = ((WordItemImpl)item).getNativeObject(); - else - throw new IllegalArgumentException("SlotItem - should be a WordItem or a VoicetagItem object."); - - addItemProxy(nativeObject, slotName, itemNativeObject, weight, semanticValue); - } - } - - public void addItemList(String slotName, Vector items) - { - synchronized (GrammarImpl.class) - { - if (nativeObject == 0) - throw new IllegalStateException("Object has been disposed"); - - if (slotName == null || slotName.length()==0) - throw new IllegalArgumentException("addItemList - Slot name is null or empty."); - if (items == null || items.isEmpty() == true) - throw new IllegalArgumentException("addItemList - Items is null or empty."); - - int itemsCount = items.size(); - - long[] nativeSlots = new long[itemsCount]; - int[] nativeWeights = new int[itemsCount]; - String[] nativeSemantic = new String[itemsCount]; - - Item element = null; - long itemNativeObject = 0; - SlotItem item = null; - for (int i = 0; i < itemsCount; ++i) - { - element = items.get(i); - - item = element._item; - if (item instanceof VoicetagItem) - itemNativeObject = ((VoicetagItemImpl)item).getNativeObject(); - else if (item instanceof WordItem) - itemNativeObject = ((WordItemImpl)item).getNativeObject(); - else - { - throw new IllegalArgumentException("SlotItem ["+i+"] - should be a WordItem or a VoicetagItem object."); - } - nativeSlots[i] = itemNativeObject; - nativeWeights[i] = element._weight; - nativeSemantic[i]= element._semanticMeaning; - itemNativeObject = 0; - item = null; - } - addItemListProxy(nativeObject, slotName,nativeSlots,nativeWeights,nativeSemantic); - } - } - - private native void addItemProxy(long nativeObject, String slotName, long item, int weight, - String semanticValue); - - private native void addItemListProxy(long nativeObject, String slotName, long[] items, - int[] weights, String[] semanticValues); - -} diff --git a/core/java/android/speech/recognition/impl/System.java b/core/java/android/speech/recognition/impl/System.java deleted file mode 100644 index 23418feab258a..0000000000000 --- a/core/java/android/speech/recognition/impl/System.java +++ /dev/null @@ -1,179 +0,0 @@ -/*---------------------------------------------------------------------------* - * System.java * - * * - * Copyright 2007, 2008 Nuance Communciations, Inc. * - * * - * Licensed under the Apache License, Version 2.0 (the 'License'); * - * you may not use this file except in compliance with the License. * - * * - * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 * - * * - * Unless required by applicable law or agreed to in writing, software * - * distributed under the License is distributed on an 'AS IS' BASIS, * - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * - * See the License for the specific language governing permissions and * - * limitations under the License. * - * * - *---------------------------------------------------------------------------*/ - -package android.speech.recognition.impl; - -import java.lang.ref.WeakReference; -import java.util.WeakHashMap; - - -/** - */ -public class System -{ - private static boolean libraryLoaded; - private static System instance; - private static WeakHashMap registerMap; - /** - * Reference to the native object. - */ - private long nativeObject; - private boolean shutdownRequested; - - /** - * Creates a new instance of System - */ - private System() - { - shutdownRequested = false; - registerMap = - new WeakHashMap(); - initLibrary(); - nativeObject = initNativeObject(); - Runtime.getRuntime(). - addShutdownHook(new Thread() - { - @Override - public void run() - { - try - { - dispose(); - } - catch (Exception e) - { - e.printStackTrace(); - } - } - }); - - } - - /** - * Returns the singleton instance. - * - * @return the singleton instance - */ - public static System getInstance() - { - synchronized (System.class) - { - if (instance == null) - instance = new System(); - return instance; - } - } - - /** - * Loads the native library if necessary. - */ - private void initLibrary() - { - if (!libraryLoaded) - { - java.lang.System.loadLibrary("UAPI_jni"); - libraryLoaded = true; - } - } - - /** - * Registers an object for shutdown when System.dispose() is invoked. - * - * @param r the code to run on shutdown - * @throws IllegalStateException if the System is shutting down - */ - public void register(Runnable r) throws IllegalStateException - { - synchronized (System.class) - { - if (shutdownRequested) - throw new IllegalStateException("System is shutting down"); - registerMap.put(r, - new WeakReference(r)); - } - } - - /** - * Registers an object for shutdown when System.dispose() is invoked. - * - * @param r the code to run on shutdown - */ - public void unregister(Runnable r) - { - synchronized (System.class) - { - if (shutdownRequested) - { - // System.dispose() will end up removing all entries - return; - } - if (r!=null) registerMap.remove(r); - } - } - - /** - * Releases the native resources associated with the object. - * - * @throws java.util.concurrent.TimeoutException if the operation timeouts - * @throws IllegalThreadStateException if a native thread error occurs - */ - public void dispose() throws java.util.concurrent.TimeoutException, - IllegalThreadStateException - { - synchronized (System.class) - { - if (nativeObject == 0) - return; - shutdownRequested = true; - } - - // Traverse the list of WeakReferences - // cast to a Runnable object if the weakrerefence is not null - // then call the run method. - for (Object o: registerMap.keySet()) - { - WeakReference weakReference = registerMap.get(o); - Runnable r = (Runnable) weakReference.get(); - if (r != null) - r.run(); - } - registerMap.clear(); - - // Call the native dispose method - disposeProxy(); - synchronized (System.class) - { - nativeObject = 0; - instance = null; - } - } - - @Override - protected void finalize() throws Throwable - { - dispose(); - super.finalize(); - } - - public static native String getAPIVersion(); - - private static native long initNativeObject(); - - private static native void disposeProxy(); -} diff --git a/core/java/android/speech/recognition/impl/VoicetagItemImpl.java b/core/java/android/speech/recognition/impl/VoicetagItemImpl.java deleted file mode 100644 index f9db3992835c0..0000000000000 --- a/core/java/android/speech/recognition/impl/VoicetagItemImpl.java +++ /dev/null @@ -1,206 +0,0 @@ -/*---------------------------------------------------------------------------* - * VoicetagItemImpl.java * - * * - * Copyright 2007, 2008 Nuance Communciations, Inc. * - * * - * Licensed under the Apache License, Version 2.0 (the 'License'); * - * you may not use this file except in compliance with the License. * - * * - * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 * - * * - * Unless required by applicable law or agreed to in writing, software * - * distributed under the License is distributed on an 'AS IS' BASIS, * - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * - * See the License for the specific language governing permissions and * - * limitations under the License. * - * * - *---------------------------------------------------------------------------*/ - -package android.speech.recognition.impl; - -import android.speech.recognition.VoicetagItem; -import android.speech.recognition.VoicetagItemListener; -import java.io.FileNotFoundException; -import java.io.IOException; -/** - */ -public class VoicetagItemImpl extends VoicetagItem implements Runnable -{ - /** - * Reference to the native object. - */ - private long nativeObject; - /** - * Voicetag has a filename need to be loaded before use it. - */ - private boolean needToBeLoaded; - - /** - * Creates a new VoicetagItemImpl. - * - * @param nativeObject the pointer to the native object - */ - public VoicetagItemImpl(long nativeObject, boolean fromfile) - { - this.nativeObject = nativeObject; - needToBeLoaded = fromfile; - } - - public void run() - { - dispose(); - } - - /** - * Creates a VoicetagItem from a file - * - * @param filename filename for Voicetag - * @param listener listens for Voicetag events - * @return the resulting VoicetagItem - * @throws IllegalArgumentException if filename is null or an empty string. - * @throws FileNotFoundException if the specified filename could not be found - * @throws IOException if the specified filename could not be opened - */ - public static VoicetagItem create(String filename, VoicetagItemListener listener) throws IllegalArgumentException,FileNotFoundException,IOException - { - if ((filename == null) || (filename.length() == 0)) - throw new IllegalArgumentException("Filename may not be null or empty string."); - - VoicetagItemImpl voicetag = null; - long nativeVoicetag = createVoicetagProxy(filename,listener); - if (nativeVoicetag!=0) - { - voicetag = new VoicetagItemImpl(nativeVoicetag,true); - } - return voicetag; - } - /** - * Returns the audio used to construct the VoicetagItem. - */ - public byte[] getAudio() throws IllegalStateException - { - synchronized (VoicetagItem.class) - { - if (nativeObject == 0) - throw new IllegalStateException("Object was destroyed."); - - return getAudioProxy(nativeObject); - } - } - - /** - * Sets the audio used to construct the Voicetag. - */ - public void setAudio(byte[] waveform) throws IllegalArgumentException,IllegalStateException - { - synchronized (VoicetagItem.class) - { - if (nativeObject == 0) - throw new IllegalStateException("Object was destroyed."); - - if ((waveform == null) || (waveform.length == 0)) - throw new IllegalArgumentException("Waveform may not be null or empty."); - setAudioProxy(nativeObject,waveform); - } - } - - /** - * Save the Voicetag. - */ - public void save(String path) throws IllegalArgumentException - { - synchronized (VoicetagItem.class) - { - if (nativeObject == 0) - throw new IllegalStateException("Object was destroyed."); - if ((path == null) || (path.length() == 0)) - throw new IllegalArgumentException("Path may not be null or empty string."); - saveVoicetagProxy(nativeObject,path); - } - } - - /** - * Load a Voicetag. - */ - public void load() throws IllegalStateException - { - synchronized (VoicetagItem.class) - { - if (nativeObject == 0) - throw new IllegalStateException("Object was destroyed."); - if (!needToBeLoaded) - throw new IllegalStateException("This Voicetag was not created from a file, does not need to be loaded."); - loadVoicetagProxy(nativeObject); - } - } - - public long getNativeObject() - { - synchronized (VoicetagItem.class) - { - return nativeObject; - } - } - - /** - * Releases the native resources associated with the object. - */ - private void dispose() - { - synchronized (VoicetagItem.class) - { - if (nativeObject != 0) - { - deleteNativeObject(nativeObject); - nativeObject = 0; - } - } - } - - @Override - protected void finalize() throws Throwable - { - dispose(); - super.finalize(); - } - - - private static native long createVoicetagProxy(String filename, VoicetagItemListener listener); - /** - * (Optional operation) Returns the audio used to construct the Voicetag. The - * audio is in PCM format and is start-pointed and end-pointed. The audio is - * only generated if the enableGetWaveform recognition parameter is set - * prior to recognition. - * - * @see RecognizerParameters.enableGetWaveform - */ - private native byte[] getAudioProxy(long nativeObject); - - /** - * (Optional operation) Sets the audio used to construct the Voicetag. The - * audio is in PCM format and is start-pointed and end-pointed. The audio is - * only generated if the enableGetWaveform recognition parameter is set - * prior to recognition. - * - * @param waveform the endpointed waveform - */ - private native void setAudioProxy(long nativeObject, byte[] waveform); - - /** - * Save the Voicetag Item. - */ - private native void saveVoicetagProxy(long nativeObject, String path); - - /** - * Load a Voicetag Item. - */ - private native void loadVoicetagProxy(long nativeObject); - - /** - * Deletes a native object. - * - * @param nativeObject pointer to the native object - */ - private native void deleteNativeObject(long nativeObject); -} diff --git a/core/java/android/speech/recognition/impl/WordItemImpl.java b/core/java/android/speech/recognition/impl/WordItemImpl.java deleted file mode 100644 index f0daa345e98f6..0000000000000 --- a/core/java/android/speech/recognition/impl/WordItemImpl.java +++ /dev/null @@ -1,157 +0,0 @@ -/*---------------------------------------------------------------------------* - * WordItemImpl.java * - * * - * Copyright 2007, 2008 Nuance Communciations, Inc. * - * * - * Licensed under the Apache License, Version 2.0 (the 'License'); * - * you may not use this file except in compliance with the License. * - * * - * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 * - * * - * Unless required by applicable law or agreed to in writing, software * - * distributed under the License is distributed on an 'AS IS' BASIS, * - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * - * See the License for the specific language governing permissions and * - * limitations under the License. * - * * - *---------------------------------------------------------------------------*/ - -package android.speech.recognition.impl; - -import android.speech.recognition.WordItem; - -/** - */ -public class WordItemImpl extends WordItem implements Runnable -{ - /** - * Empty array that gets reused whenever the code requests that the underlying - * recognizer guess the pronunciations. - */ - private static final String[] guessPronunciations = new String[0]; - /** - * Reference to the native object. - */ - private long nativeObject; - - /** - * Creates a new WordItem. - * - * @param word the word to insert - * @throws IllegalArgumentException if word or pronunciations are null - */ - private WordItemImpl(String word, String[] pronunciations) throws IllegalArgumentException - { - initNativeObject(word, pronunciations); - } - - public void run() - { - dispose(); - } - - /** - * Creates a new WordItem. - * - * @param word the word to insert - * @param pronunciations the pronunciations to associated with the item. If the list is - * is empty (example:new String[0]) the recognizer will attempt to guess the pronunciations. - * @return the WordItem - * @throws IllegalArgumentException if word is null or if pronunciations is - * null or pronunciations contains an element equal to null or empty string. - */ - public static WordItemImpl valueOf(String word, String[] pronunciations) - throws IllegalArgumentException - { - if (word == null) - throw new IllegalArgumentException("Word may not be null"); - else if (pronunciations == null) - throw new IllegalArgumentException("Pronunciations may not be null"); - for (int i = 0, size = pronunciations.length; i < size; ++i) - { - if (pronunciations[i]==null) - { - throw new IllegalArgumentException( - "Pronunciations element may not be null"); - } - else - { - if (pronunciations[i].trim().equals("")) - throw new IllegalArgumentException( - "Pronunciations may not contain empty strings"); - } - } - return new WordItemImpl(word, pronunciations); - } - - /** - * Creates a new WordItem. - * - * @param word the word to insert - * @param pronunciation the pronunciation to associate with the item. If it - * is null the recognizer will attempt to guess the pronunciations. - * @return the WordItem - * @throws IllegalArgumentException if word is null or if pronunciation is - * an empty string - */ - public static WordItemImpl valueOf(String word, String pronunciation) - throws IllegalArgumentException - { - String[] pronunciations; - if (word == null) - throw new IllegalArgumentException("Word may not be null"); - else if (pronunciation == null) - pronunciations = guessPronunciations; - else if (pronunciation.trim().equals("")) - throw new IllegalArgumentException( - "Pronunciation may not be an empty string"); - else - pronunciations = new String[]{pronunciation}; - return new WordItemImpl(word, pronunciations); - } - - /** - * Allocates a reference to the native object. - * - * @param word the word to insert - */ - private native void initNativeObject(String word, String[] pronunciations); - - public long getNativeObject() - { - synchronized (WordItemImpl.class) - { - return nativeObject; - } - } - - /** - * Releases the native resources associated with the object. - */ - private void dispose() - { - synchronized (WordItemImpl.class) - { - if (nativeObject != 0) - { - deleteNativeObject(nativeObject); - nativeObject = 0; - } - } - } - - @Override - protected void finalize() throws Throwable - { - dispose(); - super.finalize(); - } - - /** - * Deletes a native object. - * - * @param nativeObject pointer to the native object - */ - private native void deleteNativeObject(long nativeObject); -} diff --git a/core/java/android/speech/recognition/impl/package.html b/core/java/android/speech/recognition/impl/package.html deleted file mode 100755 index 1c9bf9dad8350..0000000000000 --- a/core/java/android/speech/recognition/impl/package.html +++ /dev/null @@ -1,5 +0,0 @@ - - - {@hide} - - diff --git a/core/java/android/speech/recognition/package.html b/core/java/android/speech/recognition/package.html deleted file mode 100644 index 3c59962ccd671..0000000000000 --- a/core/java/android/speech/recognition/package.html +++ /dev/null @@ -1,6 +0,0 @@ - - -{@hide} -Provides classes for speech recogntion. - - diff --git a/core/java/android/speech/srec/MicrophoneInputStream.java b/core/java/android/speech/srec/MicrophoneInputStream.java new file mode 100644 index 0000000000000..160a0034a5dda --- /dev/null +++ b/core/java/android/speech/srec/MicrophoneInputStream.java @@ -0,0 +1,106 @@ +/*---------------------------------------------------------------------------* + * MicrophoneInputStream.java * + * * + * Copyright 2007 Nuance Communciations, Inc. * + * * + * Licensed under the Apache License, Version 2.0 (the 'License'); * + * you may not use this file except in compliance with the License. * + * * + * You may obtain a copy of the License at * + * http://www.apache.org/licenses/LICENSE-2.0 * + * * + * Unless required by applicable law or agreed to in writing, software * + * distributed under the License is distributed on an 'AS IS' BASIS, * + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * + * See the License for the specific language governing permissions and * + * limitations under the License. * + * * + *---------------------------------------------------------------------------*/ + + +package android.speech.srec; + +import java.io.IOException; +import java.io.InputStream; +import java.lang.IllegalStateException; + + +/** + * PCM input stream from the microphone, 16 bits per sample. + */ +public final class MicrophoneInputStream extends InputStream { + static { + System.loadLibrary("srec_jni"); + } + + private final static String TAG = "MicrophoneInputStream"; + private int mAudioRecord = 0; + private byte[] mOneByte = new byte[1]; + + /** + * MicrophoneInputStream constructor. + * @param sampleRate sample rate of the microphone, typically 11025 or 8000. + * @param fifoDepth depth of the real time fifo, measured in sampleRate clock ticks. + * This determines how long an application may delay before losing data. + */ + public MicrophoneInputStream(int sampleRate, int fifoDepth) throws IOException { + mAudioRecord = AudioRecordNew(sampleRate, fifoDepth); + if (mAudioRecord == 0) throw new IllegalStateException("not open"); + AudioRecordStart(mAudioRecord); + } + + @Override + public int read() throws IOException { + if (mAudioRecord == 0) throw new IllegalStateException("not open"); + int rtn = AudioRecordRead(mAudioRecord, mOneByte, 0, 1); + return rtn == 1 ? ((int)mOneByte[0] & 0xff) : -1; + } + + @Override + public int read(byte[] b) throws IOException { + if (mAudioRecord == 0) throw new IllegalStateException("not open"); + return AudioRecordRead(mAudioRecord, b, 0, b.length); + } + + @Override + public int read(byte[] b, int offset, int length) throws IOException { + if (mAudioRecord == 0) throw new IllegalStateException("not open"); + // TODO: should we force all reads to be a multiple of the sample size? + return AudioRecordRead(mAudioRecord, b, offset, length); + } + + /** + * Closes this stream. + */ + @Override + public void close() throws IOException { + if (mAudioRecord != 0) { + try { + AudioRecordStop(mAudioRecord); + } finally { + try { + AudioRecordDelete(mAudioRecord); + } finally { + mAudioRecord = 0; + } + } + } + } + + @Override + protected void finalize() throws Throwable { + if (mAudioRecord != 0) { + close(); + throw new IOException("someone forgot to close MicrophoneInputStream"); + } + } + + // + // AudioRecord JNI interface + // + private static native int AudioRecordNew(int sampleRate, int fifoDepth); + private static native void AudioRecordStart(int audioRecord); + private static native int AudioRecordRead(int audioRecord, byte[] b, int offset, int length) throws IOException; + private static native void AudioRecordStop(int audioRecord) throws IOException; + private static native void AudioRecordDelete(int audioRecord) throws IOException; +} diff --git a/core/java/android/speech/srec/Recognizer.java b/core/java/android/speech/srec/Recognizer.java new file mode 100644 index 0000000000000..749c9235cd38a --- /dev/null +++ b/core/java/android/speech/srec/Recognizer.java @@ -0,0 +1,679 @@ +/* + * --------------------------------------------------------------------------- + * Recognizer.java + * + * Copyright 2007 Nuance Communciations, Inc. + * + * Licensed under the Apache License, Version 2.0 (the 'License'); you may not + * use this file except in compliance with the License. + * + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + * + * --------------------------------------------------------------------------- + */ + + +package android.speech.srec; + +import android.util.Config; +import android.util.Log; + +import java.io.File; +import java.io.InputStream; +import java.io.IOException; +import java.util.Locale; + +/** + * Simple, synchronous speech recognizer, using the Nuance SREC package. + * Usages proceeds as follows: + * + *
      + *
    • Create a Recognizer. + *
    • Create a Recognizer.Grammar. + *
    • Setup the Recognizer.Grammar. + *
    • Reset the Recognizer.Grammar slots, if needed. + *
    • Fill the Recognizer.Grammar slots, if needed. + *
    • Compile the Recognizer.Grammar, if needed. + *
    • Save the filled Recognizer.Grammar, if needed. + *
    • Start the Recognizer. + *
    • Loop over advance and putAudio until recognition complete. + *
    • Fetch and process results, or notify of failure. + *
    • Stop the Recognizer. + *
    • Destroy the Recognizer. + *
    + * + *

    Below is example code

    + * + *
    + * 
    + * // create and start audio input
    + * InputStream audio = new MicrophoneInputStream(11025, 11025*5);
    + * // create a Recognizer
    + * String cdir = Recognizer.getConfigDir(null);
    + * Recognizer recognizer = new Recognizer(cdir + "/baseline11k.par");
    + * // create and load a Grammar
    + * Recognizer.Grammar grammar = recognizer.new Grammar(cdir + "/grammars/VoiceDialer.g2g");
    + * // setup the Grammar to work with the Recognizer
    + * grammar.setupRecognizer();
    + * // fill the Grammar slots with names and save, if required
    + * grammar.resetAllSlots();
    + * for (String name : names) grammar.addWordToSlot("@Names", name, null, 1, "V=1");
    + * grammar.compile();
    + * grammar.save(".../foo.g2g");
    + * // start the Recognizer
    + * recognizer.start();
    + * // loop over Recognizer events
    + * while (true) {
    + *     switch (recognizer.advance()) {
    + *     case Recognizer.EVENT_INCOMPLETE:
    + *     case Recognizer.EVENT_STARTED:
    + *     case Recognizer.EVENT_START_OF_VOICING:
    + *     case Recognizer.EVENT_END_OF_VOICING:
    + *         // let the Recognizer continue to run
    + *         continue;
    + *     case Recognizer.EVENT_RECOGNITION_RESULT:
    + *         // success, so fetch results here!
    + *         for (int i = 0; i < recognizer.getResultCount(); i++) {
    + *             String result = recognizer.getResult(i, Recognizer.KEY_LITERAL);
    + *         }
    + *         break;
    + *     case Recognizer.EVENT_NEED_MORE_AUDIO:
    + *         // put more audio in the Recognizer
    + *         recognizer.putAudio(audio);
    + *         continue;
    + *     default:
    + *         notifyFailure();
    + *         break;
    + *     }
    + *     break;
    + * }
    + * // stop the Recognizer
    + * recognizer.stop();
    + * // destroy the Recognizer
    + * recognizer.destroy();
    + * // stop the audio device
    + * audio.close();
    + * 
    + * 
    + */ +public final class Recognizer { + static { + System.loadLibrary("srec_jni"); + } + + private static String TAG = "Recognizer"; + + /** + * Result key corresponding to confidence score. + */ + public static final String KEY_CONFIDENCE = "conf"; + + /** + * Result key corresponding to literal text. + */ + public static final String KEY_LITERAL = "literal"; + + /** + * Result key corresponding to semantic meaning text. + */ + public static final String KEY_MEANING = "meaning"; + + // handle to SR_Vocabulary object + private int mVocabulary = 0; + + // handle to SR_Recognizer object + private int mRecognizer = 0; + + // Grammar currently associated with Recognizer via SR_GrammarSetupRecognizer + private Grammar mActiveGrammar = null; + + /** + * Get the pathname of the SREC configuration directory corresponding to the + * language indicated by the Locale. + * This directory contains dictionaries, speech models, + * configuration files, and other data needed by the Recognizer. + * @param locale Locale corresponding to the desired language, + * or null for default, currently Locale.US. + * @return Pathname of the configuration directory. + */ + public static String getConfigDir(Locale locale) { + if (locale == null) locale = Locale.US; + String dir = "/system/usr/srec/config/" + + locale.toString().replace('_', '.').toLowerCase(); + if ((new File(dir)).isDirectory()) return dir; + return null; + } + + /** + * Create an instance of a SREC speech recognizer. + * + * @param configFile pathname of the baseline*.par configuration file, + * which in turn contains references to dictionaries, speech models, + * and other data needed to configure and operate the recognizer. + * A separate config file is needed for each audio sample rate. + * Two files, baseline11k.par and baseline8k.par, which correspond to + * 11025 and 8000 hz, are present in the directory indicated by + * {@link #getConfigDir}. + * @throws IOException + */ + public Recognizer(String configFile) throws IOException { + PMemInit(); + SR_SessionCreate(configFile); + mRecognizer = SR_RecognizerCreate(); + SR_RecognizerSetup(mRecognizer); + mVocabulary = SR_VocabularyLoad(); + } + + /** + * Represents a grammar loaded into the Recognizer. + */ + public class Grammar { + private int mGrammar = 0; + + /** + * Create a Grammar instance. + * @param g2gFileName pathname of g2g file. + */ + public Grammar(String g2gFileName) throws IOException { + mGrammar = SR_GrammarLoad(g2gFileName); + SR_GrammarSetupVocabulary(mGrammar, mVocabulary); + } + + /** + * Reset all slots. + */ + public void resetAllSlots() { + SR_GrammarResetAllSlots(mGrammar); + } + + /** + * Add a word to a slot. + * + * @param slot slot name. + * @param word word to insert. + * @param pron pronunciation, or null to derive from word. + * @param weight weight to give the word. One is normal, 50 is low. + * @param tag semantic meaning tag string. + */ + public void addWordToSlot(String slot, String word, String pron, int weight, String tag) { + SR_GrammarAddWordToSlot(mGrammar, slot, word, pron, weight, tag); + } + + /** + * Compile all slots. + */ + public void compile() { + SR_GrammarCompile(mGrammar); + } + + /** + * Setup Grammar with Recognizer. + */ + public void setupRecognizer() { + SR_GrammarSetupRecognizer(mGrammar, mRecognizer); + mActiveGrammar = this; + } + + /** + * Save Grammar to g2g file. + * + * @param g2gFileName + * @throws IOException + */ + public void save(String g2gFileName) throws IOException { + SR_GrammarSave(mGrammar, g2gFileName); + } + + /** + * Release resources associated with this Grammar. + */ + public void destroy() { + // TODO: need to do cleanup and disassociation with Recognizer + if (mGrammar != 0) { + SR_GrammarDestroy(mGrammar); + mGrammar = 0; + } + } + + /** + * Clean up resources. + */ + protected void finalize() { + if (mGrammar != 0) { + destroy(); + throw new IllegalStateException("someone forgot to destroy Grammar"); + } + } + } + + /** + * Start recognition + */ + public void start() { + // TODO: shouldn't be here? + SR_RecognizerActivateRule(mRecognizer, mActiveGrammar.mGrammar, "trash", 1); + SR_RecognizerStart(mRecognizer); + } + + /** + * Process some audio and return the current status. + * @return recognition event, one of: + *
      + *
    • EVENT_INVALID + *
    • EVENT_NO_MATCH + *
    • EVENT_INCOMPLETE + *
    • EVENT_STARTED + *
    • EVENT_STOPPED + *
    • EVENT_START_OF_VOICING + *
    • EVENT_END_OF_VOICING + *
    • EVENT_SPOKE_TOO_SOON + *
    • EVENT_RECOGNITION_RESULT + *
    • EVENT_START_OF_UTTERANCE_TIMEOUT + *
    • EVENT_RECOGNITION_TIMEOUT + *
    • EVENT_NEED_MORE_AUDIO + *
    • EVENT_MAX_SPEECH + *
    + */ + public int advance() { + return SR_RecognizerAdvance(mRecognizer); + } + + /** + * Put audio samples into the Recognizer. + * @param buf holds the audio samples. + * @param offset offset of the first sample. + * @param length number of bytes containing samples. + * @param isLast indicates no more audio data, normally false. + * @return number of bytes accepted. + */ + public int putAudio(byte[] buf, int offset, int length, boolean isLast) { + return SR_RecognizerPutAudio(mRecognizer, buf, offset, length, isLast); + } + + /** + * Read audio samples from an InputStream and put them in the + * Recognizer. + * @param audio InputStream containing PCM audio samples. + */ + public void putAudio(InputStream audio) throws IOException { + // make sure the audio buffer is allocated + if (mPutAudioBuffer == null) mPutAudioBuffer = new byte[512]; + // read some data + int nbytes = audio.read(mPutAudioBuffer); + // eof, so signal Recognizer + if (nbytes == -1) { + SR_RecognizerPutAudio(mRecognizer, mPutAudioBuffer, 0, 0, true); + } + // put it into the Recognizer + else if (nbytes != SR_RecognizerPutAudio(mRecognizer, mPutAudioBuffer, 0, nbytes, false)) { + throw new IOException("SR_RecognizerPutAudio failed nbytes=" + nbytes); + } + } + + // audio buffer for putAudio(InputStream) + private byte[] mPutAudioBuffer = null; + + /** + * Get the number of recognition results. Must be called after + * EVENT_RECOGNITION_RESULT is returned by + * advance, but before stop. + * + * @return number of results in nbest list. + */ + public int getResultCount() { + return SR_RecognizerResultGetSize(mRecognizer); + } + + /** + * Get a set of keys for the result. Must be called after + * EVENT_RECOGNITION_RESULT is returned by + * advance, but before stop. + * + * @param index index of result. + * @return array of keys. + */ + public String[] getResultKeys(int index) { + return SR_RecognizerResultGetKeyList(mRecognizer, index); + } + + /** + * Get a result value. Must be called after + * EVENT_RECOGNITION_RESULT is returned by + * advance, but before stop. + * + * @param index index of the result. + * @param key key of the result. This is typically one of + * KEY_CONFIDENCE, KEY_LITERAL, or + * KEY_MEANING, but the user can also define their own keys + * in a grxml file, or in the tag slot of + * Grammar.addWordToSlot. + * @return the result. + */ + public String getResult(int index, String key) { + return SR_RecognizerResultGetValue(mRecognizer, index, key); + } + + /** + * Stop the Recognizer. + */ + public void stop() { + SR_RecognizerStop(mRecognizer); + SR_RecognizerDeactivateRule(mRecognizer, mActiveGrammar.mGrammar, "trash"); + } + + /** + * Clean up resources. + */ + public void destroy() { + try { + if (mVocabulary != 0) SR_VocabularyDestroy(mVocabulary); + } finally { + mVocabulary = 0; + try { + if (mRecognizer != 0) SR_RecognizerUnsetup(mRecognizer); + } finally { + try { + if (mRecognizer != 0) SR_RecognizerDestroy(mRecognizer); + } finally { + mRecognizer = 0; + try { + SR_SessionDestroy(); + } finally { + PMemShutdown(); + } + } + } + } + } + + /** + * Clean up resources. + */ + protected void finalize() throws Throwable { + if (mVocabulary != 0 || mRecognizer != 0) { + destroy(); + throw new IllegalStateException("someone forgot to destroy Recognizer"); + } + } + + /* an example session captured, for reference + void doall() { + if (PMemInit ( ) + || lhs_audioinOpen ( WAVE_MAPPER, SREC_TEST_DEFAULT_AUDIO_FREQUENCY, &audio_in_handle ) + || srec_test_init_application_data ( &applicationData, argc, argv ) + || SR_SessionCreate ( "/system/usr/srec/config/en.us/baseline11k.par" ) + || SR_RecognizerCreate ( &applicationData.recognizer ) + || SR_RecognizerSetup ( applicationData.recognizer) + || ESR_SessionGetLCHAR ( L("cmdline.vocabulary"), filename, &flen ) + || SR_VocabularyLoad ( filename, &applicationData.vocabulary ) + || SR_VocabularyGetLanguage ( applicationData.vocabulary, &applicationData.locale ) + || (applicationData.nametag = NULL) + || SR_NametagsCreate ( &applicationData.nametags ) + || (LSTRCPY ( applicationData.grammars [0].grammar_path, "/system/usr/srec/config/en.us/grammars/VoiceDialer.g2g" ), 0) + || (LSTRCPY ( applicationData.grammars [0].grammarID, "BothTags" ), 0) + || (LSTRCPY ( applicationData.grammars [0].ruleName, "trash" ), 0) + || (applicationData.grammars [0].is_ve_grammar = ESR_FALSE, 0) + || SR_GrammarLoad (applicationData.grammars [0].grammar_path, &applicationData.grammars [applicationData.grammarCount].grammar ) + || SR_GrammarSetupVocabulary ( applicationData.grammars [0].grammar, applicationData.vocabulary ) + || SR_GrammarSetupRecognizer( applicationData.grammars [0].grammar, applicationData.recognizer ) + || SR_GrammarSetDispatchFunction ( applicationData.grammars [0].grammar, L("myDSMCallback"), NULL, myDSMCallback ) + || (applicationData.grammarCount++, 0) + || SR_RecognizerActivateRule ( applicationData.recognizer, applicationData.grammars [0].grammar, + applicationData.grammars [0].ruleName, 1 ) + || (applicationData.active_grammar_num = 0, 0) + || lhs_audioinStart ( audio_in_handle ) + || SR_RecognizerStart ( applicationData.recognizer ) + || strl ( applicationData.grammars [0].grammar, &applicationData, audio_in_handle, &recognition_count ) + || SR_RecognizerStop ( applicationData.recognizer ) + || lhs_audioinStop ( audio_in_handle ) + || SR_RecognizerDeactivateRule ( applicationData.recognizer, applicationData.grammars [0].grammar, applicationData.grammars [0].ruleName ) + || (applicationData.active_grammar_num = -1, 0) + || SR_GrammarDestroy ( applicationData.grammars [0].grammar ) + || (applicationData.grammarCount--, 0) + || SR_NametagsDestroy ( applicationData.nametags ) + || (applicationData.nametags = NULL, 0) + || SR_VocabularyDestroy ( applicationData.vocabulary ) + || (applicationData.vocabulary = NULL) + || SR_RecognizerUnsetup ( applicationData.recognizer) // releases acoustic models + || SR_RecognizerDestroy ( applicationData.recognizer ) + || (applicationData.recognizer = NULL) + || SR_SessionDestroy ( ) + || srec_test_shutdown_application_data ( &applicationData ) + || lhs_audioinClose ( &audio_in_handle ) + || PMemShutdown ( ) + } + */ + + + // + // PMem native methods + // + private static native void PMemInit(); + private static native void PMemShutdown(); + + + // + // SR_Session native methods + // + private static native void SR_SessionCreate(String filename); + private static native void SR_SessionDestroy(); + + + // + // SR_Recognizer native methods + // + + /** + * Reserved value. + */ + public final static int EVENT_INVALID = 0; + + /** + * Recognizer could not find a match for the utterance. + */ + public final static int EVENT_NO_MATCH = 1; + + /** + * Recognizer processed one frame of audio. + */ + public final static int EVENT_INCOMPLETE = 2; + + /** + * Recognizer has just been started. + */ + public final static int EVENT_STARTED = 3; + + /** + * Recognizer is stopped. + */ + public final static int EVENT_STOPPED = 4; + + /** + * Beginning of speech detected. + */ + public final static int EVENT_START_OF_VOICING = 5; + + /** + * End of speech detected. + */ + public final static int EVENT_END_OF_VOICING = 6; + + /** + * Beginning of utterance occured too soon. + */ + public final static int EVENT_SPOKE_TOO_SOON = 7; + + /** + * Recognition match detected. + */ + public final static int EVENT_RECOGNITION_RESULT = 8; + + /** + * Timeout occured before beginning of utterance. + */ + public final static int EVENT_START_OF_UTTERANCE_TIMEOUT = 9; + + /** + * Timeout occured before speech recognition could complete. + */ + public final static int EVENT_RECOGNITION_TIMEOUT = 10; + + /** + * Not enough samples to process one frame. + */ + public final static int EVENT_NEED_MORE_AUDIO = 11; + + /** + * More audio encountered than is allowed by 'swirec_max_speech_duration'. + */ + public final static int EVENT_MAX_SPEECH = 12; + + /** + * Produce a displayable string from an advance event. + * @param event + * @return String representing the event. + */ + public static String eventToString(int event) { + switch (event) { + case EVENT_INVALID: + return "EVENT_INVALID"; + case EVENT_NO_MATCH: + return "EVENT_NO_MATCH"; + case EVENT_INCOMPLETE: + return "EVENT_INCOMPLETE"; + case EVENT_STARTED: + return "EVENT_STARTED"; + case EVENT_STOPPED: + return "EVENT_STOPPED"; + case EVENT_START_OF_VOICING: + return "EVENT_START_OF_VOICING"; + case EVENT_END_OF_VOICING: + return "EVENT_END_OF_VOICING"; + case EVENT_SPOKE_TOO_SOON: + return "EVENT_SPOKE_TOO_SOON"; + case EVENT_RECOGNITION_RESULT: + return "EVENT_RECOGNITION_RESULT"; + case EVENT_START_OF_UTTERANCE_TIMEOUT: + return "EVENT_START_OF_UTTERANCE_TIMEOUT"; + case EVENT_RECOGNITION_TIMEOUT: + return "EVENT_RECOGNITION_TIMEOUT"; + case EVENT_NEED_MORE_AUDIO: + return "EVENT_NEED_MORE_AUDIO"; + case EVENT_MAX_SPEECH: + return "EVENT_MAX_SPEECH"; + } + return "EVENT_" + event; + } + + private static native void SR_RecognizerStart(int recognizer); + private static native void SR_RecognizerStop(int recognizer); + private static native int SR_RecognizerCreate(); + private static native void SR_RecognizerDestroy(int recognizer); + private static native void SR_RecognizerSetup(int recognizer); + private static native void SR_RecognizerUnsetup(int recognizer); + private static native boolean SR_RecognizerIsSetup(int recognizer); + private static native String SR_RecognizerGetParameter(int recognizer, String key); + private static native int SR_RecognizerGetSize_tParameter(int recognizer, String key); + private static native boolean SR_RecognizerGetBoolParameter(int recognizer, String key); + private static native void SR_RecognizerSetParameter(int recognizer, String key, String value); + private static native void SR_RecognizerSetSize_tParameter(int recognizer, + String key, int value); + private static native void SR_RecognizerSetBoolParameter(int recognizer, String key, + boolean value); + private static native void SR_RecognizerSetupRule(int recognizer, int grammar, + String ruleName); + private static native boolean SR_RecognizerHasSetupRules(int recognizer); + private static native void SR_RecognizerActivateRule(int recognizer, int grammar, + String ruleName, int weight); + private static native void SR_RecognizerDeactivateRule(int recognizer, int grammar, + String ruleName); + private static native void SR_RecognizerDeactivateAllRules(int recognizer); + private static native boolean SR_RecognizerIsActiveRule(int recognizer, int grammar, + String ruleName); + private static native boolean SR_RecognizerCheckGrammarConsistency(int recognizer, + int grammar); + private static native int SR_RecognizerPutAudio(int recognizer, byte[] buffer, int offset, + int length, boolean isLast); + private static native int SR_RecognizerAdvance(int recognizer); + // private static native void SR_RecognizerLoadUtterance(int recognizer, + // const LCHAR* filename); + // private static native void SR_RecognizerLoadWaveFile(int recognizer, + // const LCHAR* filename); + // private static native void SR_RecognizerSetLockFunction(int recognizer, + // SR_RecognizerLockFunction function, void* data); + private static native boolean SR_RecognizerIsSignalClipping(int recognizer); + private static native boolean SR_RecognizerIsSignalDCOffset(int recognizer); + private static native boolean SR_RecognizerIsSignalNoisy(int recognizer); + private static native boolean SR_RecognizerIsSignalTooQuiet(int recognizer); + private static native boolean SR_RecognizerIsSignalTooFewSamples(int recognizer); + private static native boolean SR_RecognizerIsSignalTooManySamples(int recognizer); + // private static native void SR_Recognizer_Change_Sample_Rate (size_t new_sample_rate); + + + // + // SR_Grammar native methods + // + private static native void SR_GrammarCompile(int grammar); + private static native void SR_GrammarAddWordToSlot(int grammar, String slot, + String word, String pronunciation, int weight, String tag); + private static native void SR_GrammarResetAllSlots(int grammar); + // private static native void SR_GrammarAddNametagToSlot(int grammar, String slot, + // const struct SR_Nametag_t* nametag, int weight, String tag); + private static native void SR_GrammarSetupVocabulary(int grammar, int vocabulary); + // private static native void SR_GrammarSetupModels(int grammar, SR_AcousticModels* models); + private static native void SR_GrammarSetupRecognizer(int grammar, int recognizer); + private static native void SR_GrammarUnsetupRecognizer(int grammar); + // private static native void SR_GrammarGetModels(int grammar,SR_AcousticModels** models); + private static native int SR_GrammarCreate(); + private static native void SR_GrammarDestroy(int grammar); + private static native int SR_GrammarLoad(String filename); + private static native void SR_GrammarSave(int grammar, String filename); + // private static native void SR_GrammarSetDispatchFunction(int grammar, + // const LCHAR* name, void* userData, SR_GrammarDispatchFunction function); + // private static native void SR_GrammarSetParameter(int grammar, const + // LCHAR* key, void* value); + // private static native void SR_GrammarSetSize_tParameter(int grammar, + // const LCHAR* key, size_t value); + // private static native void SR_GrammarGetParameter(int grammar, const + // LCHAR* key, void** value); + // private static native void SR_GrammarGetSize_tParameter(int grammar, + // const LCHAR* key, size_t* value); + // private static native void SR_GrammarCheckParse(int grammar, const LCHAR* + // transcription, SR_SemanticResult** result, size_t* resultCount); + private static native void SR_GrammarAllowOnly(int grammar, String transcription); + private static native void SR_GrammarAllowAll(int grammar); + + + // + // SR_Vocabulary native methods + // + // private static native int SR_VocabularyCreate(); + private static native int SR_VocabularyLoad(); + // private static native void SR_VocabularySave(SR_Vocabulary* self, + // const LCHAR* filename); + // private static native void SR_VocabularyAddWord(SR_Vocabulary* self, + // const LCHAR* word); + // private static native void SR_VocabularyGetLanguage(SR_Vocabulary* self, + // ESR_Locale* locale); + private static native void SR_VocabularyDestroy(int vocabulary); + private static native String SR_VocabularyGetPronunciation(int vocabulary, String word); + + + // + // SR_RecognizerResult native methods + // + private static native byte[] SR_RecognizerResultGetWaveform(int recognizer); + private static native int SR_RecognizerResultGetSize(int recognizer); + private static native int SR_RecognizerResultGetKeyCount(int recognizer, int nbest); + private static native String[] SR_RecognizerResultGetKeyList(int recognizer, int nbest); + private static native String SR_RecognizerResultGetValue(int recognizer, + int nbest, String key); + // private static native void SR_RecognizerResultGetLocale(int recognizer, ESR_Locale* locale); +} diff --git a/core/java/android/speech/srec/Srec.java b/core/java/android/speech/srec/Srec.java deleted file mode 100644 index a629214bf5791..0000000000000 --- a/core/java/android/speech/srec/Srec.java +++ /dev/null @@ -1,162 +0,0 @@ -/*---------------------------------------------------------------------------* - * EmbeddedRecognizerImpl.java * - * * - * Copyright 2007 Nuance Communciations, Inc. * - * * - * Licensed under the Apache License, Version 2.0 (the 'License'); * - * you may not use this file except in compliance with the License. * - * * - * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 * - * * - * Unless required by applicable law or agreed to in writing, software * - * distributed under the License is distributed on an 'AS IS' BASIS, * - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * - * See the License for the specific language governing permissions and * - * limitations under the License. * - * * - *---------------------------------------------------------------------------*/ - -package android.speech.srec; - -import java.io.IOException; - -/** - * Simple, synchronous speech recognizer, using the SREC package. - * - * @hide - */ -public class Srec -{ - private int mNative; - - - /** - * Create an instance of a SREC speech recognizer. - * @param configFile pathname of the baseline*.par configuration file. - * @throws IOException - */ - Srec(String configFile) throws IOException { - - } - - /** - * Creates a Srec recognizer. - * @param g2gFileName pathname of a g2g grammar file. - * @return - * @throws IOException - */ - public Grammar loadGrammar(String g2gFileName) throws IOException { - return null; - } - - /** - * Represents a grammar loaded into the recognizer. - */ - public class Grammar { - private int mId = -1; - - /** - * Add a word to a slot - * @param slot slot name - * @param word word - * @param pron pronunciation, or null to derive from word - * @param weight weight to give the word - * @param meaning meaning string - */ - public void addToSlot(String slot, String word, String pron, int weight, String meaning) { - - } - - /** - * Compile all slots. - */ - public void compileSlots() { - - } - - /** - * Reset all slots. - */ - public void resetAllSlots() { - - } - - /** - * Save grammar to g2g file. - * @param g2gFileName - * @throws IOException - */ - public void save(String g2gFileName) throws IOException { - - } - - /** - * Release resources associated with this grammar. - */ - public void unload() { - - } - } - - /** - * Start recognition - */ - public void start() { - - } - - /** - * Process some audio and return the next state. - * @return true if complete - */ - public boolean process() { - return false; - } - - /** - * Get the number of recognition results. - * @return - */ - public int getResultCount() { - return 0; - } - - /** - * Get a set of keys for the result. - * @param index index of result. - * @return array of keys. - */ - public String[] getResultKeys(int index) { - return null; - } - - /** - * Get a result value - * @param index index of the result. - * @param key key of the result. - * @return the result. - */ - public String getResult(int index, String key) { - return null; - } - - /** - * Reset the recognizer to the idle state. - */ - public void reset() { - - } - - /** - * Clean up resources. - */ - public void dispose() { - - } - - protected void finalize() { - - } - -} diff --git a/core/java/android/speech/srec/UlawEncoderInputStream.java b/core/java/android/speech/srec/UlawEncoderInputStream.java new file mode 100644 index 0000000000000..132fe0273eb82 --- /dev/null +++ b/core/java/android/speech/srec/UlawEncoderInputStream.java @@ -0,0 +1,186 @@ +/* + * --------------------------------------------------------------------------- + * UlawEncoderInputStream.java + * + * Copyright 2008 Nuance Communciations, Inc. + * + * Licensed under the Apache License, Version 2.0 (the 'License'); you may not + * use this file except in compliance with the License. + * + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + * + * --------------------------------------------------------------------------- + */ + +package android.speech.srec; + +import java.io.IOException; +import java.io.InputStream; + +/** + * InputStream which transforms 16 bit pcm data to ulaw data. + * + * @hide pending API council approval + */ +public final class UlawEncoderInputStream extends InputStream { + private final static String TAG = "UlawEncoderInputStream"; + + private final static int MAX_ULAW = 8192; + private final static int SCALE_BITS = 16; + + private InputStream mIn; + + private int mMax = 0; + + private final byte[] mBuf = new byte[1024]; + private int mBufCount = 0; // should be 0 or 1 + + private final byte[] mOneByte = new byte[1]; + + + public static void encode(byte[] pcmBuf, int pcmOffset, + byte[] ulawBuf, int ulawOffset, int length, int max) { + + // from 'ulaw' in wikipedia + // +8191 to +8159 0x80 + // +8158 to +4063 in 16 intervals of 256 0x80 + interval number + // +4062 to +2015 in 16 intervals of 128 0x90 + interval number + // +2014 to +991 in 16 intervals of 64 0xA0 + interval number + // +990 to +479 in 16 intervals of 32 0xB0 + interval number + // +478 to +223 in 16 intervals of 16 0xC0 + interval number + // +222 to +95 in 16 intervals of 8 0xD0 + interval number + // +94 to +31 in 16 intervals of 4 0xE0 + interval number + // +30 to +1 in 15 intervals of 2 0xF0 + interval number + // 0 0xFF + + // -1 0x7F + // -31 to -2 in 15 intervals of 2 0x70 + interval number + // -95 to -32 in 16 intervals of 4 0x60 + interval number + // -223 to -96 in 16 intervals of 8 0x50 + interval number + // -479 to -224 in 16 intervals of 16 0x40 + interval number + // -991 to -480 in 16 intervals of 32 0x30 + interval number + // -2015 to -992 in 16 intervals of 64 0x20 + interval number + // -4063 to -2016 in 16 intervals of 128 0x10 + interval number + // -8159 to -4064 in 16 intervals of 256 0x00 + interval number + // -8192 to -8160 0x00 + + // set scale factors + if (max <= 0) max = MAX_ULAW; + + int coef = MAX_ULAW * (1 << SCALE_BITS) / max; + + for (int i = 0; i < length; i++) { + int pcm = (0xff & pcmBuf[pcmOffset++]) + (pcmBuf[pcmOffset++] << 8); + pcm = (pcm * coef) >> SCALE_BITS; + + int ulaw; + if (pcm >= 0) { + ulaw = pcm <= 0 ? 0xff : + pcm <= 30 ? 0xf0 + (( 30 - pcm) >> 1) : + pcm <= 94 ? 0xe0 + (( 94 - pcm) >> 2) : + pcm <= 222 ? 0xd0 + (( 222 - pcm) >> 3) : + pcm <= 478 ? 0xc0 + (( 478 - pcm) >> 4) : + pcm <= 990 ? 0xb0 + (( 990 - pcm) >> 5) : + pcm <= 2014 ? 0xa0 + ((2014 - pcm) >> 6) : + pcm <= 4062 ? 0x90 + ((4062 - pcm) >> 7) : + pcm <= 8158 ? 0x80 + ((8158 - pcm) >> 8) : + 0x80; + } else { + ulaw = -1 <= pcm ? 0x7f : + -31 <= pcm ? 0x70 + ((pcm - -31) >> 1) : + -95 <= pcm ? 0x60 + ((pcm - -95) >> 2) : + -223 <= pcm ? 0x50 + ((pcm - -223) >> 3) : + -479 <= pcm ? 0x40 + ((pcm - -479) >> 4) : + -991 <= pcm ? 0x30 + ((pcm - -991) >> 5) : + -2015 <= pcm ? 0x20 + ((pcm - -2015) >> 6) : + -4063 <= pcm ? 0x10 + ((pcm - -4063) >> 7) : + -8159 <= pcm ? 0x00 + ((pcm - -8159) >> 8) : + 0x00; + } + ulawBuf[ulawOffset++] = (byte)ulaw; + } + } + + /** + * Compute the maximum of the absolute value of the pcm samples. + * The return value can be used to set ulaw encoder scaling. + * @param pcmBuf array containing 16 bit pcm data. + * @param offset offset of start of 16 bit pcm data. + * @param length number of pcm samples (not number of input bytes) + * @return maximum abs of pcm data values + */ + public static int maxAbsPcm(byte[] pcmBuf, int offset, int length) { + int max = 0; + for (int i = 0; i < length; i++) { + int pcm = (0xff & pcmBuf[offset++]) + (pcmBuf[offset++] << 8); + if (pcm < 0) pcm = -pcm; + if (pcm > max) max = pcm; + } + return max; + } + + /** + * Create an InputStream which takes 16 bit pcm data and produces ulaw data. + * @param in InputStream containing 16 bit pcm data. + * @param max pcm value corresponding to maximum ulaw value. + */ + public UlawEncoderInputStream(InputStream in, int max) { + mIn = in; + mMax = max; + } + + @Override + public int read(byte[] buf, int offset, int length) throws IOException { + if (mIn == null) throw new IllegalStateException("not open"); + + // return at least one byte, but try to fill 'length' + while (mBufCount < 2) { + int n = mIn.read(mBuf, mBufCount, Math.min(length * 2, mBuf.length - mBufCount)); + if (n == -1) return -1; + mBufCount += n; + } + + // compand data + int n = Math.min(mBufCount / 2, length); + encode(mBuf, 0, buf, offset, n, mMax); + + // move data to bottom of mBuf + mBufCount -= n * 2; + for (int i = 0; i < mBufCount; i++) mBuf[i] = mBuf[i + n * 2]; + + return n; + } + + @Override + public int read(byte[] buf) throws IOException { + return read(buf, 0, buf.length); + } + + @Override + public int read() throws IOException { + int n = read(mOneByte, 0, 1); + if (n == -1) return -1; + return 0xff & (int)mOneByte[0]; + } + + @Override + public void close() throws IOException { + if (mIn != null) { + InputStream in = mIn; + mIn = null; + in.close(); + } + } + + @Override + public int available() throws IOException { + return (mIn.available() + mBufCount) / 2; + } +} diff --git a/core/java/android/speech/srec/package.html b/core/java/android/speech/srec/package.html new file mode 100644 index 0000000000000..723b30bb6e9e6 --- /dev/null +++ b/core/java/android/speech/srec/package.html @@ -0,0 +1,5 @@ + + +Simple, synchronous SREC speech recognition API. + + diff --git a/core/java/android/test/InstrumentationTestCase.java b/core/java/android/test/InstrumentationTestCase.java index 08a8ad1346777..82f2ef9dd8ebb 100644 --- a/core/java/android/test/InstrumentationTestCase.java +++ b/core/java/android/test/InstrumentationTestCase.java @@ -31,8 +31,7 @@ import java.lang.reflect.Modifier; import java.lang.reflect.InvocationTargetException; /** - * A test case that has access to {@link Instrumentation}. See - * InstrumentationTestRunner. + * A test case that has access to {@link Instrumentation}. */ public class InstrumentationTestCase extends TestCase { @@ -57,7 +56,13 @@ public class InstrumentationTestCase extends TestCase { } /** - * Utility method for launching an activity. + * Utility method for launching an activity. + * + *

    The {@link Intent} used to launch the Activity is: + * action = {@link Intent#ACTION_MAIN} + * extras = null, unless a custom bundle is provided here + * All other fields are null or empty. + * * @param pkg The package hosting the activity to be launched. * @param activityCls The activity class to launch. * @param extras Optional extra stuff to pass to the activity. @@ -69,20 +74,61 @@ public class InstrumentationTestCase extends TestCase { Class activityCls, Bundle extras) { Intent intent = new Intent(Intent.ACTION_MAIN); - intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); - intent.setClassName(pkg, activityCls.getName()); if (extras != null) { intent.putExtras(extras); } + return launchActivityWithIntent(pkg, activityCls, intent); + } + + /** + * Utility method for launching an activity with a specific Intent. + * @param pkg The package hosting the activity to be launched. + * @param activityCls The activity class to launch. + * @param intent The intent to launch with + * @return The activity, or null if non launched. + */ + @SuppressWarnings("unchecked") + public final T launchActivityWithIntent( + String pkg, + Class activityCls, + Intent intent) { + intent.setClassName(pkg, activityCls.getName()); + intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); T activity = (T) getInstrumentation().startActivitySync(intent); getInstrumentation().waitForIdleSync(); return activity; } + + /** + * Helper for running portions of a test on the UI thread. + * + * Note, in most cases it is simpler to annotate the test method with + * {@link android.test.UiThreadTest}, which will run the entire test method on the UI thread. + * Use this method if you need to switch in and out of the UI thread to perform your test. + * + * @param r runnable containing test code in the {@link Runnable#run()} method + */ + public void runTestOnUiThread(final Runnable r) throws Throwable { + final Throwable[] exceptions = new Throwable[1]; + getInstrumentation().runOnMainSync(new Runnable() { + public void run() { + try { + r.run(); + } catch (Throwable throwable) { + exceptions[0] = throwable; + } + } + }); + if (exceptions[0] != null) { + throw exceptions[0]; + } + } /** * Runs the current unit test. If the unit test is annotated with * {@link android.test.UiThreadTest}, the test is run on the UI thread. */ + @Override protected void runTest() throws Throwable { String fName = getName(); assertNotNull(fName); diff --git a/core/java/android/test/suitebuilder/annotation/LargeTest.java b/core/java/android/test/suitebuilder/annotation/LargeTest.java new file mode 100644 index 0000000000000..a6269e7875565 --- /dev/null +++ b/core/java/android/test/suitebuilder/annotation/LargeTest.java @@ -0,0 +1,30 @@ +/* + * Copyright (C) 2008 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.test.suitebuilder.annotation; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * Marks a test that should run as part of the large tests. + */ +@Retention(RetentionPolicy.RUNTIME) +@Target({ElementType.METHOD, ElementType.TYPE}) +public @interface LargeTest { +} diff --git a/core/java/android/test/suitebuilder/annotation/MediumTest.java b/core/java/android/test/suitebuilder/annotation/MediumTest.java new file mode 100644 index 0000000000000..8afeb911d065c --- /dev/null +++ b/core/java/android/test/suitebuilder/annotation/MediumTest.java @@ -0,0 +1,31 @@ +/* + * Copyright (C) 2008 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.test.suitebuilder.annotation; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * Marks a test that should run as part of the medium tests. + * + */ +@Retention(RetentionPolicy.RUNTIME) +@Target({ElementType.METHOD, ElementType.TYPE}) +public @interface MediumTest { +} diff --git a/core/java/android/test/suitebuilder/annotation/SmallTest.java b/core/java/android/test/suitebuilder/annotation/SmallTest.java new file mode 100644 index 0000000000000..ad530e287343d --- /dev/null +++ b/core/java/android/test/suitebuilder/annotation/SmallTest.java @@ -0,0 +1,30 @@ +/* + * Copyright (C) 2008 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.test.suitebuilder.annotation; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * Marks a test that should run as part of the small tests. + */ +@Retention(RetentionPolicy.RUNTIME) +@Target({ElementType.METHOD, ElementType.TYPE}) +public @interface SmallTest { +} diff --git a/core/java/android/text/BoringLayout.java b/core/java/android/text/BoringLayout.java index 2ee4f62262a31..843754b7713c0 100644 --- a/core/java/android/text/BoringLayout.java +++ b/core/java/android/text/BoringLayout.java @@ -92,7 +92,7 @@ public class BoringLayout extends Layout implements TextUtils.EllipsizeCallback int ellipsizedWidth) { boolean trust; - if (ellipsize == null) { + if (ellipsize == null || ellipsize == TextUtils.TruncateAt.MARQUEE) { replaceWith(source, paint, outerwidth, align, spacingmult, spacingadd); @@ -145,7 +145,7 @@ public class BoringLayout extends Layout implements TextUtils.EllipsizeCallback boolean trust; - if (ellipsize == null) { + if (ellipsize == null || ellipsize == TextUtils.TruncateAt.MARQUEE) { mEllipsizedWidth = outerwidth; mEllipsizedStart = 0; mEllipsizedCount = 0; diff --git a/core/java/android/text/InputFilter.java b/core/java/android/text/InputFilter.java index e1563ae9fd9ac..2f55677ee24fa 100644 --- a/core/java/android/text/InputFilter.java +++ b/core/java/android/text/InputFilter.java @@ -33,6 +33,11 @@ public interface InputFilter * as this is what happens when you delete text. Also beware that * you should not attempt to make any changes to dest * from this method; you may only examine it for context. + * + * Note: If source is an instance of {@link Spanned} or + * {@link Spannable}, the span objects in the source should be + * copied into the filtered result (i.e. the non-null return value). + * {@link TextUtils#copySpansFrom} can be used for convenience. */ public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart, int dend); diff --git a/core/java/android/text/InputType.java b/core/java/android/text/InputType.java new file mode 100644 index 0000000000000..0ffe4acaffbf6 --- /dev/null +++ b/core/java/android/text/InputType.java @@ -0,0 +1,227 @@ +package android.text; + +import android.text.TextUtils; + +/** + * Bit definitions for an integer defining the basic content type of text + * held in an {@link Editable} object. + */ +public interface InputType { + /** + * Mask of bits that determine the overall class + * of text being given. Currently supported classes are: + * {@link #TYPE_CLASS_TEXT}, {@link #TYPE_CLASS_NUMBER}, + * {@link #TYPE_CLASS_PHONE}, {@link #TYPE_CLASS_DATETIME}. + * If the class is not one you + * understand, assume {@link #TYPE_CLASS_TEXT} with NO variation + * or flags. + */ + public static final int TYPE_MASK_CLASS = 0x0000000f; + + /** + * Mask of bits that determine the variation of + * the base content class. + */ + public static final int TYPE_MASK_VARIATION = 0x00000ff0; + + /** + * Mask of bits that provide addition bit flags + * of options. + */ + public static final int TYPE_MASK_FLAGS = 0x00fff000; + + /** + * Special content type for when no explicit type has been specified. + * This should be interpreted to mean that the target input connection + * is not rich, it can not process and show things like candidate text nor + * retrieve the current text, so the input method will need to run in a + * limited "generate key events" mode. + */ + public static final int TYPE_NULL = 0x00000000; + + // ---------------------------------------------------------------------- + // ---------------------------------------------------------------------- + // ---------------------------------------------------------------------- + + /** + * Class for normal text. This class supports the following flags (only + * one of which should be set): + * {@link #TYPE_TEXT_FLAG_CAP_CHARACTERS}, + * {@link #TYPE_TEXT_FLAG_CAP_WORDS}, and. + * {@link #TYPE_TEXT_FLAG_CAP_SENTENCES}. It also supports the + * following variations: + * {@link #TYPE_TEXT_VARIATION_NORMAL}, and + * {@link #TYPE_TEXT_VARIATION_URI}. If you do not recognize the + * variation, normal should be assumed. + */ + public static final int TYPE_CLASS_TEXT = 0x00000001; + + /** + * Flag for {@link #TYPE_CLASS_TEXT}: capitalize all characters. Overrides + * {@link #TYPE_TEXT_FLAG_CAP_WORDS} and + * {@link #TYPE_TEXT_FLAG_CAP_SENTENCES}. This value is explicitly defined + * to be the same as {@link TextUtils#CAP_MODE_CHARACTERS}. + */ + public static final int TYPE_TEXT_FLAG_CAP_CHARACTERS = 0x00001000; + + /** + * Flag for {@link #TYPE_CLASS_TEXT}: capitalize first character of + * all words. Overrides {@link #TYPE_TEXT_FLAG_CAP_SENTENCES}. This + * value is explicitly defined + * to be the same as {@link TextUtils#CAP_MODE_WORDS}. + */ + public static final int TYPE_TEXT_FLAG_CAP_WORDS = 0x00002000; + + /** + * Flag for {@link #TYPE_CLASS_TEXT}: capitalize first character of + * each sentence. This value is explicitly defined + * to be the same as {@link TextUtils#CAP_MODE_SENTENCES}. + */ + public static final int TYPE_TEXT_FLAG_CAP_SENTENCES = 0x00004000; + + /** + * Flag for {@link #TYPE_CLASS_TEXT}: the user is entering free-form + * text that should have auto-correction applied to it. + */ + public static final int TYPE_TEXT_FLAG_AUTO_CORRECT = 0x00008000; + + /** + * Flag for {@link #TYPE_CLASS_TEXT}: the text editor is performing + * auto-completion of the text being entered based on its own semantics, + * which it will present to the user as they type. This generally means + * that the input method should not be showing candidates itself, but can + * expect for the editor to supply its own completions/candidates from + * {@link android.view.inputmethod.InputMethodSession#displayCompletions + * InputMethodSession.displayCompletions()} as a result of the editor calling + * {@link android.view.inputmethod.InputMethodManager#displayCompletions + * InputMethodManager.displayCompletions()}. + */ + public static final int TYPE_TEXT_FLAG_AUTO_COMPLETE = 0x00010000; + + /** + * Flag for {@link #TYPE_CLASS_TEXT}: multiple lines of text can be + * entered into the field. + */ + public static final int TYPE_TEXT_FLAG_MULTI_LINE = 0x00020000; + + // ---------------------------------------------------------------------- + + /** + * Default variation of {@link #TYPE_CLASS_TEXT}: plain old normal text. + */ + public static final int TYPE_TEXT_VARIATION_NORMAL = 0x00000000; + + /** + * Variation of {@link #TYPE_CLASS_TEXT}: entering a URI. + */ + public static final int TYPE_TEXT_VARIATION_URI = 0x00000010; + + /** + * Variation of {@link #TYPE_CLASS_TEXT}: entering an e-mail address. + */ + public static final int TYPE_TEXT_VARIATION_EMAIL_ADDRESS = 0x00000020; + + /** + * Variation of {@link #TYPE_CLASS_TEXT}: entering the subject line of + * an e-mail. + */ + public static final int TYPE_TEXT_VARIATION_EMAIL_SUBJECT = 0x00000030; + + /** + * Variation of {@link #TYPE_CLASS_TEXT}: entering the content of + * an e-mail. + */ + public static final int TYPE_TEXT_VARIATION_EMAIL_CONTENT = 0x00000040; + + /** + * Variation of {@link #TYPE_CLASS_TEXT}: entering the name of a person. + */ + public static final int TYPE_TEXT_VARIATION_PERSON_NAME = 0x00000050; + + /** + * Variation of {@link #TYPE_CLASS_TEXT}: entering a postal mailing + * address. + */ + public static final int TYPE_TEXT_VARIATION_POSTAL_ADDRESS = 0x00000060; + + /** + * Variation of {@link #TYPE_CLASS_TEXT}: entering a password. + */ + public static final int TYPE_TEXT_VARIATION_PASSWORD = 0x00000070; + + /** + * Variation of {@link #TYPE_CLASS_TEXT}: entering a search string + * for a web search. + */ + public static final int TYPE_TEXT_VARIATION_WEB_SEARCH = 0x00000080; + + /** + * Variation of {@link #TYPE_CLASS_TEXT}: entering text inside of + * a web form. + */ + public static final int TYPE_TEXT_VARIATION_WEB_EDIT_TEXT = 0x00000090; + + // ---------------------------------------------------------------------- + // ---------------------------------------------------------------------- + // ---------------------------------------------------------------------- + + /** + * Class for numeric text. This class supports the following flag: + * {@link #TYPE_NUMBER_FLAG_SIGNED} and + * {@link #TYPE_NUMBER_FLAG_DECIMAL}. + */ + public static final int TYPE_CLASS_NUMBER = 0x00000002; + + /** + * Flag of {@link #TYPE_CLASS_NUMBER}: the number is signed, allowing + * a positive or negative sign at the start. + */ + public static final int TYPE_NUMBER_FLAG_SIGNED = 0x00001000; + + /** + * Flag of {@link #TYPE_CLASS_NUMBER}: the number is decimal, allowing + * a decimal point to provide fractional values. + */ + public static final int TYPE_NUMBER_FLAG_DECIMAL = 0x00002000; + + // ---------------------------------------------------------------------- + // ---------------------------------------------------------------------- + // ---------------------------------------------------------------------- + + /** + * Class for a phone number. This class currently supports no variations + * or flags. + */ + public static final int TYPE_CLASS_PHONE = 0x00000003; + + // ---------------------------------------------------------------------- + // ---------------------------------------------------------------------- + // ---------------------------------------------------------------------- + + /** + * Class for dates and times. It supports the + * following variations: + * {@link #TYPE_DATETIME_VARIATION_NORMAL} + * {@link #TYPE_DATETIME_VARIATION_DATE}, and + * {@link #TYPE_DATETIME_VARIATION_TIME},. + */ + public static final int TYPE_CLASS_DATETIME = 0x00000004; + + /** + * Default variation of {@link #TYPE_CLASS_DATETIME}: allows entering + * both a date and time. + */ + public static final int TYPE_DATETIME_VARIATION_NORMAL = 0x00000000; + + /** + * Default variation of {@link #TYPE_CLASS_DATETIME}: allows entering + * only a date. + */ + public static final int TYPE_DATETIME_VARIATION_DATE = 0x00000010; + + /** + * Default variation of {@link #TYPE_CLASS_DATETIME}: allows entering + * only a time. + */ + public static final int TYPE_DATETIME_VARIATION_TIME = 0x00000020; +} diff --git a/core/java/android/text/LoginFilter.java b/core/java/android/text/LoginFilter.java index dd2d77ffbf169..27c703f1f083a 100644 --- a/core/java/android/text/LoginFilter.java +++ b/core/java/android/text/LoginFilter.java @@ -83,8 +83,21 @@ public abstract class LoginFilter implements InputFilter { } onStop(); + + if (!changed) { + return null; + } - return changed ? new String(out, 0, outidx) : null; + String s = new String(out, 0, outidx); + + if (source instanceof Spanned) { + SpannableString sp = new SpannableString(s); + TextUtils.copySpansFrom((Spanned) source, + start, end, null, sp, 0); + return sp; + } else { + return s; + } } /** diff --git a/core/java/android/text/Selection.java b/core/java/android/text/Selection.java index 0f4916ab1eb86..44469eced07e9 100644 --- a/core/java/android/text/Selection.java +++ b/core/java/android/text/Selection.java @@ -417,10 +417,13 @@ public class Selection { } } + private static final class START { }; + private static final class END { }; + /* * Public constants */ - public static final Object SELECTION_START = new Object(); - public static final Object SELECTION_END = new Object(); + public static final Object SELECTION_START = new START(); + public static final Object SELECTION_END = new END(); } diff --git a/core/java/android/text/Spanned.java b/core/java/android/text/Spanned.java index 2b4b4d230ebd8..bd0a16b7e26fb 100644 --- a/core/java/android/text/Spanned.java +++ b/core/java/android/text/Spanned.java @@ -25,6 +25,12 @@ package android.text; public interface Spanned extends CharSequence { + /** + * Bitmask of bits that are relevent for controlling point/mark behavior + * of spans. + */ + public static final int SPAN_POINT_MARK_MASK = 0x33; + /** * 0-length spans with type SPAN_MARK_MARK behave like text marks: * they remain at their original offset when text is inserted @@ -91,6 +97,14 @@ extends CharSequence */ public static final int SPAN_EXCLUSIVE_INCLUSIVE = SPAN_POINT_POINT; + /** + * This flag is set on spans that are being used to apply temporary + * styling information on the composing text of an input method, so that + * they can be found and removed when the composing text is being + * replaced. + */ + public static final int SPAN_COMPOSING = 0x100; + /** * The bits numbered SPAN_USER_SHIFT and above are available * for callers to use to store scalar data associated with their diff --git a/core/java/android/text/StaticLayout.java b/core/java/android/text/StaticLayout.java index 2d185758a1ef4..ceb9f4fab43be 100644 --- a/core/java/android/text/StaticLayout.java +++ b/core/java/android/text/StaticLayout.java @@ -907,7 +907,8 @@ extends Layout mLineDirections[j] = linedirs; - if (ellipsize != null) { + // If ellipsize is in marquee mode, do not apply ellipsis on the first line + if (ellipsize != null && (ellipsize != TextUtils.TruncateAt.MARQUEE || j != 0)) { calculateEllipsis(start, end, widths, widstart, widoff, ellipsiswidth, ellipsize, j, textwidth, paint); @@ -950,7 +951,7 @@ extends Layout ellipsisStart = 0; ellipsisCount = i; - } else if (where == TextUtils.TruncateAt.END) { + } else if (where == TextUtils.TruncateAt.END || where == TextUtils.TruncateAt.MARQUEE) { float sum = 0; int i; diff --git a/core/java/android/text/TextUtils.java b/core/java/android/text/TextUtils.java index e791aaf74681b..64356d547152e 100644 --- a/core/java/android/text/TextUtils.java +++ b/core/java/android/text/TextUtils.java @@ -22,6 +22,7 @@ import android.content.res.ColorStateList; import android.content.res.Resources; import android.os.Parcel; import android.os.Parcelable; +import android.text.method.TextKeyListener.Capitalize; import android.text.style.AbsoluteSizeSpan; import android.text.style.AlignmentSpan; import android.text.style.BackgroundColorSpan; @@ -42,13 +43,14 @@ import android.text.style.TextAppearanceSpan; import android.text.style.TypefaceSpan; import android.text.style.URLSpan; import android.text.style.UnderlineSpan; +import android.util.Printer; + import com.android.internal.util.ArrayUtils; import java.util.regex.Pattern; import java.util.Iterator; -public class TextUtils -{ +public class TextUtils { private TextUtils() { /* cannot be instantiated */ } private static String[] EMPTY_STRING_ARRAY = new String[]{}; @@ -826,6 +828,30 @@ public class TextUtils } }; + /** + * Debugging tool to print the spans in a CharSequence. The output will + * be printed one span per line. If the CharSequence is not a Spanned, + * then the entire string will be printed on a single line. + */ + public static void dumpSpans(CharSequence cs, Printer printer, String prefix) { + if (cs instanceof Spanned) { + Spanned sp = (Spanned) cs; + Object[] os = sp.getSpans(0, cs.length(), Object.class); + + for (int i = 0; i < os.length; i++) { + Object o = os[i]; + printer.println(prefix + cs.subSequence(sp.getSpanStart(o), + sp.getSpanEnd(o)) + ": " + + Integer.toHexString(System.identityHashCode(o)) + + " " + o.getClass().getCanonicalName() + + " (" + sp.getSpanStart(o) + "-" + sp.getSpanEnd(o) + + ") fl=#" + sp.getSpanFlags(o)); + } + } else { + printer.println(prefix + cs + ": (no spans)"); + } + } + /** * Return a new CharSequence in which each of the source strings is * replaced by the corresponding element of the destinations. @@ -1021,6 +1047,7 @@ public class TextUtils START, MIDDLE, END, + MARQUEE, } public interface EllipsizeCallback { @@ -1460,7 +1487,7 @@ public class TextUtils case '&': sb.append("&"); //$NON-NLS-1$ break; - case '\\': + case '\'': sb.append("'"); //$NON-NLS-1$ break; case '"': @@ -1565,6 +1592,132 @@ public class TextUtils return true; } + /** + * Capitalization mode for {@link #getCapsMode}: capitalize all + * characters. This value is explicitly defined to be the same as + * {@link InputType#TYPE_TEXT_FLAG_CAP_CHARACTERS}. + */ + public static final int CAP_MODE_CHARACTERS + = InputType.TYPE_TEXT_FLAG_CAP_CHARACTERS; + + /** + * Capitalization mode for {@link #getCapsMode}: capitalize the first + * character of all words. This value is explicitly defined to be the same as + * {@link InputType#TYPE_TEXT_FLAG_CAP_WORDS}. + */ + public static final int CAP_MODE_WORDS + = InputType.TYPE_TEXT_FLAG_CAP_WORDS; + + /** + * Capitalization mode for {@link #getCapsMode}: capitalize the first + * character of each sentence. This value is explicitly defined to be the same as + * {@link InputType#TYPE_TEXT_FLAG_CAP_SENTENCES}. + */ + public static final int CAP_MODE_SENTENCES + = InputType.TYPE_TEXT_FLAG_CAP_SENTENCES; + + /** + * Determine what caps mode should be in effect at the current offset in + * the text. Only the mode bits set in reqModes will be + * checked. Note that the caps mode flags here are explicitly defined + * to match those in {@link InputType}. + * + * @param cs The text that should be checked for caps modes. + * @param off Location in the text at which to check. + * @param reqModes The modes to be checked: may be any combination of + * {@link #CAP_MODE_CHARACTERS}, {@link #CAP_MODE_WORDS}, and + * {@link #CAP_MODE_SENTENCES}. + * + * @return Returns the actual capitalization modes that can be in effect + * at the current position, which is any combination of + * {@link #CAP_MODE_CHARACTERS}, {@link #CAP_MODE_WORDS}, and + * {@link #CAP_MODE_SENTENCES}. + */ + public static int getCapsMode(CharSequence cs, int off, int reqModes) { + int i; + char c; + int mode = 0; + + if ((reqModes&CAP_MODE_CHARACTERS) != 0) { + mode |= CAP_MODE_CHARACTERS; + } + if ((reqModes&(CAP_MODE_WORDS|CAP_MODE_SENTENCES)) == 0) { + return mode; + } + + // Back over allowed opening punctuation. + + for (i = off; i > 0; i--) { + c = cs.charAt(i - 1); + + if (c != '"' && c != '\'' && + Character.getType(c) != Character.START_PUNCTUATION) { + break; + } + } + + // Start of paragraph, with optional whitespace. + + int j = i; + while (j > 0 && ((c = cs.charAt(j - 1)) == ' ' || c == '\t')) { + j--; + } + if (j == 0 || cs.charAt(j - 1) == '\n') { + return mode | CAP_MODE_WORDS; + } + + // Or start of word if we are that style. + + if ((reqModes&CAP_MODE_SENTENCES) == 0) { + if (i != j) mode |= CAP_MODE_WORDS; + return mode; + } + + // There must be a space if not the start of paragraph. + + if (i == j) { + return mode; + } + + // Back over allowed closing punctuation. + + for (; j > 0; j--) { + c = cs.charAt(j - 1); + + if (c != '"' && c != '\'' && + Character.getType(c) != Character.END_PUNCTUATION) { + break; + } + } + + if (j > 0) { + c = cs.charAt(j - 1); + + if (c == '.' || c == '?' || c == '!') { + // Do not capitalize if the word ends with a period but + // also contains a period, in which case it is an abbreviation. + + if (c == '.') { + for (int k = j - 2; k >= 0; k--) { + c = cs.charAt(k); + + if (c == '.') { + return mode; + } + + if (!Character.isLetter(c)) { + break; + } + } + } + + return mode | CAP_MODE_SENTENCES; + } + } + + return mode; + } + private static Object sLock = new Object(); private static char[] sTemp = null; } diff --git a/core/java/android/pim/DateFormat.java b/core/java/android/text/format/DateFormat.java similarity index 82% rename from core/java/android/pim/DateFormat.java rename to core/java/android/text/format/DateFormat.java index 802e045e2ae58..34379781dcedf 100644 --- a/core/java/android/pim/DateFormat.java +++ b/core/java/android/text/format/DateFormat.java @@ -14,19 +14,21 @@ * limitations under the License. */ -package android.pim; +package android.text.format; import android.content.Context; import android.provider.Settings; -import android.provider.Settings.SettingNotFoundException; import android.text.SpannableStringBuilder; import android.text.Spanned; import android.text.SpannedString; +import com.android.internal.R; + import java.util.Calendar; import java.util.Date; import java.util.GregorianCalendar; import java.util.TimeZone; +import java.text.SimpleDateFormat; /** Utility class for producing strings with formatted date/time. @@ -187,12 +189,32 @@ public class DateFormat { public static final char YEAR = 'y'; /** - * @return true if the user has set the system to use a 24 hour time - * format, else false. + * Returns true if user preference is set to 24-hour format. + * @param context the context to use for the content resolver + * @return true if 24 hour time format is selected, false otherwise. */ public static boolean is24HourFormat(Context context) { String value = Settings.System.getString(context.getContentResolver(), Settings.System.TIME_12_24); + + if (value == null) { + java.text.DateFormat natural = + java.text.DateFormat.getTimeInstance( + java.text.DateFormat.LONG, + context.getResources().getConfiguration().locale); + + if (natural instanceof SimpleDateFormat) { + SimpleDateFormat sdf = (SimpleDateFormat) natural; + String pattern = sdf.toPattern(); + + if (pattern.indexOf('H') >= 0) { + return true; + } else { + return false; + } + } + } + boolean b24 = !(value == null || value.equals("12")); return b24; } @@ -205,7 +227,15 @@ public class DateFormat { */ public static final java.text.DateFormat getTimeFormat(Context context) { boolean b24 = is24HourFormat(context); - return new java.text.SimpleDateFormat(b24 ? "H:mm" : "h:mm a"); + int res; + + if (b24) { + res = R.string.twenty_four_hour_time_format; + } else { + res = R.string.twelve_hour_time_format; + } + + return new java.text.SimpleDateFormat(context.getString(res)); } /** @@ -228,13 +258,29 @@ public class DateFormat { public static final java.text.DateFormat getLongDateFormat(Context context) { String value = getDateFormatString(context); if (value.indexOf('M') < value.indexOf('d')) { - value = "MMMM dd, yyyy"; + value = context.getString(R.string.full_date_month_first); } else { - value = "dd MMMM, yyyy"; + value = context.getString(R.string.full_date_day_first); } return new java.text.SimpleDateFormat(value); } - + + /** + * Returns a {@link java.text.DateFormat} object that can format the date + * in medium form (such as Dec. 31, 1999) based on user preference. + * @param context the application context + * @return the {@link java.text.DateFormat} object that formats the date in long form. + */ + public static final java.text.DateFormat getMediumDateFormat(Context context) { + String value = getDateFormatString(context); + if (value.indexOf('M') < value.indexOf('d')) { + value = context.getString(R.string.medium_date_month_first); + } else { + value = context.getString(R.string.medium_date_day_first); + } + return new java.text.SimpleDateFormat(value); + } + /** * Gets the current date format stored as a char array. The array will contain * 3 elements ({@link #DATE}, {@link #MONTH}, and {@link #YEAR}) in the order @@ -274,15 +320,33 @@ public class DateFormat { String value = Settings.System.getString(context.getContentResolver(), Settings.System.DATE_FORMAT); if (value == null || value.length() < 6) { + /* + * No need to localize -- this is an emergency fallback in case + * the setting is missing, but it should always be set. + */ value = "MM-dd-yyyy"; } return value; } + /** + * Given a format string and a time in milliseconds since Jan 1, 1970 GMT, returns a + * CharSequence containing the requested date. + * @param inFormat the format string, as described in {@link android.text.format.DateFormat} + * @param inTimeInMillis in milliseconds since Jan 1, 1970 GMT + * @return a {@link CharSequence} containing the requested text + */ public static final CharSequence format(CharSequence inFormat, long inTimeInMillis) { return format(inFormat, new Date(inTimeInMillis)); } + /** + * Given a format string and a {@link java.util.Date} object, returns a CharSequence containing + * the requested date. + * @param inFormat the format string, as described in {@link android.text.format.DateFormat} + * @param inDate the date to format + * @return a {@link CharSequence} containing the requested text + */ public static final CharSequence format(CharSequence inFormat, Date inDate) { Calendar c = new GregorianCalendar(); @@ -291,6 +355,13 @@ public class DateFormat { return format(inFormat, c); } + /** + * Given a format string and a {@link java.util.Calendar} object, returns a CharSequence + * containing the requested date. + * @param inFormat the format string, as described in {@link android.text.format.DateFormat} + * @param inDate the date to format + * @return a {@link CharSequence} containing the requested text + */ public static final CharSequence format(CharSequence inFormat, Calendar inDate) { SpannableStringBuilder s = new SpannableStringBuilder(inFormat); int c; diff --git a/core/java/android/pim/DateUtils.java b/core/java/android/text/format/DateUtils.java similarity index 82% rename from core/java/android/pim/DateUtils.java rename to core/java/android/text/format/DateUtils.java index 2a01f125f0207..48f65c6c3d646 100644 --- a/core/java/android/pim/DateUtils.java +++ b/core/java/android/text/format/DateUtils.java @@ -14,25 +14,26 @@ * limitations under the License. */ -package android.pim; +package android.text.format; + +import com.android.internal.R; import android.content.Context; import android.content.res.Configuration; import android.content.res.Resources; +import android.pim.DateException; import java.util.Calendar; import java.util.Date; import java.util.GregorianCalendar; import java.util.TimeZone; -import com.android.internal.R; - /** + * This class contains various date-related utilities for creating text for things like + * elapsed time and date ranges, strings for days of the week and months, and AM/PM text etc. */ public class DateUtils { - private static final String TAG = "DateUtils"; - private static final Object sLock = new Object(); private static final int[] sDaysLong = new int[] { com.android.internal.R.string.day_of_week_long_sunday, @@ -125,9 +126,7 @@ public class DateUtils com.android.internal.R.string.am, com.android.internal.R.string.pm, }; - private static int sFirstDay; private static Configuration sLastConfig; - private static String sStatusDateFormat; private static String sStatusTimeFormat; private static String sElapsedFormatMMSS; private static String sElapsedFormatHMMSS; @@ -153,17 +152,18 @@ public class DateUtils public static final int FORMAT_NO_YEAR = 0x00008; public static final int FORMAT_SHOW_DATE = 0x00010; public static final int FORMAT_NO_MONTH_DAY = 0x00020; - public static final int FORMAT_24HOUR = 0x00040; - public static final int FORMAT_CAP_AMPM = 0x00080; - public static final int FORMAT_NO_NOON = 0x00100; - public static final int FORMAT_CAP_NOON = 0x00200; - public static final int FORMAT_NO_MIDNIGHT = 0x00400; - public static final int FORMAT_CAP_MIDNIGHT = 0x00800; - public static final int FORMAT_UTC = 0x01000; - public static final int FORMAT_ABBREV_TIME = 0x02000; - public static final int FORMAT_ABBREV_WEEKDAY = 0x04000; - public static final int FORMAT_ABBREV_MONTH = 0x08000; - public static final int FORMAT_NUMERIC_DATE = 0x10000; + public static final int FORMAT_12HOUR = 0x00040; + public static final int FORMAT_24HOUR = 0x00080; + public static final int FORMAT_CAP_AMPM = 0x00100; + public static final int FORMAT_NO_NOON = 0x00200; + public static final int FORMAT_CAP_NOON = 0x00400; + public static final int FORMAT_NO_MIDNIGHT = 0x00800; + public static final int FORMAT_CAP_MIDNIGHT = 0x01000; + public static final int FORMAT_UTC = 0x02000; + public static final int FORMAT_ABBREV_TIME = 0x04000; + public static final int FORMAT_ABBREV_WEEKDAY = 0x08000; + public static final int FORMAT_ABBREV_MONTH = 0x10000; + public static final int FORMAT_NUMERIC_DATE = 0x20000; public static final int FORMAT_ABBREV_ALL = (FORMAT_ABBREV_TIME | FORMAT_ABBREV_WEEKDAY | FORMAT_ABBREV_MONTH); public static final int FORMAT_CAP_NOON_MIDNIGHT = (FORMAT_CAP_NOON | FORMAT_CAP_MIDNIGHT); @@ -172,10 +172,6 @@ public class DateUtils // Date and time format strings that are constant and don't need to be // translated. public static final String HOUR_MINUTE_24 = "%H:%M"; - public static final String HOUR_MINUTE_AMPM = "%-l:%M%P"; - public static final String HOUR_MINUTE_CAP_AMPM = "%-l:%M%p"; - public static final String HOUR_AMPM = "%-l%P"; - public static final String HOUR_CAP_AMPM = "%-l%p"; public static final String MONTH_FORMAT = "%B"; public static final String ABBREV_MONTH_FORMAT = "%b"; public static final String NUMERIC_MONTH_FORMAT = "%m"; @@ -238,7 +234,7 @@ public class DateUtils /** * Request the full spelled-out name. - * For use with the 'abbrev' parameter of {@link #getDayOfWeekStr} and {@link #getMonthStr}. + * For use with the 'abbrev' parameter of {@link #getDayOfWeekString} and {@link #getMonthString}. * @more *

    e.g. "Sunday" or "January" */ @@ -246,7 +242,7 @@ public class DateUtils /** * Request an abbreviated version of the name. - * For use with the 'abbrev' parameter of {@link #getDayOfWeekStr} and {@link #getMonthStr}. + * For use with the 'abbrev' parameter of {@link #getDayOfWeekString} and {@link #getMonthString}. * @more *

    e.g. "Sun" or "Jan" */ @@ -254,7 +250,7 @@ public class DateUtils /** * Request a shorter abbreviated version of the name. - * For use with the 'abbrev' parameter of {@link #getDayOfWeekStr} and {@link #getMonthStr}. + * For use with the 'abbrev' parameter of {@link #getDayOfWeekString} and {@link #getMonthString}. * @more *

    e.g. "Su" or "Jan" *

    In some languages, the results returned for LENGTH_SHORT may be the same as @@ -264,7 +260,7 @@ public class DateUtils /** * Request an even shorter abbreviated version of the name. - * For use with the 'abbrev' parameter of {@link #getDayOfWeekStr} and {@link #getMonthStr}. + * For use with the 'abbrev' parameter of {@link #getDayOfWeekString} and {@link #getMonthString}. * @more *

    e.g. "M", "Tu", "Th" or "J" *

    In some languages, the results returned for LENGTH_SHORTEST may be the same as @@ -274,7 +270,7 @@ public class DateUtils /** * Request an even shorter abbreviated version of the name. - * For use with the 'abbrev' parameter of {@link #getDayOfWeekStr} and {@link #getMonthStr}. + * For use with the 'abbrev' parameter of {@link #getDayOfWeekString} and {@link #getMonthString}. * @more *

    e.g. "S", "T", "T" or "J" *

    In some languages, the results returned for LENGTH_SHORTEST may be the same as @@ -282,11 +278,10 @@ public class DateUtils */ public static final int LENGTH_SHORTEST = 50; - /** * Return a string for the day of the week. - * @param dayOfWeek One of {@link #Calendar.SUNDAY Calendar.SUNDAY}, - * {@link #Calendar.MONDAY Calendar.MONDAY}, etc. + * @param dayOfWeek One of {@link Calendar#SUNDAY Calendar.SUNDAY}, + * {@link Calendar#MONDAY Calendar.MONDAY}, etc. * @param abbrev One of {@link #LENGTH_LONG}, {@link #LENGTH_SHORT}, {@link #LENGTH_SHORTER} * or {@link #LENGTH_SHORTEST}. For forward compatibility, anything else * will return the same as {#LENGTH_MEDIUM}. @@ -308,9 +303,10 @@ public class DateUtils } /** - * Return a string for AM or PM. + * Return a localized string for AM or PM. * @param ampm Either {@link Calendar#AM Calendar.AM} or {@link Calendar#PM Calendar.PM}. * @throws IndexOutOfBoundsException if the ampm is out of bounds. + * @return Localized version of "AM" or "PM". */ public static String getAMPMString(int ampm) { Resources r = Resources.getSystem(); @@ -318,12 +314,13 @@ public class DateUtils } /** - * Return a string for the day of the week. - * @param month One of {@link #Calendar.JANUARY Calendar.JANUARY}, - * {@link #Calendar.FEBRUARY Calendar.FEBRUARY}, etc. + * Return a localized string for the day of the week. + * @param month One of {@link Calendar#JANUARY Calendar.JANUARY}, + * {@link Calendar#FEBRUARY Calendar.FEBRUARY}, etc. * @param abbrev One of {@link #LENGTH_LONG}, {@link #LENGTH_SHORT}, {@link #LENGTH_SHORTER} * or {@link #LENGTH_SHORTEST}. For forward compatibility, anything else * will return the same as {#LENGTH_MEDIUM}. + * @return Localized day of the week. */ public static String getMonthString(int month, int abbrev) { // Note that here we use sMonthsMedium for MEDIUM, SHORT and SHORTER. @@ -344,6 +341,12 @@ public class DateUtils return r.getString(list[month - Calendar.JANUARY]); } + /** + * Returns a string describing the elapsed time since startTime. + * @param startTime some time in the past. + * @return a String object containing the elapsed time. + * @see #getRelativeTimeSpanString(long, long, long) + */ public static CharSequence getRelativeTimeSpanString(long startTime) { return getRelativeTimeSpanString(startTime, System.currentTimeMillis(), MINUTE_IN_MILLIS); } @@ -363,67 +366,50 @@ public class DateUtils public static CharSequence getRelativeTimeSpanString(long time, long now, long minResolution) { Resources r = Resources.getSystem(); - // TODO: Assembling strings by hand like this is bad style for i18n. - boolean past = (now > time); - String prefix = past ? null : r.getString(com.android.internal.R.string.in); - String postfix = past ? r.getString(com.android.internal.R.string.ago) : null; - return getRelativeTimeSpanString(time, now, minResolution, prefix, postfix); - } - - public static CharSequence getRelativeTimeSpanString(long time, long now, long minResolution, - String prefix, String postfix) { - Resources r = Resources.getSystem(); - + boolean past = (now >= time); long duration = Math.abs(now - time); + int resId; + long count; if (duration < MINUTE_IN_MILLIS && minResolution < MINUTE_IN_MILLIS) { - long count = duration / SECOND_IN_MILLIS; - String singular = r.getString(com.android.internal.R.string.second); - String plural = r.getString(com.android.internal.R.string.seconds); - return pluralizedSpan(count, singular, plural, prefix, postfix); - } - - if (duration < HOUR_IN_MILLIS && minResolution < HOUR_IN_MILLIS) { - long count = duration / MINUTE_IN_MILLIS; - String singular = r.getString(com.android.internal.R.string.minute); - String plural = r.getString(com.android.internal.R.string.minutes); - return pluralizedSpan(count, singular, plural, prefix, postfix); - } - - if (duration < DAY_IN_MILLIS && minResolution < DAY_IN_MILLIS) { - long count = duration / HOUR_IN_MILLIS; - String singular = r.getString(com.android.internal.R.string.hour); - String plural = r.getString(com.android.internal.R.string.hours); - return pluralizedSpan(count, singular, plural, prefix, postfix); - } - - if (duration < WEEK_IN_MILLIS && minResolution < WEEK_IN_MILLIS) { - return getRelativeDayString(r, time, now); - } - - return dateString(time); - } - - - private static final String pluralizedSpan(long count, String singular, String plural, - String prefix, String postfix) { - StringBuilder s = new StringBuilder(); - - if (prefix != null) { - s.append(prefix); - s.append(" "); + count = duration / SECOND_IN_MILLIS; + if (past) { + resId = com.android.internal.R.plurals.num_seconds_ago; + } else { + resId = com.android.internal.R.plurals.in_num_seconds; + } + } else if (duration < HOUR_IN_MILLIS && minResolution < HOUR_IN_MILLIS) { + count = duration / MINUTE_IN_MILLIS; + if (past) { + resId = com.android.internal.R.plurals.num_minutes_ago; + } else { + resId = com.android.internal.R.plurals.in_num_minutes; + } + } else if (duration < DAY_IN_MILLIS && minResolution < DAY_IN_MILLIS) { + count = duration / HOUR_IN_MILLIS; + if (past) { + resId = com.android.internal.R.plurals.num_hours_ago; + } else { + resId = com.android.internal.R.plurals.in_num_hours; + } + } else if (duration < WEEK_IN_MILLIS && minResolution < WEEK_IN_MILLIS) { + count = duration / DAY_IN_MILLIS; + if (past) { + resId = com.android.internal.R.plurals.num_days_ago; + } else { + resId = com.android.internal.R.plurals.in_num_days; + } + } else { + // Longer than a week ago, so just show the date. + int flags = FORMAT_SHOW_DATE | FORMAT_SHOW_YEAR | FORMAT_ABBREV_MONTH; + + // We know that we won't be showing the time, so it is safe to pass + // in a null context. + return formatDateRange(null, time, time, flags); } - s.append(count); - s.append(' '); - s.append(count == 0 || count > 1 ? plural : singular); - - if (postfix != null) { - s.append(" "); - s.append(postfix); - } - - return s.toString(); + String format = r.getQuantityString(resId, (int) count); + return String.format(format, count); } /** @@ -457,12 +443,16 @@ public class DateUtils } else if (days == 0) { return r.getString(com.android.internal.R.string.today); } - - if (!past) { - return r.getString(com.android.internal.R.string.daysDurationFuturePlural, days); + + int resId; + if (past) { + resId = com.android.internal.R.plurals.num_days_ago; } else { - return r.getString(com.android.internal.R.string.daysDurationPastPlural, days); + resId = com.android.internal.R.plurals.in_num_days; } + + String format = r.getQuantityString(resId, days); + return String.format(format, days); } private static void initFormatStrings() { @@ -472,7 +462,6 @@ public class DateUtils if (sLastConfig == null || !sLastConfig.equals(cfg)) { sLastConfig = cfg; sStatusTimeFormat = r.getString(com.android.internal.R.string.status_bar_time_format); - sStatusDateFormat = r.getString(com.android.internal.R.string.status_bar_date_format); sElapsedFormatMMSS = r.getString(com.android.internal.R.string.elapsed_time_short_format_mm_ss); sElapsedFormatHMMSS = r.getString(com.android.internal.R.string.elapsed_time_short_format_h_mm_ss); } @@ -488,20 +477,11 @@ public class DateUtils initFormatStrings(); return DateFormat.format(sStatusTimeFormat, millis); } - - /** - * Format a date so it appears like it would in the status bar clock. - * @deprecated use {@link #DateFormat.getDateFormat(Context)} instead. - * @hide - */ - public static final CharSequence dateString(long startTime) { - initFormatStrings(); - return DateFormat.format(sStatusDateFormat, startTime); - } /** - * Formats an elapsed time like MM:SS or H:MM:SS + * Formats an elapsed time in the form "MM:SS" or "H:MM:SS" * for display on the call-in-progress screen. + * @param elapsedSeconds the elapsed time in seconds. */ public static String formatElapsedTime(long elapsedSeconds) { initFormatStrings(); @@ -584,7 +564,7 @@ public class DateUtils return (char) (digit + '0'); } - /* + /** * Format a date / time such that if the then is on the same day as now, it shows * just the time and if it's a different day, it shows just the date. * @@ -623,7 +603,7 @@ public class DateUtils /** * @hide - * @deprecated use {@link android.pim.Time} + * @deprecated use {@link android.text.format.Time} */ public static Calendar newCalendar(boolean zulu) { @@ -652,7 +632,7 @@ public class DateUtils /** * @hide - * @deprecated use {@link android.pim.Time} + * @deprecated use {@link android.text.format.Time} */ private static final int ctoi(String str, int index) throws DateException @@ -667,7 +647,7 @@ public class DateUtils /** * @hide - * @deprecated use {@link android.pim.Time} + * @deprecated use {@link android.text.format.Time} */ private static final int check(int lowerBound, int upperBound, int value) throws DateException @@ -681,7 +661,7 @@ public class DateUtils /** * @hide - * @deprecated use {@link android.pim.Time} + * @deprecated use {@link android.text.format.Time} * Return true if this date string is local time */ public static boolean isUTC(String s) @@ -702,7 +682,7 @@ public class DateUtils // Returns if the Z was present, meaning that the time is in UTC /** * @hide - * @deprecated use {@link android.pim.Time} + * @deprecated use {@link android.text.format.Time} */ public static boolean parseDateTime(String str, Calendar cal) throws DateException @@ -748,7 +728,7 @@ public class DateUtils * Given a timezone string which can be null, and a dateTime string, * set that time into a calendar. * @hide - * @deprecated use {@link android.pim.Time} + * @deprecated use {@link android.text.format.Time} */ public static void parseDateTime(String tz, String dateTime, Calendar out) throws DateException @@ -778,7 +758,7 @@ public class DateUtils * * @param cal the date and time to write * @hide - * @deprecated use {@link android.pim.Time} + * @deprecated use {@link android.text.format.Time} */ public static String writeDateTime(Calendar cal) { @@ -796,7 +776,7 @@ public class DateUtils * be written at the end as per RFC2445. Otherwise, the time is * considered in localtime. * @hide - * @deprecated use {@link android.pim.Time} + * @deprecated use {@link android.text.format.Time} */ public static String writeDateTime(Calendar cal, boolean zulu) { @@ -819,7 +799,7 @@ public class DateUtils * has already been called on sb to the appropriate length * which is sb.setLength(zulu ? 16 : 15) * @hide - * @deprecated use {@link android.pim.Time} + * @deprecated use {@link android.text.format.Time} */ public static String writeDateTime(Calendar cal, StringBuilder sb) { @@ -866,7 +846,7 @@ public class DateUtils /** * @hide - * @deprecated use {@link android.pim.Time} + * @deprecated use {@link android.text.format.Time} */ public static void assign(Calendar lval, Calendar rval) { @@ -876,8 +856,31 @@ public class DateUtils } /** - * Creates a string describing a date/time range. The flags argument - * is a bitmask of options from the following list: + * Formats a date or a time range according to the local conventions. + * + *

    + * Example output strings (date formats in these examples are shown using + * the US date format convention but that may change depending on the + * local settings): + *

      + *
    • 10:15am
    • + *
    • 3:00pm - 4:00pm
    • + *
    • 3pm - 4pm
    • + *
    • 3PM - 4PM
    • + *
    • 08:00 - 17:00
    • + *
    • Oct 9
    • + *
    • Tue, Oct 9
    • + *
    • October 9, 2007
    • + *
    • Oct 9 - 10
    • + *
    • Oct 9 - 10, 2007
    • + *
    • Oct 28 - Nov 3, 2007
    • + *
    • Dec 31, 2007 - Jan 1, 2008
    • + *
    • Oct 9, 8:00am - Oct 10, 5:00pm
    • + *
    • 12/31/2007 - 01/01/2008
    • + *
    + * + *

    + * The flags argument is a bitmask of options from the following list: * *

      *
    • FORMAT_SHOW_TIME
    • @@ -886,6 +889,7 @@ public class DateUtils *
    • FORMAT_NO_YEAR
    • *
    • FORMAT_SHOW_DATE
    • *
    • FORMAT_NO_MONTH_DAY
    • + *
    • FORMAT_12HOUR
    • *
    • FORMAT_24HOUR
    • *
    • FORMAT_CAP_AMPM
    • *
    • FORMAT_NO_NOON
    • @@ -946,15 +950,25 @@ public class DateUtils * shown instead of "midnight". * *

      + * If FORMAT_12HOUR is set and the time is shown, then the time is + * shown in the 12-hour time format. You should not normally set this. + * Instead, let the time format be chosen automatically according to the + * system settings. If both FORMAT_12HOUR and FORMAT_24HOUR are set, then + * FORMAT_24HOUR takes precedence. + * + *

      * If FORMAT_24HOUR is set and the time is shown, then the time is - * shown in the 24-hour time format. + * shown in the 24-hour time format. You should not normally set this. + * Instead, let the time format be chosen automatically according to the + * system settings. If both FORMAT_12HOUR and FORMAT_24HOUR are set, then + * FORMAT_24HOUR takes precedence. * *

      * If FORMAT_UTC is set, then the UTC timezone is used for the start * and end milliseconds. * *

      - * If FORMAT_ABBREV_TIME is set and FORMAT_24HOUR is not set, then the + * If FORMAT_ABBREV_TIME is set and 12-hour time format is used, then the * start and end times (if shown) are abbreviated by not showing the minutes * if they are zero. For example, instead of "3:00pm" the time would be * abbreviated to "3pm". @@ -976,30 +990,15 @@ public class DateUtils * instead of using the name of the month. For example, "12/31/2008" * instead of "December 31, 2008". * - *

      - * Example output strings: - *

        - *
      • 10:15am
      • - *
      • 3:00pm - 4:00pm
      • - *
      • 3pm - 4pm
      • - *
      • 3PM - 4PM
      • - *
      • 08:00 - 17:00
      • - *
      • Oct 9
      • - *
      • Tue, Oct 9
      • - *
      • October 9, 2007
      • - *
      • Oct 9 - 10
      • - *
      • Oct 9 - 10, 2007
      • - *
      • Oct 28 - Nov 3, 2007
      • - *
      • Dec 31, 2007 - Jan 1, 2008
      • - *
      • Oct 9, 8:00am - Oct 10, 5:00pm
      • - *
      + * @param context the context is required only if the time is shown * @param startMillis the start time in UTC milliseconds * @param endMillis the end time in UTC milliseconds * @param flags a bit mask of options * - * @return a string with the formatted date/time range. + * @return a string containing the formatted date/time range. */ - public static String formatDateRange(long startMillis, long endMillis, int flags) { + public static String formatDateRange(Context context, long startMillis, + long endMillis, int flags) { Resources res = Resources.getSystem(); boolean showTime = (flags & FORMAT_SHOW_TIME) != 0; boolean showWeekDay = (flags & FORMAT_SHOW_WEEKDAY) != 0; @@ -1008,7 +1007,6 @@ public class DateUtils boolean useUTC = (flags & FORMAT_UTC) != 0; boolean abbrevWeekDay = (flags & FORMAT_ABBREV_WEEKDAY) != 0; boolean abbrevMonth = (flags & FORMAT_ABBREV_MONTH) != 0; - boolean use24Hour = (flags & FORMAT_24HOUR) != 0; boolean noMonthDay = (flags & FORMAT_NO_MONTH_DAY) != 0; boolean numericDate = (flags & FORMAT_NUMERIC_DATE) != 0; @@ -1039,7 +1037,7 @@ public class DateUtils // the end of Nov 11?). // If we are not showing the time then also adjust the end date // for multiple-day events. This is to allow us to display, for - // example, "Nov 10 -11" for an event with an start date of Nov 10 + // example, "Nov 10 -11" for an event with a start date of Nov 10 // and an end date of Nov 12 at 00:00. // If the start and end time are the same, then skip this and don't // adjust the date. @@ -1075,6 +1073,16 @@ public class DateUtils if (showTime) { String startTimeFormat = ""; String endTimeFormat = ""; + boolean force24Hour = (flags & FORMAT_24HOUR) != 0; + boolean force12Hour = (flags & FORMAT_12HOUR) != 0; + boolean use24Hour; + if (force24Hour) { + use24Hour = true; + } else if (force12Hour) { + use24Hour = false; + } else { + use24Hour = DateFormat.is24HourFormat(context); + } if (use24Hour) { startTimeFormat = HOUR_MINUTE_24; endTimeFormat = HOUR_MINUTE_24; @@ -1090,28 +1098,28 @@ public class DateUtils boolean endOnTheHour = endDate.minute == 0 && endDate.second == 0; if (abbrevTime && startOnTheHour) { if (capAMPM) { - startTimeFormat = HOUR_CAP_AMPM; + startTimeFormat = res.getString(com.android.internal.R.string.hour_cap_ampm); } else { - startTimeFormat = HOUR_AMPM; + startTimeFormat = res.getString(com.android.internal.R.string.hour_ampm); } } else { if (capAMPM) { - startTimeFormat = HOUR_MINUTE_CAP_AMPM; + startTimeFormat = res.getString(com.android.internal.R.string.hour_minute_cap_ampm); } else { - startTimeFormat = HOUR_MINUTE_AMPM; + startTimeFormat = res.getString(com.android.internal.R.string.hour_minute_ampm); } } if (abbrevTime && endOnTheHour) { if (capAMPM) { - endTimeFormat = HOUR_CAP_AMPM; + endTimeFormat = res.getString(com.android.internal.R.string.hour_cap_ampm); } else { - endTimeFormat = HOUR_AMPM; + endTimeFormat = res.getString(com.android.internal.R.string.hour_ampm); } } else { if (capAMPM) { - endTimeFormat = HOUR_MINUTE_CAP_AMPM; + endTimeFormat = res.getString(com.android.internal.R.string.hour_minute_cap_ampm); } else { - endTimeFormat = HOUR_MINUTE_AMPM; + endTimeFormat = res.getString(com.android.internal.R.string.hour_minute_ampm); } } @@ -1345,64 +1353,118 @@ public class DateUtils return dateRange; } + /** + * Formats a date or a time according to the local conventions. There are + * lots of options that allow the caller to control, for example, if the + * time is shown, if the day of the week is shown, if the month name is + * abbreviated, if noon is shown instead of 12pm, and so on. For the + * complete list of options, see the documentation for + * {@link #formatDateRange}. + *

      + * Example output strings (date formats in these examples are shown using + * the US date format convention but that may change depending on the + * local settings): + *

        + *
      • 10:15am
      • + *
      • 3:00pm
      • + *
      • 3pm
      • + *
      • 3PM
      • + *
      • 08:00
      • + *
      • 17:00
      • + *
      • noon
      • + *
      • Noon
      • + *
      • midnight
      • + *
      • Midnight
      • + *
      • Oct 31
      • + *
      • Oct 31, 2007
      • + *
      • October 31, 2007
      • + *
      • 10am, Oct 31
      • + *
      • 17:00, Oct 31
      • + *
      • Wed
      • + *
      • Wednesday
      • + *
      • 10am, Wed, Oct 31
      • + *
      • Wed, Oct 31
      • + *
      • Wednesday, Oct 31
      • + *
      • Wed, Oct 31, 2007
      • + *
      • Wed, October 31
      • + *
      • 10/31/2007
      • + *
      + * + * @param context the context is required only if the time is shown + * @param millis a point in time in UTC milliseconds + * @param flags a bit mask of formatting options + * @return a string containing the formatted date/time. + */ + public static String formatDateTime(Context context, long millis, int flags) { + return formatDateRange(context, millis, millis, flags); + } + /** * @return a relative time string to display the time expressed by millis. Times * are counted starting at midnight, which means that assuming that the current * time is March 31st, 0:30: - * "millis=0:10 today" will be displayed as "0:10" - * "millis=11:30pm the day before" will be displayed as "Mar 30" - * A similar scheme is used to dates that are a week, a month or more than a year old. + *
        + *
      • "millis=0:10 today" will be displayed as "0:10"
      • + *
      • "millis=11:30pm the day before" will be displayed as "Mar 30"
      • + *
      + * If the given millis is in a different year, then the full date is + * returned in numeric format (e.g., "10/12/2008"). * * @param withPreposition If true, the string returned will include the correct - * preposition ("at 9:20am", "in 2008" or "on May 29"). + * preposition ("at 9:20am", "on 10/12/2008" or "on May 29"). */ public static CharSequence getRelativeTimeSpanString(Context c, long millis, boolean withPreposition) { - long span = System.currentTimeMillis() - millis; + long now = System.currentTimeMillis(); + long span = now - millis; Resources res = c.getResources(); if (sNowTime == null) { sNowTime = new Time(); sThenTime = new Time(); - sMonthDayFormat = res.getString(com.android.internal.R.string.abbrev_month_day); } - sNowTime.setToNow(); + sNowTime.set(now); sThenTime.set(millis); + String result; + int prepositionId; if (span < DAY_IN_MILLIS && sNowTime.weekDay == sThenTime.weekDay) { // Same day - return getPrepositionDate(res, sThenTime, R.string.preposition_for_time, - HOUR_MINUTE_CAP_AMPM, withPreposition); + int flags = FORMAT_SHOW_TIME; + result = formatDateRange(c, millis, millis, flags); + prepositionId = R.string.preposition_for_time; } else if (sNowTime.year != sThenTime.year) { // Different years - // TODO: take locale into account so that the display will adjust correctly. - return getPrepositionDate(res, sThenTime, R.string.preposition_for_year, - NUMERIC_MONTH_FORMAT + "/" + MONTH_DAY_FORMAT + "/" + YEAR_FORMAT_TWO_DIGITS, - withPreposition); + int flags = FORMAT_SHOW_DATE | FORMAT_SHOW_YEAR | FORMAT_NUMERIC_DATE; + result = formatDateRange(c, millis, millis, flags); + + // This is a date (like "10/31/2008" so use the date preposition) + prepositionId = R.string.preposition_for_date; } else { // Default - return getPrepositionDate(res, sThenTime, R.string.preposition_for_date, - sMonthDayFormat, withPreposition); + int flags = FORMAT_SHOW_DATE | FORMAT_ABBREV_MONTH; + result = formatDateRange(c, millis, millis, flags); + prepositionId = R.string.preposition_for_date; } + if (withPreposition) { + result = res.getString(prepositionId, result); + } + return result; } /** - * @return A date string suitable for display based on the format and including the - * date preposition if withPreposition is true. + * Convenience function to return relative time string without preposition. + * @param c context for resources + * @param millis time in milliseconds + * @return {@link CharSequence} containing relative time. + * @see #getRelativeTimeSpanString(Context, long, boolean) */ - private static String getPrepositionDate(Resources res, Time thenTime, int id, - String formatString, boolean withPreposition) { - String result = thenTime.format(formatString); - return withPreposition ? res.getString(id, result) : result; - } - public static CharSequence getRelativeTimeSpanString(Context c, long millis) { return getRelativeTimeSpanString(c, millis, false /* no preposition */); } private static Time sNowTime; private static Time sThenTime; - private static String sMonthDayFormat; } diff --git a/core/java/android/content/Formatter.java b/core/java/android/text/format/Formatter.java similarity index 71% rename from core/java/android/content/Formatter.java rename to core/java/android/text/format/Formatter.java index 8ad9f40f9a680..1b30aa0a218c3 100644 --- a/core/java/android/content/Formatter.java +++ b/core/java/android/text/format/Formatter.java @@ -14,18 +14,18 @@ * limitations under the License. */ -package android.content; +package android.text.format; + +import android.content.Context; /** * Utility class to aid in formatting common values that are not covered - * by the standard java.util.Formatter - * @hide + * by the standard java.util.Formatter. */ public final class Formatter { /** - * Formats a content size to be in the form of bytes, kilobytes, - * megabytes, etc + * Formats a content size to be in the form of bytes, kilobytes, megabytes, etc * * @param context Context to use to load the localized units * @param number size value to be formated @@ -63,4 +63,21 @@ public final class Formatter { } return String.format("%.0f%s", result, context.getText(suffix).toString()); } + + /** + * Returns a string in the canonical IP format ###.###.###.### from a packed integer containing + * the IP address. The IP address is expected to be in little-endian format (LSB first). That + * is, 0x01020304 will return "4.3.2.1". + * + * @param addr the IP address as a packed integer with LSB first. + * @return string with canonical IP address format. + */ + public static String formatIpAddress(int addr) { + StringBuffer buf = new StringBuffer(); + buf.append(addr & 0xff).append('.'). + append((addr >>>= 8) & 0xff).append('.'). + append((addr >>>= 8) & 0xff).append('.'). + append((addr >>>= 8) & 0xff); + return buf.toString(); + } } diff --git a/core/java/android/pim/Time.java b/core/java/android/text/format/Time.java similarity index 64% rename from core/java/android/pim/Time.java rename to core/java/android/text/format/Time.java index 59ba87b48368d..5bf9b205a6c68 100644 --- a/core/java/android/pim/Time.java +++ b/core/java/android/text/format/Time.java @@ -14,15 +14,14 @@ * limitations under the License. */ -package android.pim; - +package android.text.format; +import android.content.res.Resources; +import java.util.Locale; import java.util.TimeZone; /** - * {@hide} - * * The Time class is a faster replacement for the java.util.Calendar and * java.util.GregorianCalendar classes. An instance of the Time class represents * a moment in time, specified with second precision. It is modelled after @@ -30,6 +29,10 @@ import java.util.TimeZone; * functionality. */ public class Time { + private static final String Y_M_D_T_H_M_S_000 = "%Y-%m-%dT%H:%M:%S.000"; + private static final String Y_M_D_T_H_M_S_000_Z = "%Y-%m-%dT%H:%M:%S.000Z"; + private static final String Y_M_D = "%Y-%m-%d"; + public static final String TIMEZONE_UTC = "UTC"; /** @@ -90,6 +93,7 @@ public class Time { *
    • positive - in dst
    • *
    • 0 - not in dst
    • *
    • negative - unknown
    • + *
    */ public int isDst; @@ -125,9 +129,26 @@ public class Time { public static final int FRIDAY = 5; public static final int SATURDAY = 6; + /* + * The Locale for which date formatting strings have been loaded. + */ + private static Locale sLocale; + private static String[] sShortMonths; + private static String[] sLongMonths; + private static String[] sShortWeekdays; + private static String[] sLongWeekdays; + private static String sTimeOnlyFormat; + private static String sDateOnlyFormat; + private static String sDateTimeFormat; + private static String sAm; + private static String sPm; + private static String sDateCommand = "%a %b %e %H:%M:%S %Z %Y"; + /** * Construct a Time object in the timezone named by the string * argument "timezone". The time is initialized to Jan 1, 1970. + * @param timezone string containing the timezone to use. + * @see TimeZone */ public Time(String timezone) { if (timezone == null) { @@ -142,7 +163,7 @@ public class Time { } /** - * Construct a Time object in the local timezone. The time is initialized to + * Construct a Time object in the default timezone. The time is initialized to * Jan 1, 1970. */ public Time() { @@ -191,6 +212,8 @@ public class Time { * Return the maximum possible value for the given field given the value of * the other fields. Requires that it be normalized for MONTH_DAY and * YEAR_DAY. + * @param field one of the constants for HOUR, MINUTE, SECOND, etc. + * @return the maximum value for the field. */ public int getActualMaximum(int field) { switch (field) { @@ -230,6 +253,7 @@ public class Time { /** * Clears all values, setting the timezone to the given timezone. Sets isDst * to a negative value to mean "unknown". + * @param timezone the timezone to use. */ public void clear(String timezone) { if (timezone == null) { @@ -259,8 +283,76 @@ public class Time { * Print the current value given the format string provided. See man * strftime for what means what. The final string must be less than 256 * characters. - */ - native public String format(String format); + * @param format a string containing the desired format. + * @return a String containing the current time expressed in the current locale. + */ + public String format(String format) { + synchronized (Time.class) { + Locale locale = Locale.getDefault(); + + if (sLocale == null || locale == null || !(locale.equals(sLocale))) { + Resources r = Resources.getSystem(); + + sShortMonths = new String[] { + r.getString(com.android.internal.R.string.month_medium_january), + r.getString(com.android.internal.R.string.month_medium_february), + r.getString(com.android.internal.R.string.month_medium_march), + r.getString(com.android.internal.R.string.month_medium_april), + r.getString(com.android.internal.R.string.month_medium_may), + r.getString(com.android.internal.R.string.month_medium_june), + r.getString(com.android.internal.R.string.month_medium_july), + r.getString(com.android.internal.R.string.month_medium_august), + r.getString(com.android.internal.R.string.month_medium_september), + r.getString(com.android.internal.R.string.month_medium_october), + r.getString(com.android.internal.R.string.month_medium_november), + r.getString(com.android.internal.R.string.month_medium_december), + }; + sLongMonths = new String[] { + r.getString(com.android.internal.R.string.month_long_january), + r.getString(com.android.internal.R.string.month_long_february), + r.getString(com.android.internal.R.string.month_long_march), + r.getString(com.android.internal.R.string.month_long_april), + r.getString(com.android.internal.R.string.month_long_may), + r.getString(com.android.internal.R.string.month_long_june), + r.getString(com.android.internal.R.string.month_long_july), + r.getString(com.android.internal.R.string.month_long_august), + r.getString(com.android.internal.R.string.month_long_september), + r.getString(com.android.internal.R.string.month_long_october), + r.getString(com.android.internal.R.string.month_long_november), + r.getString(com.android.internal.R.string.month_long_december), + }; + sShortWeekdays = new String[] { + r.getString(com.android.internal.R.string.day_of_week_medium_sunday), + r.getString(com.android.internal.R.string.day_of_week_medium_monday), + r.getString(com.android.internal.R.string.day_of_week_medium_tuesday), + r.getString(com.android.internal.R.string.day_of_week_medium_wednesday), + r.getString(com.android.internal.R.string.day_of_week_medium_thursday), + r.getString(com.android.internal.R.string.day_of_week_medium_friday), + r.getString(com.android.internal.R.string.day_of_week_medium_saturday), + }; + sLongWeekdays = new String[] { + r.getString(com.android.internal.R.string.day_of_week_long_sunday), + r.getString(com.android.internal.R.string.day_of_week_long_monday), + r.getString(com.android.internal.R.string.day_of_week_long_tuesday), + r.getString(com.android.internal.R.string.day_of_week_long_wednesday), + r.getString(com.android.internal.R.string.day_of_week_long_thursday), + r.getString(com.android.internal.R.string.day_of_week_long_friday), + r.getString(com.android.internal.R.string.day_of_week_long_saturday), + }; + sTimeOnlyFormat = r.getString(com.android.internal.R.string.time_of_day); + sDateOnlyFormat = r.getString(com.android.internal.R.string.month_day_year); + sDateTimeFormat = r.getString(com.android.internal.R.string.date_and_time); + sAm = r.getString(com.android.internal.R.string.am); + sPm = r.getString(com.android.internal.R.string.pm); + + sLocale = locale; + } + + return format1(format); + } + } + + native private String format1(String format); /** * Return the current time in YYYYMMDDTHHMMSS format @@ -269,33 +361,79 @@ public class Time { native public String toString(); /** - * Parse a time in the current zone in YYYYMMDDTHHMMSS format. - */ - native public void parse(String s); - - /** - * Parse a time in RFC 2445 format. Returns whether or not the time is in - * UTC (ends with Z). + * Parses a date-time string in either the RFC 2445 format or an abbreviated + * format that does not include the "time" field. For example, all of the + * following strings are valid: + * + *
      + *
    • "20081013T160000Z"
    • + *
    • "20081013T160000"
    • + *
    • "20081013"
    • + *
    + * + * Returns whether or not the time is in UTC (ends with Z). If the string + * ends with "Z" then the timezone is set to UTC. If the date-time string + * included only a date and no time field, then the allDay + * field of this Time class is set to true and the hour, + * minute, and second fields are set to zero; + * otherwise (a time field was included in the date-time string) + * allDay is set to false. The fields weekDay, + * yearDay, and gmtoff are always set to zero, + * and the field isDst is set to -1 (unknown). To set those + * fields, call {@link #normalize(boolean)} after parsing. + * + * To parse a date-time string and convert it to UTC milliseconds, do + * something like this: + * + *
    +     *   Time time = new Time();
    +     *   String date = "20081013T160000Z";
    +     *   time.parse(date);
    +     *   long millis = time.normalize(false);
    +     * 
    * * @param s the string to parse * @return true if the resulting time value is in UTC time */ - public boolean parse2445(String s) { - if (nativeParse2445(s)) { + public boolean parse(String s) { + if (nativeParse(s)) { timezone = TIMEZONE_UTC; return true; } return false; } - native private boolean nativeParse2445(String s); + /** + * Parse a time in the current zone in YYYYMMDDTHHMMSS format. + */ + native private boolean nativeParse(String s); /** * Parse a time in RFC 3339 format. This method also parses simple dates - * (that is, strings that contain no time or time offset). If the string - * contains a time and time offset, then the time offset will be used to - * convert the time value to UTC. + * (that is, strings that contain no time or time offset). For example, + * all of the following strings are valid: + * + *
      + *
    • "2008-10-13T16:00:00.000Z"
    • + *
    • "2008-10-13T16:00:00.000+07:00"
    • + *
    • "2008-10-13T16:00:00.000-07:00"
    • + *
    • "2008-10-13"
    • + *
    + * + *

    + * If the string contains a time and time offset, then the time offset will + * be used to convert the time value to UTC. + *

    + * + *

    + * If the given string contains just a date (with no time field), then + * the {@link #allDay} field is set to true and the {@link #hour}, + * {@link #minute}, and {@link #second} fields are set to zero. + *

    + * + *

    * Returns true if the resulting time value is in UTC time. + *

    * * @param s the string to parse * @return true if the resulting time value is in UTC time @@ -408,8 +546,8 @@ public class Time { } /** - * Set the fields. Sets weekDay, yearDay and gmtoff to 0. Call - * normalize() if you need those. + * Sets the fields. Sets weekDay, yearDay and gmtoff to 0, and isDst to -1. + * Call {@link #normalize(boolean)} if you need those. */ public void set(int second, int minute, int hour, int monthDay, int month, int year) { this.allDay = false; @@ -425,6 +563,15 @@ public class Time { this.gmtoff = 0; } + /** + * Sets the date from the given fields. Also sets allDay to true. + * Sets weekDay, yearDay and gmtoff to 0, and isDst to -1. + * Call {@link #normalize(boolean)} if you need those. + * + * @param monthDay the day of the month (in the range [1,31]) + * @param month the zero-based month number (in the range [0,11]) + * @param year the year + */ public void set(int monthDay, int month, int year) { this.allDay = true; this.second = 0; @@ -439,10 +586,25 @@ public class Time { this.gmtoff = 0; } + /** + * Returns true if the time represented by this Time object occurs before + * the given time. + * + * @param that a given Time object to compare against + * @return true if this time is less than the given time + */ public boolean before(Time that) { return Time.compare(this, that) < 0; } + + /** + * Returns true if the time represented by this Time object occurs after + * the given time. + * + * @param that a given Time object to compare against + * @return true if this time is greater than the given time + */ public boolean after(Time that) { return Time.compare(this, that) > 0; } @@ -459,14 +621,18 @@ public class Time { * object must already be normalized because this method uses the * yearDay and weekDay fields. * + *

    * In IS0 8601, weeks start on Monday. * The first week of the year (week 1) is defined by ISO 8601 as the * first week with four or more of its days in the starting year. * Or equivalently, the week containing January 4. Or equivalently, * the week with the year's first Thursday in it. + *

    * + *

    * The week number can be calculated by counting Thursdays. Week N * contains the Nth Thursday of the year. + *

    * * @return the ISO week number. */ @@ -486,13 +652,24 @@ public class Time { return temp.yearDay / 7 + 1; } + /** + * Return a string in the RFC 3339 format. + *

    + * If allDay is true, expresses the time as Y-M-D

    + *

    + * Otherwise, if the timezone is UTC, expresses the time as Y-M-D-T-H-M-S UTC

    + *

    + * Otherwise the time is expressed the time as Y-M-D-T-H-M-S +- GMT

    + * @param allDay + * @return string in the RFC 3339 format. + */ public String format3339(boolean allDay) { if (allDay) { - return format("%Y-%m-%d"); + return format(Y_M_D); } else if (TIMEZONE_UTC.equals(timezone)) { - return format("%Y-%m-%dT%H:%M:%S.000Z"); + return format(Y_M_D_T_H_M_S_000_Z); } else { - String base = format("%Y-%m-%dT%H:%M:%S.000"); + String base = format(Y_M_D_T_H_M_S_000); String sign = (gmtoff < 0) ? "-" : "+"; int offset = (int)Math.abs(gmtoff); int minutes = (offset % 3600) / 60; @@ -502,6 +679,13 @@ public class Time { } } + /** + * Returns true if the day of the given time is the epoch on the Julian Calendar + * (January 1, 1970 on the Gregorian calendar). + * + * @param time the time to test + * @return true if epoch. + */ public static boolean isEpoch(Time time) { long millis = time.toMillis(true); return getJulianDay(millis, 0) == EPOCH_JULIAN_DAY; @@ -536,6 +720,7 @@ public class Time { * GMT offset than whatever is currently stored in this Time object anyway. * After this method returns all the fields will be normalized and the time * will be set to 12am at the beginning of the given Julian day. + *

    * *

    * The only exception to this is if 12am does not exist for that day because @@ -543,6 +728,7 @@ public class Time { * hour at 12am on April 25, 2008 and there are a few other places that * also change daylight saving time at 12am. In those cases, the time * will be set to 1am. + *

    * * @param julianDay the Julian day in the timezone for this Time object * @return the UTC milliseconds for the beginning of the Julian day diff --git a/core/java/android/text/method/ArrowKeyMovementMethod.java b/core/java/android/text/method/ArrowKeyMovementMethod.java index ac2e499c4a8c9..652413eb168ab 100644 --- a/core/java/android/text/method/ArrowKeyMovementMethod.java +++ b/core/java/android/text/method/ArrowKeyMovementMethod.java @@ -155,34 +155,11 @@ implements MovementMethod return false; } - public boolean onTrackballEvent(TextView widget, Spannable buffer, - MotionEvent event) { - boolean handled = false; - int x = (int) event.getX(); - int y = (int) event.getY(); - - for (; y < 0; y++) { - handled |= up(widget, buffer); - } - for (; y > 0; y--) { - handled |= down(widget, buffer); - } - - for (; x < 0; x++) { - handled |= left(widget, buffer); - } - for (; x > 0; x--) { - handled |= right(widget, buffer); - } - - if (handled) { - MetaKeyKeyListener.adjustMetaAfterKeypress(buffer); - MetaKeyKeyListener.resetLockedMeta(buffer); - } - - return handled; + public boolean onTrackballEvent(TextView widget, Spannable text, + MotionEvent event) { + return false; } - + public boolean onTouchEvent(TextView widget, Spannable buffer, MotionEvent event) { boolean handled = Touch.onTouchEvent(widget, buffer, event); diff --git a/core/java/android/text/method/BaseKeyListener.java b/core/java/android/text/method/BaseKeyListener.java index 3e92b7b5ae6f7..a875368834490 100644 --- a/core/java/android/text/method/BaseKeyListener.java +++ b/core/java/android/text/method/BaseKeyListener.java @@ -18,9 +18,9 @@ package android.text.method; import android.view.KeyEvent; import android.view.View; -import android.os.Message; -import android.util.Log; +import android.text.InputType; import android.text.*; +import android.text.method.TextKeyListener.Capitalize; import android.widget.TextView; public abstract class BaseKeyListener @@ -99,6 +99,25 @@ implements KeyListener { return true; } + static int makeTextContentType(Capitalize caps, boolean autoText) { + int contentType = InputType.TYPE_CLASS_TEXT; + switch (caps) { + case CHARACTERS: + contentType |= InputType.TYPE_TEXT_FLAG_CAP_CHARACTERS; + break; + case WORDS: + contentType |= InputType.TYPE_TEXT_FLAG_CAP_WORDS; + break; + case SENTENCES: + contentType |= InputType.TYPE_TEXT_FLAG_CAP_SENTENCES; + break; + } + if (autoText) { + contentType |= InputType.TYPE_TEXT_FLAG_AUTO_CORRECT; + } + return contentType; + } + public boolean onKeyDown(View view, Editable content, int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_DEL) { diff --git a/core/java/android/text/method/CharacterPickerDialog.java b/core/java/android/text/method/CharacterPickerDialog.java index d787132fa9d4d..3c40675118049 100644 --- a/core/java/android/text/method/CharacterPickerDialog.java +++ b/core/java/android/text/method/CharacterPickerDialog.java @@ -69,7 +69,7 @@ public class CharacterPickerDialog extends Dialog WindowManager.LayoutParams params = getWindow().getAttributes(); params.token = mView.getApplicationWindowToken(); - params.type = params.TYPE_APPLICATION_PANEL; + params.type = params.TYPE_APPLICATION_ATTACHED_DIALOG; setTitle(R.string.select_character); setContentView(R.layout.character_picker); diff --git a/core/java/android/text/method/DateKeyListener.java b/core/java/android/text/method/DateKeyListener.java index 0ca0332540f79..7c114344537e3 100644 --- a/core/java/android/text/method/DateKeyListener.java +++ b/core/java/android/text/method/DateKeyListener.java @@ -17,12 +17,18 @@ package android.text.method; import android.view.KeyEvent; +import android.text.InputType; /** * For entering dates in a text field. */ public class DateKeyListener extends NumberKeyListener { + public int getInputType() { + return InputType.TYPE_CLASS_DATETIME + | InputType.TYPE_DATETIME_VARIATION_DATE; + } + @Override protected char[] getAcceptedChars() { diff --git a/core/java/android/text/method/DateTimeKeyListener.java b/core/java/android/text/method/DateTimeKeyListener.java index 304d3261b043f..f8ebc406719e3 100644 --- a/core/java/android/text/method/DateTimeKeyListener.java +++ b/core/java/android/text/method/DateTimeKeyListener.java @@ -16,6 +16,7 @@ package android.text.method; +import android.text.InputType; import android.view.KeyEvent; /** @@ -23,6 +24,11 @@ import android.view.KeyEvent; */ public class DateTimeKeyListener extends NumberKeyListener { + public int getInputType() { + return InputType.TYPE_CLASS_DATETIME + | InputType.TYPE_DATETIME_VARIATION_NORMAL; + } + @Override protected char[] getAcceptedChars() { diff --git a/core/java/android/text/method/DialerKeyListener.java b/core/java/android/text/method/DialerKeyListener.java index e805ad7a42cf5..b121e608b5b54 100644 --- a/core/java/android/text/method/DialerKeyListener.java +++ b/core/java/android/text/method/DialerKeyListener.java @@ -18,7 +18,7 @@ package android.text.method; import android.view.KeyEvent; import android.view.KeyCharacterMap.KeyData; -import android.util.SparseIntArray; +import android.text.InputType; import android.text.Spannable; /** @@ -40,6 +40,10 @@ public class DialerKeyListener extends NumberKeyListener return sInstance; } + public int getInputType() { + return InputType.TYPE_CLASS_PHONE; + } + /** * Overrides the superclass's lookup method to prefer the number field * from the KeyEvent. diff --git a/core/java/android/text/method/DigitsKeyListener.java b/core/java/android/text/method/DigitsKeyListener.java index 99a3f1ad1b0ec..f0f072c16ae9c 100644 --- a/core/java/android/text/method/DigitsKeyListener.java +++ b/core/java/android/text/method/DigitsKeyListener.java @@ -16,6 +16,7 @@ package android.text.method; +import android.text.InputType; import android.text.Spanned; import android.text.SpannableStringBuilder; import android.view.KeyEvent; @@ -109,6 +110,17 @@ public class DigitsKeyListener extends NumberKeyListener return dim; } + public int getInputType() { + int contentType = InputType.TYPE_CLASS_NUMBER; + if (mSign) { + contentType |= InputType.TYPE_NUMBER_FLAG_SIGNED; + } + if (mDecimal) { + contentType |= InputType.TYPE_NUMBER_FLAG_DECIMAL; + } + return contentType; + } + @Override public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart, int dend) { diff --git a/core/java/android/text/method/KeyListener.java b/core/java/android/text/method/KeyListener.java index 05ab72d630543..4ae6191ef69e8 100644 --- a/core/java/android/text/method/KeyListener.java +++ b/core/java/android/text/method/KeyListener.java @@ -16,14 +16,39 @@ package android.text.method; +import android.text.Editable; import android.view.KeyEvent; import android.view.View; -import android.os.Message; -import android.text.*; -import android.widget.TextView; -public interface KeyListener -{ +/** + * Interface for converting text key events into edit operations on an + * Editable class. Note that for must cases this interface has been + * superceded by general soft input methods as defined by + * {@link android.view.inputmethod.InputMethod}; it should only be used + * for cases where an application has its own on-screen keypad and also wants + * to process hard keyboard events to match it. + */ +public interface KeyListener { + /** + * Return the type of text that this key listener is manipulating, + * as per {@link android.text.InputType}. This is used to + * determine the mode of the soft keyboard that is shown for the editor. + * + *

    If you return + * {@link android.text.InputType#TYPE_NULL} + * then no soft keyboard will provided. In other words, you + * must be providing your own key pad for on-screen input and the key + * listener will be used to handle input from a hard keyboard. + * + *

    If you + * return any other value, a soft input method will be created when the + * user puts focus in the editor, which will provide a keypad and also + * consume hard key events. This means that the key listener will generally + * not be used, instead the soft input method will take care of managing + * key input as per the content type returned here. + */ + public int getInputType(); + /** * If the key listener wants to handle this key, return true, * otherwise return false and the caller (i.e. the widget host) @@ -39,4 +64,9 @@ public interface KeyListener */ public boolean onKeyUp(View view, Editable text, int keyCode, KeyEvent event); + + /** + * Remove the given shift states from the edited text. + */ + public void clearMetaKeyState(View view, Editable content, int states); } diff --git a/core/java/android/text/method/MetaKeyKeyListener.java b/core/java/android/text/method/MetaKeyKeyListener.java index 2d75b87318331..f0305d9480e26 100644 --- a/core/java/android/text/method/MetaKeyKeyListener.java +++ b/core/java/android/text/method/MetaKeyKeyListener.java @@ -221,6 +221,12 @@ public abstract class MetaKeyKeyListener { content.setSpan(what, 0, 0, RELEASED); } + public void clearMetaKeyState(View view, Editable content, int states) { + if ((states&META_SHIFT_ON) != 0) resetLock(content, CAP); + if ((states&META_ALT_ON) != 0) resetLock(content, ALT); + if ((states&META_SYM_ON) != 0) resetLock(content, SYM); + } + /** * The meta key has been pressed but has not yet been used. */ diff --git a/core/java/android/text/method/MultiTapKeyListener.java b/core/java/android/text/method/MultiTapKeyListener.java index 7137d40783ace..6d94788d3b5bf 100644 --- a/core/java/android/text/method/MultiTapKeyListener.java +++ b/core/java/android/text/method/MultiTapKeyListener.java @@ -18,14 +18,11 @@ package android.text.method; import android.view.KeyEvent; import android.view.View; -import android.os.Message; import android.os.Handler; import android.os.SystemClock; import android.text.*; import android.text.method.TextKeyListener.Capitalize; -import android.widget.TextView; import android.util.SparseArray; -import android.util.SparseIntArray; /** * This is the standard key listener for alphabetic input on 12-key @@ -77,6 +74,10 @@ public class MultiTapKeyListener extends BaseKeyListener return sInstance[off]; } + public int getInputType() { + return makeTextContentType(mCapitalize, mAutoText); + } + public boolean onKeyDown(View view, Editable content, int keyCode, KeyEvent event) { int selStart, selEnd; diff --git a/core/java/android/text/method/QwertyKeyListener.java b/core/java/android/text/method/QwertyKeyListener.java index ae7ba8f0ebb38..863b2e2deacdd 100644 --- a/core/java/android/text/method/QwertyKeyListener.java +++ b/core/java/android/text/method/QwertyKeyListener.java @@ -58,6 +58,10 @@ public class QwertyKeyListener extends BaseKeyListener { return sInstance[off]; } + public int getInputType() { + return makeTextContentType(mAutoCap, mAutoText); + } + public boolean onKeyDown(View view, Editable content, int keyCode, KeyEvent event) { int selStart, selEnd; @@ -219,7 +223,7 @@ public class QwertyKeyListener extends BaseKeyListener { if ((pref & TextKeyListener.AUTO_TEXT) != 0 && mAutoText && (i == ' ' || i == '\t' || i == '\n' || i == ',' || i == '.' || i == '!' || i == '?' || - i == '"' || i == ')' || i == ']') && + i == '"' || Character.getType(i) == Character.END_PUNCTUATION) && content.getSpanEnd(TextKeyListener.INHIBIT_REPLACEMENT) != oldStart) { int x; @@ -257,7 +261,16 @@ public class QwertyKeyListener extends BaseKeyListener { content.charAt(selEnd - 2) == ' ') { char c = content.charAt(selEnd - 3); - if (Character.isLetter(c)) { + for (int j = selEnd - 3; j > 0; j--) { + if (c == '"' || + Character.getType(c) == Character.END_PUNCTUATION) { + c = content.charAt(j - 1); + } else { + break; + } + } + + if (Character.isLetter(c) || Character.isDigit(c)) { content.replace(selEnd - 2, selEnd - 1, "."); } } diff --git a/core/java/android/text/method/ScrollingMovementMethod.java b/core/java/android/text/method/ScrollingMovementMethod.java index 0438e1efe3c9a..db470beed0a39 100644 --- a/core/java/android/text/method/ScrollingMovementMethod.java +++ b/core/java/android/text/method/ScrollingMovementMethod.java @@ -171,34 +171,16 @@ implements MovementMethod return false; } + public boolean onTrackballEvent(TextView widget, Spannable text, + MotionEvent event) { + return false; + } + public boolean onTouchEvent(TextView widget, Spannable buffer, MotionEvent event) { return Touch.onTouchEvent(widget, buffer, event); } - public boolean onTrackballEvent(TextView widget, Spannable buffer, - MotionEvent event) { - boolean handled = false; - int x = (int) event.getX(); - int y = (int) event.getY(); - - for (; y < 0; y++) { - handled |= up(widget, buffer); - } - for (; y > 0; y--) { - handled |= down(widget, buffer); - } - - for (; x < 0; x++) { - handled |= left(widget, buffer); - } - for (; x > 0; x--) { - handled |= right(widget, buffer); - } - - return handled; - } - public void initialize(TextView widget, Spannable text) { } public boolean canSelectArbitrarily() { diff --git a/core/java/android/text/method/TextKeyListener.java b/core/java/android/text/method/TextKeyListener.java index 012e41d5e97cf..b1c380ab70e33 100644 --- a/core/java/android/text/method/TextKeyListener.java +++ b/core/java/android/text/method/TextKeyListener.java @@ -26,6 +26,7 @@ import android.text.*; import android.view.KeyCharacterMap; import android.view.KeyEvent; import android.view.View; +import android.text.InputType; import java.lang.ref.WeakReference; @@ -114,76 +115,15 @@ public class TextKeyListener extends BaseKeyListener implements SpanWatcher { return true; } - // Back over allowed opening punctuation. - - for (i = off; i > 0; i--) { - c = cs.charAt(i - 1); - - if (c != '"' && c != '(' && c != '[' && c != '\'') { - break; - } - } - - // Start of paragraph, with optional whitespace. - - int j = i; - while (j > 0 && ((c = cs.charAt(j - 1)) == ' ' || c == '\t')) { - j--; - } - if (j == 0 || cs.charAt(j - 1) == '\n') { - return true; - } - - // Or start of word if we are that style. - - if (cap == Capitalize.WORDS) { - return i != j; - } - - // There must be a space if not the start of paragraph. - - if (i == j) { - return false; - } - - // Back over allowed closing punctuation. - - for (; j > 0; j--) { - c = cs.charAt(j - 1); - - if (c != '"' && c != ')' && c != ']' && c != '\'') { - break; - } - } - - if (j > 0) { - c = cs.charAt(j - 1); - - if (c == '.' || c == '?' || c == '!') { - // Do not capitalize if the word ends with a period but - // also contains a period, in which case it is an abbreviation. - - if (c == '.') { - for (int k = j - 2; k >= 0; k--) { - c = cs.charAt(k); - - if (c == '.') { - return false; - } - - if (!Character.isLetter(c)) { - break; - } - } - } - - return true; - } - } - - return false; + return TextUtils.getCapsMode(cs, off, cap == Capitalize.WORDS + ? TextUtils.CAP_MODE_WORDS : TextUtils.CAP_MODE_SENTENCES) + != 0; } + public int getInputType() { + return makeTextContentType(mAutoCap, mAutoText); + } + @Override public boolean onKeyDown(View view, Editable content, int keyCode, KeyEvent event) { @@ -251,6 +191,10 @@ public class TextKeyListener extends BaseKeyListener implements SpanWatcher { private static class NullKeyListener implements KeyListener { + public int getInputType() { + return InputType.TYPE_NULL; + } + public boolean onKeyDown(View view, Editable content, int keyCode, KeyEvent event) { return false; @@ -261,6 +205,9 @@ public class TextKeyListener extends BaseKeyListener implements SpanWatcher { return false; } + public void clearMetaKeyState(View view, Editable content, int states) { + } + public static NullKeyListener getInstance() { if (sInstance != null) return sInstance; diff --git a/core/java/android/text/method/TimeKeyListener.java b/core/java/android/text/method/TimeKeyListener.java index 9ba1fe6439426..3fbfd8c10a4cb 100644 --- a/core/java/android/text/method/TimeKeyListener.java +++ b/core/java/android/text/method/TimeKeyListener.java @@ -17,12 +17,18 @@ package android.text.method; import android.view.KeyEvent; +import android.text.InputType; /** * For entering times in a text field. */ public class TimeKeyListener extends NumberKeyListener { + public int getInputType() { + return InputType.TYPE_CLASS_DATETIME + | InputType.TYPE_DATETIME_VARIATION_TIME; + } + @Override protected char[] getAcceptedChars() { diff --git a/core/java/android/text/method/Touch.java b/core/java/android/text/method/Touch.java index bd017289f2b53..8b097c5b3fa25 100644 --- a/core/java/android/text/method/Touch.java +++ b/core/java/android/text/method/Touch.java @@ -17,6 +17,7 @@ package android.text.method; import android.text.Layout; +import android.text.Layout.Alignment; import android.text.Spannable; import android.view.MotionEvent; import android.view.View; @@ -41,15 +42,31 @@ public class Touch { int left = Integer.MAX_VALUE; int right = 0; + Alignment a = null; for (int i = top; i <= bottom; i++) { left = (int) Math.min(left, layout.getLineLeft(i)); right = (int) Math.max(right, layout.getLineRight(i)); + + if (a == null) { + a = layout.getParagraphAlignment(i); + } } padding = widget.getTotalPaddingLeft() + widget.getTotalPaddingRight(); - x = Math.min(x, right - (widget.getWidth() - padding)); - x = Math.max(x, left); + int width = widget.getWidth(); + int diff = 0; + + if (right - left < width - padding) { + if (a == Alignment.ALIGN_CENTER) { + diff = (width - padding - (right - left)) / 2; + } else if (a == Alignment.ALIGN_OPPOSITE) { + diff = width - padding - (right - left); + } + } + + x = Math.min(x, right - (width - padding) - diff); + x = Math.max(x, left - diff); widget.scrollTo(x, y); } diff --git a/core/java/android/text/style/DynamicDrawableSpan.java b/core/java/android/text/style/DynamicDrawableSpan.java index 3bcc335a1d542..dd89b68a88855 100644 --- a/core/java/android/text/style/DynamicDrawableSpan.java +++ b/core/java/android/text/style/DynamicDrawableSpan.java @@ -16,11 +16,12 @@ package android.text.style; -import java.lang.ref.WeakReference; - -import android.graphics.drawable.Drawable; import android.graphics.Canvas; import android.graphics.Paint; +import android.graphics.Rect; +import android.graphics.drawable.Drawable; + +import java.lang.ref.WeakReference; /** * @@ -35,48 +36,51 @@ extends ReplacementSpan */ public abstract Drawable getDrawable(); + @Override public int getSize(Paint paint, CharSequence text, int start, int end, Paint.FontMetricsInt fm) { - Drawable b = getCachedDrawable(); + Drawable d = getCachedDrawable(); + Rect rect = d.getBounds(); if (fm != null) { - fm.ascent = -b.getIntrinsicHeight(); - fm.descent = 0; + fm.ascent = -rect.bottom; + fm.descent = 0; fm.top = fm.ascent; fm.bottom = 0; } - return b.getIntrinsicWidth(); + return rect.right; } + @Override public void draw(Canvas canvas, CharSequence text, int start, int end, float x, int top, int y, int bottom, Paint paint) { Drawable b = getCachedDrawable(); canvas.save(); - canvas.translate(x, bottom-b.getIntrinsicHeight());; + canvas.translate(x, bottom - b.getBounds().bottom); b.draw(canvas); canvas.restore(); } private Drawable getCachedDrawable() { - WeakReference wr = mDrawableRef; - Drawable b = null; + WeakReference wr = mDrawableRef; + Drawable d = null; if (wr != null) - b = (Drawable) wr.get(); + d = wr.get(); - if (b == null) { - b = getDrawable(); - mDrawableRef = new WeakReference(b); + if (d == null) { + d = getDrawable(); + mDrawableRef = new WeakReference(d); } - return b; + return d; } - private WeakReference mDrawableRef; + private WeakReference mDrawableRef; } diff --git a/core/java/android/text/util/Linkify.java b/core/java/android/text/util/Linkify.java index 79ecfbda0160a..d61e888e18158 100644 --- a/core/java/android/text/util/Linkify.java +++ b/core/java/android/text/util/Linkify.java @@ -69,7 +69,7 @@ public class Linkify { public static final int PHONE_NUMBERS = 0x04; /** - * Bit field indicating that phone numbers should be matched in methods that + * Bit field indicating that street addresses should be matched in methods that * take an options mask */ public static final int MAP_ADDRESSES = 0x08; @@ -78,8 +78,7 @@ public class Linkify { * Bit mask indicating that all available patterns should be matched in * methods that take an options mask */ - public static final int ALL = WEB_URLS | EMAIL_ADDRESSES | PHONE_NUMBERS - | MAP_ADDRESSES; + public static final int ALL = WEB_URLS | EMAIL_ADDRESSES | PHONE_NUMBERS | MAP_ADDRESSES; /** * Don't treat anything with fewer than this many digits as a @@ -109,8 +108,7 @@ public class Linkify { * Filters out URL matches that don't have enough digits to be a * phone number. */ - public static final MatchFilter sPhoneNumberMatchFilter = - new MatchFilter() { + public static final MatchFilter sPhoneNumberMatchFilter = new MatchFilter() { public final boolean acceptMatch(CharSequence s, int start, int end) { int digitCount = 0; @@ -133,8 +131,7 @@ public class Linkify { * '+1 (919) 555-1212' * becomes '+19195551212' */ - public static final TransformFilter sPhoneNumberTransformFilter = - new TransformFilter() { + public static final TransformFilter sPhoneNumberTransformFilter = new TransformFilter() { public final String transformUrl(final Matcher match, String url) { return Regex.digitsAndPlusOnly(match); } @@ -300,8 +297,7 @@ public class Linkify { * prepended to the url of links that do not have * a scheme specified in the link text */ - public static final void addLinks(TextView text, Pattern pattern, - String scheme) { + public static final void addLinks(TextView text, Pattern pattern, String scheme) { addLinks(text, pattern, scheme, null, null); } @@ -341,8 +337,7 @@ public class Linkify { * prepended to the url of links that do not have * a scheme specified in the link text */ - public static final boolean addLinks(Spannable text, Pattern pattern, - String scheme) { + public static final boolean addLinks(Spannable text, Pattern pattern, String scheme) { return addLinks(text, pattern, scheme, null, null); } @@ -388,8 +383,7 @@ public class Linkify { return hasMatches; } - private static final void applyLink(String url, int start, int end, - Spannable text) { + private static final void applyLink(String url, int start, int end, Spannable text) { URLSpan span = new URLSpan(url); text.setSpan(span, start, end, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); @@ -402,13 +396,22 @@ public class Linkify { } boolean hasPrefix = false; + for (int i = 0; i < prefixes.length; i++) { if (url.regionMatches(true, 0, prefixes[i], 0, prefixes[i].length())) { hasPrefix = true; + + // Fix capitalization if necessary + if (!url.regionMatches(false, 0, prefixes[i], 0, + prefixes[i].length())) { + url = prefixes[i] + url.substring(prefixes[i].length()); + } + break; } } + if (!hasPrefix) { url = prefixes[0] + url; } @@ -438,30 +441,35 @@ public class Linkify { } } - private static final void gatherMapLinks(ArrayList links, - Spannable s) { + private static final void gatherMapLinks(ArrayList links, Spannable s) { String string = s.toString(); String address; int base = 0; + while ((address = WebView.findAddress(string)) != null) { int start = string.indexOf(address); + if (start < 0) { break; } + LinkSpec spec = new LinkSpec(); int length = address.length(); int end = start + length; + spec.start = base + start; spec.end = base + end; string = string.substring(end); base += end; String encodedAddress = null; + try { encodedAddress = URLEncoder.encode(address,"UTF-8"); } catch (UnsupportedEncodingException e) { continue; } + spec.url = "geo:0,0?q=" + encodedAddress; links.add(spec); } diff --git a/core/java/android/text/util/Regex.java b/core/java/android/text/util/Regex.java index 55ad14034ffdf..4c128ad19e1f5 100644 --- a/core/java/android/text/util/Regex.java +++ b/core/java/android/text/util/Regex.java @@ -65,7 +65,7 @@ public class Regex { */ public static final Pattern WEB_URL_PATTERN = Pattern.compile( - "((?:(http|https):\\/\\/(?:(?:[a-zA-Z0-9\\$\\-\\_\\.\\+\\!\\*\\'\\(\\)" + "((?:(http|https|Http|Https):\\/\\/(?:(?:[a-zA-Z0-9\\$\\-\\_\\.\\+\\!\\*\\'\\(\\)" + "\\,\\;\\?\\&\\=]|(?:\\%[a-fA-F0-9]{2}))+(?:\\:(?:[a-zA-Z0-9\\$\\-\\_" + "\\.\\+\\!\\*\\'\\(\\)\\,\\;\\?\\&\\=]|(?:\\%[a-fA-F0-9]{2}))+)?\\@)?)?" + "((?:(?:[a-zA-Z0-9][a-zA-Z0-9\\-]*\\.)+" // named host @@ -103,7 +103,9 @@ public class Regex { + "(?:\\:\\d{1,5})?)" // plus option port number + "(\\/(?:(?:[a-zA-Z0-9\\;\\/\\?\\:\\@\\&\\=\\#\\~" // plus option query params + "\\-\\.\\+\\!\\*\\'\\(\\)\\,\\_])|(?:\\%[a-fA-F0-9]{2}))*)?" - + "\\b"); // and finally, a word boundary this is to stop foo.sure from matching as foo.su + + "(?:\\b|$)"); // and finally, a word boundary or end of + // input. This is to stop foo.sure from + // matching as foo.su public static final Pattern IP_ADDRESS_PATTERN = Pattern.compile( @@ -134,10 +136,20 @@ public class Regex { * might be phone numbers in arbitrary text, not for validating whether * something is in fact a phone number. It will miss many things that * are legitimate phone numbers. + * + *

    The pattern matches the following: + *

      + *
    • Optionally, a + sign followed immediately by one or more digits. Spaces, dots, or dashes + * may follow. + *
    • Optionally, sets of digits in parentheses, separated by spaces, dots, or dashes. + *
    • A string starting and ending with a digit, containing digits, spaces, dots, and/or dashes. + *
    */ public static final Pattern PHONE_PATTERN - = Pattern.compile( - "(?:\\+[0-9]+)|(?:[0-9()][0-9()\\- \\.][0-9()\\- \\.]+[0-9])"); + = Pattern.compile( // sdd = space, dot, or dash + "(\\+[0-9]+[\\- \\.]*)?" // +* + + "(\\([0-9]+\\)[\\- \\.]*)?" // ()* + + "([0-9][0-9\\- \\.][0-9\\- \\.]+[0-9])"); // + /** * Convenience method to take all of the non-null matching groups in a diff --git a/core/java/android/util/TimeUtils.java b/core/java/android/util/TimeUtils.java index 3c4e337e033b5..0fc70d52b878a 100644 --- a/core/java/android/util/TimeUtils.java +++ b/core/java/android/util/TimeUtils.java @@ -19,6 +19,7 @@ package android.util; import android.content.res.Resources; import android.content.res.XmlResourceParser; +import org.apache.harmony.luni.internal.util.ZoneInfoDB; import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParserException; @@ -28,14 +29,18 @@ import java.util.Date; import com.android.internal.util.XmlUtils; +/** + * A class containing utility methods related to time zones. + */ public class TimeUtils { + private static final String TAG = "TimeUtils"; + /** * Tries to return a time zone that would have had the specified offset * and DST value at the specified moment in the specified country. * Returns null if no suitable zone could be found. */ - public static TimeZone getTimeZone(int offset, boolean dst, long when, - String country) { + public static TimeZone getTimeZone(int offset, boolean dst, long when, String country) { if (country == null) { return null; } @@ -50,18 +55,18 @@ public class TimeUtils { String currentName = current.getID(); int currentOffset = current.getOffset(when); boolean currentDst = current.inDaylightTime(d); - + try { XmlUtils.beginDocument(parser, "timezones"); - + while (true) { XmlUtils.nextElement(parser); - + String element = parser.getName(); if (element == null || !(element.equals("timezone"))) { break; } - + String code = parser.getAttributeValue(null, "code"); if (country.equals(code)) { @@ -95,15 +100,34 @@ public class TimeUtils { } } } catch (XmlPullParserException e) { - Log.e("TimeUtils", - "Got exception while getting preferred time zone.", e); + Log.e(TAG, "Got exception while getting preferred time zone.", e); } catch (IOException e) { - Log.e("TimeUtils", - "Got exception while getting preferred time zone.", e); + Log.e(TAG, "Got exception while getting preferred time zone.", e); } finally { parser.close(); } - + return best; } + + /** + * Returns a String indicating the version of the time zone database currently + * in use. The format of the string is dependent on the underlying time zone + * database implementation, but will typically contain the year in which the database + * was updated plus a letter from a to z indicating changes made within that year. + * + *

    Time zone database updates should be expected to occur periodically due to + * political and legal changes that cannot be anticipated in advance. Therefore, + * when computing the UTC time for a future event, applications should be aware that + * the results may differ following a time zone database update. This method allows + * applications to detect that a database change has occurred, and to recalculate any + * cached times accordingly. + * + *

    The time zone database may be assumed to change only when the device runtime + * is restarted. Therefore, it is not necessary to re-query the database version + * during the lifetime of an activity. + */ + public static String getTimeZoneDatabaseVersion() { + return ZoneInfoDB.getVersion(); + } } diff --git a/core/java/android/view/ContextMenu.java b/core/java/android/view/ContextMenu.java index 9bfda401b0ebc..dd1d7db0e7a08 100644 --- a/core/java/android/view/ContextMenu.java +++ b/core/java/android/view/ContextMenu.java @@ -24,7 +24,7 @@ import android.widget.AdapterView; * Extension of {@link Menu} for context menus providing functionality to modify * the header of the context menu. *

    - * Context menus do not support item shortcuts, item icons, and sub menus. + * Context menus do not support item shortcuts and item icons. *

    * To show a context menu on long click, most clients will want to call * {@link Activity#registerForContextMenu} and override diff --git a/core/java/android/view/Gravity.java b/core/java/android/view/Gravity.java index ff9ab185a4a68..36d8ce615daca 100644 --- a/core/java/android/view/Gravity.java +++ b/core/java/android/view/Gravity.java @@ -23,7 +23,7 @@ import android.graphics.Rect; */ public class Gravity { - /** Contstant indicating that no gravity has been set **/ + /** Constant indicating that no gravity has been set **/ public static final int NO_GRAVITY = 0x0000; /** Raw bit indicating the gravity for an axis has been specified. */ @@ -33,6 +33,9 @@ public class Gravity public static final int AXIS_PULL_BEFORE = 0x0002; /** Raw bit controlling how the right/bottom edge is placed. */ public static final int AXIS_PULL_AFTER = 0x0004; + /** Raw bit controlling whether the right/bottom edge is clipped to its + * container, based on the gravity direction being applied. */ + public static final int AXIS_CLIP = 0x0008; /** Bits defining the horizontal axis. */ public static final int AXIS_X_SHIFT = 0; @@ -66,10 +69,18 @@ public class Gravity * and horizontal axis, not changing its size. */ public static final int CENTER = CENTER_VERTICAL|CENTER_HORIZONTAL; - /** Grow the horizontal and vertical size of the obejct if needed so it + /** Grow the horizontal and vertical size of the object if needed so it * completely fills its container. */ public static final int FILL = FILL_VERTICAL|FILL_HORIZONTAL; + /** Flag to clip the edges of the object to its container along the + * vertical axis. */ + public static final int CLIP_VERTICAL = AXIS_CLIP<>AXIS_X_SHIFT, w, container.left, container.right, xAdj); - outRect.right = outRect.left + w; + switch (gravity&((AXIS_PULL_BEFORE|AXIS_PULL_AFTER)< container.right) { + outRect.right = container.right; + } + } + break; + case AXIS_PULL_BEFORE< container.right) { + outRect.right = container.right; + } + } + break; + case AXIS_PULL_AFTER< container.bottom) { + outRect.bottom = container.bottom; + } + } + break; + case AXIS_PULL_BEFORE< container.bottom) { + outRect.bottom = container.bottom; + } + } + break; + case AXIS_PULL_AFTER< display.bottom) inoutObj.bottom = display.bottom; } else { - outRect.top = applyMovement( - gravity>>AXIS_Y_SHIFT, h, container.top, container.bottom, yAdj); - outRect.bottom = outRect.top + h; + int off = 0; + if (inoutObj.top < display.top) off = display.top-inoutObj.top; + else if (inoutObj.bottom > display.bottom) off = display.bottom-inoutObj.bottom; + if (off != 0) { + if (inoutObj.height() > (display.bottom-display.top)) { + inoutObj.top = display.top; + inoutObj.bottom = display.bottom; + } else { + inoutObj.top += off; + inoutObj.bottom += off; + } + } + } + + if ((gravity&DISPLAY_CLIP_HORIZONTAL) != 0) { + if (inoutObj.left < display.left) inoutObj.left = display.left; + if (inoutObj.right > display.right) inoutObj.right = display.right; + } else { + int off = 0; + if (inoutObj.left < display.left) off = display.left-inoutObj.left; + else if (inoutObj.right > display.right) off = display.right-inoutObj.right; + if (off != 0) { + if (inoutObj.width() > (display.right-display.left)) { + inoutObj.left = display.left; + inoutObj.right = display.right; + } else { + inoutObj.left += off; + inoutObj.right += off; + } + } } } - + /** *

    Indicate whether the supplied gravity has a vertical pull.

    * @@ -162,18 +303,4 @@ public class Gravity public static boolean isHorizontal(int gravity) { return gravity > 0 && (gravity & HORIZONTAL_GRAVITY_MASK) != 0; } - - private static int applyMovement(int mode, int size, - int start, int end, int adj) { - if ((mode & AXIS_PULL_BEFORE) != 0) { - return start + adj; - } - - if ((mode & AXIS_PULL_AFTER) != 0) { - return end - size - adj; - } - - return start + ((end - start - size)/2) + adj; - } } - diff --git a/core/java/android/view/IWindow.aidl b/core/java/android/view/IWindow.aidl index b4a3067ea1af1..99d5c0caee36f 100644 --- a/core/java/android/view/IWindow.aidl +++ b/core/java/android/view/IWindow.aidl @@ -17,6 +17,7 @@ package android.view; +import android.graphics.Rect; import android.view.KeyEvent; import android.view.MotionEvent; @@ -42,7 +43,8 @@ oneway interface IWindow { */ void executeCommand(String command, String parameters, in ParcelFileDescriptor descriptor); - void resized(int w, int h, boolean reportDraw); + void resized(int w, int h, in Rect coveredInsets, in Rect visibleInsets, + boolean reportDraw); void dispatchKey(in KeyEvent event); void dispatchPointer(in MotionEvent event, long eventTime); void dispatchTrackball(in MotionEvent event, long eventTime); diff --git a/core/java/android/view/IWindowManager.aidl b/core/java/android/view/IWindowManager.aidl index e6d52e2957ac1..d89c7b45f9393 100644 --- a/core/java/android/view/IWindowManager.aidl +++ b/core/java/android/view/IWindowManager.aidl @@ -17,6 +17,9 @@ package android.view; +import com.android.internal.view.IInputContext; +import com.android.internal.view.IInputMethodClient; + import android.content.res.Configuration; import android.view.IApplicationToken; import android.view.IOnKeyguardExitResult; @@ -42,8 +45,10 @@ interface IWindowManager boolean stopViewServer(); // Transaction #2 boolean isViewServerRunning(); // Transaction #3 - IWindowSession openSession(IBinder token); - + IWindowSession openSession(in IInputMethodClient client, + in IInputContext inputContext); + boolean inputMethodClientHasFocus(IInputMethodClient client); + // These can only be called when injecting events to your own window, // or by holding the INJECT_EVENTS permission. boolean injectKeyEvent(in KeyEvent ev, boolean sync); @@ -74,6 +79,8 @@ interface IWindowManager void moveAppToken(int index, IBinder token); void moveAppTokensToTop(in List tokens); void moveAppTokensToBottom(in List tokens); + void addWindowToken(IBinder token, int type); + void removeWindowToken(IBinder token); // these require DISABLE_KEYGUARD permission void disableKeyguard(IBinder token, String tag); diff --git a/core/java/android/view/IWindowSession.aidl b/core/java/android/view/IWindowSession.aidl index c2c0b9780ea74..7276f173cf3f5 100644 --- a/core/java/android/view/IWindowSession.aidl +++ b/core/java/android/view/IWindowSession.aidl @@ -31,7 +31,7 @@ import android.view.Surface; */ interface IWindowSession { int add(IWindow window, in WindowManager.LayoutParams attrs, - in int viewVisibility, out Rect outCoveredInsets); + in int viewVisibility, out Rect outContentInsets); void remove(IWindow window); /** @@ -46,10 +46,22 @@ interface IWindowSession { * @param requestedWidth The width the window wants to be. * @param requestedHeight The height the window wants to be. * @param viewVisibility Window root view's visibility. - * @param outFrame Object in which is placed the new position/size on - * screen. - * @param outCoveredInsets Object in which is placed the insets for the areas covered by - * system windows (e.g. status bar) + * @param insetsPending Set to true if the client will be later giving + * internal insets; as a result, the window will not impact other window + * layouts until the insets are given. + * @param outFrame Rect in which is placed the new position/size on + * screen. + * @param outContentInsets Rect in which is placed the offsets from + * outFrame in which the content of the window should be + * placed. This can be used to modify the window layout to ensure its + * contents are visible to the user, taking into account system windows + * like the status bar or a soft keyboard. + * @param outVisibleInsets Rect in which is placed the offsets from + * outFrame in which the window is actually completely visible + * to the user. This can be used to temporarily scroll the window's + * contents to make sure the user can see it. This is different than + * outContentInsets in that these insets change transiently, + * so complex relayout of the window should not happen based on them. * @param outSurface Object in which is placed the new display surface. * * @return int Result flags: {@link WindowManagerImpl#RELAYOUT_SHOW_FOCUS}, @@ -57,16 +69,41 @@ interface IWindowSession { */ int relayout(IWindow window, in WindowManager.LayoutParams attrs, int requestedWidth, int requestedHeight, int viewVisibility, - out Rect outFrame, out Rect outCoveredInsets, out Surface outSurface); + boolean insetsPending, out Rect outFrame, out Rect outContentInsets, + out Rect outVisibleInsets, out Surface outSurface); + /** + * Give the window manager a hint of the part of the window that is + * completely transparent, allowing it to work with the surface flinger + * to optimize compositing of this part of the window. + */ + void setTransparentRegion(IWindow window, in Region region); + + /** + * Tell the window manager about the content and visible insets of the + * given window, which can be used to adjust the outContentInsets + * and outVisibleInsets values returned by + * {@link #relayout relayout()} for windows behind this one. + * + * @param touchableInsets Controls which part of the window inside of its + * frame can receive pointer events, as defined by + * {@link android.view.ViewTreeObserver.InternalInsetsInfo}. + */ + void setInsets(IWindow window, int touchableInsets, in Rect contentInsets, + in Rect visibleInsets); + + /** + * Return the current display size in which the window is being laid out, + * accounting for screen decorations around it. + */ + void getDisplayFrame(IWindow window, out Rect outDisplayFrame); + void finishDrawing(IWindow window); void finishKey(IWindow window); MotionEvent getPendingPointerMove(IWindow window); MotionEvent getPendingTrackballMove(IWindow window); - void setTransparentRegion(IWindow window, in Region region); - void setInTouchMode(boolean showFocus); boolean getInTouchMode(); } diff --git a/core/java/android/view/KeyEvent.java b/core/java/android/view/KeyEvent.java index 24b0316dc323d..1575aad11059c 100644 --- a/core/java/android/view/KeyEvent.java +++ b/core/java/android/view/KeyEvent.java @@ -111,15 +111,27 @@ public class KeyEvent implements Parcelable { public static final int KEYCODE_MENU = 82; public static final int KEYCODE_NOTIFICATION = 83; public static final int KEYCODE_SEARCH = 84; + public static final int KEYCODE_PLAYPAUSE = 85; + public static final int KEYCODE_STOP = 86; + public static final int KEYCODE_NEXTSONG = 87; + public static final int KEYCODE_PREVIOUSSONG = 88; + public static final int KEYCODE_REWIND = 89; + public static final int KEYCODE_FORWARD = 90; + private static final int LAST_KEYCODE = KEYCODE_FORWARD; // NOTE: If you add a new keycode here you must also add it to: // isSystem() - // include/ui/KeycodeLabels.h + // frameworks/base/include/ui/KeycodeLabels.h // tools/puppet_master/PuppetMaster/nav_keys.py - // apps/common/res/values/attrs.xml + // frameworks/base/core/res/res/values/attrs.xml // commands/monkey/Monkey.java // emulator? - + + /** + * @deprecated There are now more than MAX_KEYCODE keycodes. + * Use {@link #getMaxKeyCode()} instead. + */ + @Deprecated public static final int MAX_KEYCODE = 84; /** @@ -206,6 +218,18 @@ public class KeyEvent implements Parcelable { */ public static final int FLAG_WOKE_HERE = 0x1; + /** + * This mask is set if the key event was generated by a software keyboard. + */ + public static final int FLAG_SOFT_KEYBOARD = 0x2; + + /** + * Returns the maximum keycode. + */ + public static int getMaxKeyCode() { + return LAST_KEYCODE; + } + /** * Get the character that is produced by putting accent on the character * c. @@ -401,6 +425,24 @@ public class KeyEvent implements Parcelable { mFlags = origEvent.mFlags; } + /** + * Copy an existing key event, modifying its action. + * + * @param origEvent The existing event to be copied. + * @param action The new action code of the event. + */ + public KeyEvent(KeyEvent origEvent, int action) { + mDownTime = origEvent.mDownTime; + mEventTime = origEvent.mEventTime; + mAction = action; + mKeyCode = origEvent.mKeyCode; + mRepeatCount = origEvent.mRepeatCount; + mMetaState = origEvent.mMetaState; + mDeviceId = origEvent.mDeviceId; + mScancode = origEvent.mScancode; + mFlags = origEvent.mFlags; + } + /** * Don't use in new code, instead explicitly check * {@link #getAction()}. @@ -432,6 +474,12 @@ public class KeyEvent implements Parcelable { case KEYCODE_VOLUME_DOWN: case KEYCODE_POWER: case KEYCODE_HEADSETHOOK: + case KEYCODE_PLAYPAUSE: + case KEYCODE_STOP: + case KEYCODE_NEXTSONG: + case KEYCODE_PREVIOUSSONG: + case KEYCODE_REWIND: + case KEYCODE_FORWARD: case KEYCODE_CAMERA: case KEYCODE_FOCUS: case KEYCODE_SEARCH: diff --git a/core/java/android/view/Menu.java b/core/java/android/view/Menu.java index f2ec0769d1768..ca2140b4ee6b2 100644 --- a/core/java/android/view/Menu.java +++ b/core/java/android/view/Menu.java @@ -32,8 +32,7 @@ import android.content.Intent; *

    * Different menu types support different features: *

      - *
    1. Context menus: Do not support item shortcuts, item icons, and sub - * menus. + *
    2. Context menus: Do not support item shortcuts and item icons. *
    3. Options menus: The icon menus do not support item check * marks and only show the item's * {@link MenuItem#setTitleCondensed(CharSequence) condensed title}. The @@ -379,6 +378,24 @@ public interface Menu { */ public int size(); + /** + * Gets the menu item at the given index. + * + * @param index The index of the menu item to return. + * @return The menu item. + * @exception IndexOutOfBoundsException + * when {@code index < 0 || >= size()} + * @hide pending API council + */ + public MenuItem getItem(int index); + + /** + * Closes the menu, if open. + * + * @hide pending API council + */ + public void close(); + /** * Execute the menu item action associated with the given shortcut * character. diff --git a/core/java/android/view/MenuItem.java b/core/java/android/view/MenuItem.java index 92cf4afc5f979..fcebec5d8766f 100644 --- a/core/java/android/view/MenuItem.java +++ b/core/java/android/view/MenuItem.java @@ -1,3 +1,19 @@ +/* + * Copyright (C) 2008 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package android.view; import android.app.Activity; diff --git a/core/java/android/view/MotionEvent.java b/core/java/android/view/MotionEvent.java index ab05e16095140..882a07903741f 100644 --- a/core/java/android/view/MotionEvent.java +++ b/core/java/android/view/MotionEvent.java @@ -27,10 +27,36 @@ import android.util.Config; * it is being used for. */ public final class MotionEvent implements Parcelable { + /** + * Constant for {@link #getAction}: A pressed gesture has started, the + * motion contains the initial starting location. + */ public static final int ACTION_DOWN = 0; + /** + * Constant for {@link #getAction}: A pressed gesture has finished, the + * motion contains the final release location as well as any intermediate + * points since the last down or move event. + */ public static final int ACTION_UP = 1; + /** + * Constant for {@link #getAction}: A change has happened during a + * press gesture (between {@link #ACTION_DOWN} and {@link #ACTION_UP}). + * The motion contains the most recent point, as well as any intermediate + * points since the last down or move event. + */ public static final int ACTION_MOVE = 2; + /** + * Constant for {@link #getAction}: The current gesture has been aborted. + * You will not receive any more points in it. You should treat this as + * an up event, but not perform any action that you normally would. + */ public static final int ACTION_CANCEL = 3; + /** + * Constant for {@link #getAction}: A movement has happened outside of the + * normal bounds of the UI element. This does not provide a full gesture, + * but only the initial location of the movement/touch. + */ + public static final int ACTION_OUTSIDE = 4; private static final boolean TRACK_RECYCLED_LOCATION = false; diff --git a/core/java/android/view/OrientationListener.java b/core/java/android/view/OrientationListener.java index 0add025ae8ecf..974c2e83565a3 100644 --- a/core/java/android/view/OrientationListener.java +++ b/core/java/android/view/OrientationListener.java @@ -34,6 +34,7 @@ public abstract class OrientationListener implements SensorListener { private SensorManager mSensorManager; private int mOrientation = ORIENTATION_UNKNOWN; private boolean mEnabled = false; + private int mRate; /** * Returned from onOrientationChanged when the device orientation cannot be determined @@ -50,6 +51,21 @@ public abstract class OrientationListener implements SensorListener { */ public OrientationListener(Context context) { mSensorManager = (SensorManager)context.getSystemService(Context.SENSOR_SERVICE); + mRate = SensorManager.SENSOR_DELAY_NORMAL; + } + + /** + * Creates a new OrientationListener. + * + * @param context for the OrientationListener. + * @param rate at which sensor events are processed (see also + * {@link android.hardware.SensorManager SensorManager}). Use the default + * value of {@link android.hardware.SensorManager#SENSOR_DELAY_NORMAL + * SENSOR_DELAY_NORMAL} for simple screen orientation change detection. + */ + public OrientationListener(Context context, int rate) { + mSensorManager = (SensorManager)context.getSystemService(Context.SENSOR_SERVICE); + mRate = rate; } /** @@ -59,7 +75,7 @@ public abstract class OrientationListener implements SensorListener { public void enable() { if (mEnabled == false) { if (localLOGV) Log.d(TAG, "OrientationListener enabled"); - mSensorManager.registerListener(this, SensorManager.SENSOR_ACCELEROMETER); + mSensorManager.registerListener(this, SensorManager.SENSOR_ACCELEROMETER, mRate); mEnabled = true; } } @@ -106,7 +122,6 @@ public abstract class OrientationListener implements SensorListener { public void onAccuracyChanged(int sensor, int accuracy) { // TODO Auto-generated method stub - } /** diff --git a/core/java/android/view/SurfaceView.java b/core/java/android/view/SurfaceView.java index 57689f277f15d..0d9e2218329c4 100644 --- a/core/java/android/view/SurfaceView.java +++ b/core/java/android/view/SurfaceView.java @@ -82,6 +82,8 @@ public class SurfaceView extends View { final ArrayList mCallbacks = new ArrayList(); + final int[] mLocation = new int[2]; + final ReentrantLock mSurfaceLock = new ReentrantLock(); final Surface mSurface = new Surface(); boolean mDrawingStopped = true; @@ -90,8 +92,9 @@ public class SurfaceView extends View { = new WindowManager.LayoutParams(); IWindowSession mSession; MyWindow mWindow; + final Rect mVisibleInsets = new Rect(); final Rect mWinFrame = new Rect(); - final Rect mCoveredInsets = new Rect(); + final Rect mContentInsets = new Rect(); static final int KEEP_SCREEN_ON_MSG = 1; static final int GET_NEW_SURFACE_MSG = 2; @@ -309,7 +312,7 @@ public class SurfaceView extends View { mLayout.type = WindowManager.LayoutParams.TYPE_APPLICATION_MEDIA; mLayout.gravity = Gravity.LEFT|Gravity.TOP; mSession.add(mWindow, mLayout, - mVisible ? VISIBLE : GONE, mCoveredInsets); + mVisible ? VISIBLE : GONE, mContentInsets); } if (visibleChanged && (!visible || mNewSurfaceNeeded)) { @@ -321,8 +324,9 @@ public class SurfaceView extends View { mSurfaceLock.lock(); mDrawingStopped = !visible; final int relayoutResult = mSession.relayout( - mWindow, mLayout, mWidth, mHeight, - visible ? VISIBLE : GONE, mWinFrame, mCoveredInsets, mSurface); + mWindow, mLayout, mWidth, mHeight, + visible ? VISIBLE : GONE, false, mWinFrame, mContentInsets, + mVisibleInsets, mSurface); if (localLOGV) Log.i(TAG, "New surface: " + mSurface + ", vis=" + visible + ", frame=" + mWinFrame); mSurfaceFrame.left = 0; @@ -390,7 +394,8 @@ public class SurfaceView extends View { } private class MyWindow extends IWindow.Stub { - public void resized(int w, int h, boolean reportDraw) { + public void resized(int w, int h, Rect coveredInsets, + Rect visibleInsets, boolean reportDraw) { if (localLOGV) Log.v( "SurfaceView", SurfaceView.this + " got resized: w=" + w + " h=" + h + ", cur w=" + mCurWidth + " h=" + mCurHeight); diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java index 30402f81844be..f948b33fb179f 100644 --- a/core/java/android/view/View.java +++ b/core/java/android/view/View.java @@ -38,13 +38,18 @@ import android.os.IBinder; import android.os.Message; import android.os.Parcel; import android.os.Parcelable; +import android.os.RemoteException; import android.os.SystemClock; +import android.os.SystemProperties; import android.util.AttributeSet; import android.util.EventLog; import android.util.Log; import android.util.SparseArray; import android.view.ContextMenu.ContextMenuInfo; import android.view.animation.Animation; +import android.view.inputmethod.InputConnection; +import android.view.inputmethod.InputMethodManager; +import android.view.inputmethod.EditorInfo; import android.widget.ScrollBarDrawable; import com.android.internal.R; @@ -58,9 +63,9 @@ import java.util.Arrays; * The View class represents the basic UI building block. A view * occupies a rectangular area on the screen and is responsible for drawing and * event handling. View is the base class for widgets, - * used to create interactive graphical user interfaces. + * used to create interactive graphical user interfaces. *

      - * + * * *

      Using Views

      *

      @@ -98,7 +103,7 @@ import java.util.Arrays; * views yourself unless you are actually implementing a * {@link android.view.ViewGroup}. *

      - * + * * *

      Implementing a Custom View

      * @@ -111,7 +116,7 @@ import java.util.Arrays; * * Category Methods Description * - * + * * * * Creation @@ -127,7 +132,7 @@ import java.util.Arrays; * Called after a view and all of its children has been inflated * from XML. * - * + * * * Layout * {@link #onMeasure} @@ -146,7 +151,7 @@ import java.util.Arrays; * Called when the size of this view has changed. * * - * + * * * Drawing * {@link #onDraw} @@ -164,31 +169,31 @@ import java.util.Arrays; * {@link #onKeyUp} * Called when a key up event occurs. * - * + * * * {@link #onTrackballEvent} * Called when a trackball motion event occurs. * - * + * * * {@link #onTouchEvent} * Called when a touch screen motion event occurs. * - * - * + * + * * * Focus * {@link #onFocusChanged} * Called when the view gains or loses focus. * * - * + * * * {@link #onWindowFocusChanged} * Called when the window containing the view gains or loses focus. * * - * + * * * Attaching * {@link #onAttachedToWindow()} @@ -200,26 +205,26 @@ import java.util.Arrays; * {@link #onDetachedFromWindow} * Called when the view is detached from its window. * - * + * * * * {@link #onWindowVisibilityChanged} * Called when the visibility of the window containing the view * has changed. * - * + * * - * + * * *

      - * + * * *

      IDs

      * Views may have an integer id associated with them. These ids are typically * assigned in the layout XML files, and are used to find specific views within * the view tree. A common pattern is to: *
        - *
      • Define a Button in the layout file and assign it a unique ID. + *
      • Define a Button in the layout file and assign it a unique ID. *
          * <Button id="@+id/my_button"
          *     android:layout_width="wrap_content"
        @@ -232,11 +237,11 @@ import java.util.Arrays;
          * 
      • *
      *

      - * View IDs need not be unique throughout the tree, but it is good practice to + * View IDs need not be unique throughout the tree, but it is good practice to * ensure that they are at least unique within the part of the tree you are * searching. *

      - * + * * *

      Position

      *

      @@ -264,7 +269,7 @@ import java.util.Arrays; * is similar to the following computation: getLeft() + getWidth() * (see Size for more information about the width.) *

      - * + * * *

      Size, padding and margins

      *

      @@ -286,7 +291,7 @@ import java.util.Arrays; * dimensions define the actual size of the view on screen, at drawing time and * after layout. These values may, but do not have to, be different from the * measured width and height. The width and height can be obtained by calling - * {@link #getWidth()} and {@link #getHeight()}. + * {@link #getWidth()} and {@link #getHeight()}. *

      * *

      @@ -297,7 +302,7 @@ import java.util.Arrays; * 2 pixels to the right of the left edge. Padding can be set using the * {@link #setPadding(int, int, int, int)} method and queried by calling * {@link #getPaddingLeft()}, {@link #getPaddingTop()}, - * {@link #getPaddingRight()} and {@link #getPaddingBottom()}. + * {@link #getPaddingRight()} and {@link #getPaddingBottom()}. *

      * *

      @@ -306,7 +311,7 @@ import java.util.Arrays; * {@link android.view.ViewGroup} and * {@link android.view.ViewGroup.MarginLayoutParams} for further information. *

      - * + * * *

      Layout

      *

      @@ -319,7 +324,7 @@ import java.util.Arrays; * this pass each parent is responsible for positioning all of its children * using the sizes computed in the measure pass. *

      - * + * *

      * When a view's measure() method returns, its {@link #getMeasuredWidth()} and * {@link #getMeasuredHeight()} values must be set, along with those for all of @@ -332,7 +337,7 @@ import java.util.Arrays; * measure() on them again with actual numbers if the sum of all the children's * unconstrained sizes is too big or too small. *

      - * + * *

      * The measure pass uses two classes to communicate dimensions. The * {@link MeasureSpec} class is used by views to tell their parents how they @@ -350,7 +355,7 @@ import java.util.Arrays; * For example, AbsoluteLayout has its own subclass of LayoutParams which adds * an X and Y value. *

      - * + * *

      * MeasureSpecs are used to push requirements down the tree from parent to * child. A MeasureSpec can be in one of three modes: @@ -367,13 +372,13 @@ import java.util.Arrays; * within this size. * *

      - * + * *

      * To intiate a layout, call {@link #requestLayout}. This method is typically * called by a view on itself when it believes that is can no longer fit within * its current bounds. *

      - * + * * *

      Drawing

      *

      @@ -381,17 +386,18 @@ import java.util.Arrays; * intersects the the invalid region. Because the tree is traversed in-order, * this means that parents will draw before (i.e., behind) their children, with * siblings drawn in the order they appear in the tree. + * If you set a background drawable for a View, then the View will draw it for you + * before calling back to its onDraw() method. *

      - * + * *

      - * The framework will not draw views that are not in the invalid region, and also - * will take care of drawing the views background for you. + * Note that the framework will not draw views that are not in the invalid region. *

      - * + * *

      * To force a view to draw, call {@link #invalidate()}. *

      - * + * * *

      Event Handling and Threading

      *

      @@ -408,13 +414,13 @@ import java.util.Arrays; * as appropriate.

    4. *
    *

    - * + * *

    Note: The entire view tree is single threaded. You must always be on * the UI thread when calling any method on any view. * If you are doing work on other threads and want to update the state of a view * from that thread, you should use a {@link Handler}. *

    - * + * * *

    Focus Handling

    *

    @@ -479,7 +485,7 @@ import java.util.Arrays; * offset as well as mechanisms for drawing scrollbars. See * {@link #scrollBy(int, int)}, {@link #scrollTo(int, int)} for more details. *

    - * + * * *

    Tags

    *

    @@ -488,7 +494,7 @@ import java.util.Arrays; * often used as a convenience to store data related to views in the views * themselves rather than by putting them in a separate structure. *

    - * + * * *

    Animation

    *

    @@ -543,7 +549,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback { * setFlags. */ private static final int FOCUSABLE = 0x00000001; - + /** * Mask for use with setFlags indicating bits used for focus. */ @@ -599,7 +605,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback { * {@hide} */ static final int ENABLED_MASK = 0x00000020; - + /** * This view won't draw. {@link #onDraw} won't be called and further * optimizations @@ -615,7 +621,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback { * {@hide} */ static final int DRAW_MASK = 0x00000080; - + /** *

    This view doesn't show scrollbars.

    * {@hide} @@ -752,22 +758,22 @@ public class View implements Drawable.Callback, KeyEvent.Callback { /** * The scrollbar style to display the scrollbars inside the content area, - * without increasing the padding. The scrollbars will be overlaid with + * without increasing the padding. The scrollbars will be overlaid with * translucency on the view's content. */ public static final int SCROLLBARS_INSIDE_OVERLAY = 0; - + /** * The scrollbar style to display the scrollbars inside the padded area, - * increasing the padding of the view. The scrollbars will not overlap the + * increasing the padding of the view. The scrollbars will not overlap the * content area of the view. */ public static final int SCROLLBARS_INSIDE_INSET = 0x01000000; /** * The scrollbar style to display the scrollbars at the edge of the view, - * without increasing the padding. The scrollbars will be overlaid with - * translucency. + * without increasing the padding. The scrollbars will be overlaid with + * translucency. */ public static final int SCROLLBARS_OUTSIDE_OVERLAY = 0x02000000; @@ -789,7 +795,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback { * {@hide} */ static final int SCROLLBARS_OUTSIDE_MASK = 0x02000000; - + /** * Mask for scrollbar style. * {@hide} @@ -841,7 +847,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback { * Use with {@link #focusSearch}. Move focus down. */ public static final int FOCUS_DOWN = 0x00000082; - + /** * Base View state sets */ @@ -850,7 +856,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback { * Indicates the view has no states set. States are used with * {@link android.graphics.drawable.Drawable} to change the drawing of the * view depending on its state. - * + * * @see android.graphics.drawable.Drawable * @see #getDrawableState() */ @@ -1003,7 +1009,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback { /** * Indicates the view is pressed and its window has the focus. - * + * * @see #PRESSED_STATE_SET * @see #WINDOW_FOCUSED_STATE_SET */ @@ -1021,7 +1027,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback { /** * Indicates the view is pressed, selected and its window has the focus. - * + * * @see #PRESSED_STATE_SET * @see #SELECTED_STATE_SET * @see #WINDOW_FOCUSED_STATE_SET @@ -1040,7 +1046,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback { /** * Indicates the view is pressed, focused and its window has the focus. - * + * * @see #PRESSED_STATE_SET * @see #FOCUSED_STATE_SET * @see #WINDOW_FOCUSED_STATE_SET @@ -1050,7 +1056,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback { /** * Indicates the view is pressed, focused and selected. - * + * * @see #PRESSED_STATE_SET * @see #SELECTED_STATE_SET * @see #FOCUSED_STATE_SET @@ -1060,7 +1066,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback { /** * Indicates the view is pressed, focused, selected and its window has the focus. - * + * * @see #PRESSED_STATE_SET * @see #FOCUSED_STATE_SET * @see #SELECTED_STATE_SET @@ -1071,7 +1077,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback { /** * Indicates the view is pressed and enabled. - * + * * @see #PRESSED_STATE_SET * @see #ENABLED_STATE_SET */ @@ -1080,7 +1086,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback { /** * Indicates the view is pressed, enabled and its window has the focus. - * + * * @see #PRESSED_STATE_SET * @see #ENABLED_STATE_SET * @see #WINDOW_FOCUSED_STATE_SET @@ -1090,7 +1096,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback { /** * Indicates the view is pressed, enabled and selected. - * + * * @see #PRESSED_STATE_SET * @see #ENABLED_STATE_SET * @see #SELECTED_STATE_SET @@ -1101,7 +1107,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback { /** * Indicates the view is pressed, enabled, selected and its window has the * focus. - * + * * @see #PRESSED_STATE_SET * @see #ENABLED_STATE_SET * @see #SELECTED_STATE_SET @@ -1112,18 +1118,18 @@ public class View implements Drawable.Callback, KeyEvent.Callback { /** * Indicates the view is pressed, enabled and focused. - * + * * @see #PRESSED_STATE_SET * @see #ENABLED_STATE_SET * @see #FOCUSED_STATE_SET */ protected static final int[] PRESSED_ENABLED_FOCUSED_STATE_SET = stateSetUnion(PRESSED_ENABLED_STATE_SET, FOCUSED_STATE_SET); - + /** * Indicates the view is pressed, enabled, focused and its window has the * focus. - * + * * @see #PRESSED_STATE_SET * @see #ENABLED_STATE_SET * @see #FOCUSED_STATE_SET @@ -1134,7 +1140,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback { /** * Indicates the view is pressed, enabled, focused and selected. - * + * * @see #PRESSED_STATE_SET * @see #ENABLED_STATE_SET * @see #SELECTED_STATE_SET @@ -1146,7 +1152,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback { /** * Indicates the view is pressed, enabled, focused, selected and its window * has the focus. - * + * * @see #PRESSED_STATE_SET * @see #ENABLED_STATE_SET * @see #SELECTED_STATE_SET @@ -1242,6 +1248,13 @@ public class View implements Drawable.Callback, KeyEvent.Callback { * @hide */ protected static final int[] PRESSED_SINGLE_STATE_SET = {R.attr.state_single, R.attr.state_pressed}; + + /** + * Temporary Rect currently for use in setBackground(). This will probably + * be extended in the future to hold our own class with more than just + * a Rect. :) + */ + static final ThreadLocal sThreadLocal = new ThreadLocal(); /** * The animation currently associated with this view. @@ -1263,21 +1276,12 @@ public class View implements Drawable.Callback, KeyEvent.Callback { @ViewDebug.ExportedProperty protected int mMeasuredHeight; - /** - * Used to store a pair of coordinates, for instance returned values - * returned by {@link #getLocationInWindow(int[])}. - * - * This field should be made private, so it is hidden from the SDK. - * {@hide} - */ - protected final int[] mLocation = new int[2]; - /** * The view's identifier. * {@hide} * * @see #setId(int) - * @see #getId() + * @see #getId() */ @ViewDebug.ExportedProperty(resolveId = true) int mID = NO_ID; @@ -1287,7 +1291,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback { * {@hide} * * @see #setTag(Object) - * @see #getTag() + * @see #getTag() */ protected Object mTag; @@ -1320,7 +1324,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback { private static final int LAYOUT_REQUIRED = 0x00002000; private static final int PRESSED = 0x00004000; - + /** {@hide} */ static final int DRAWING_CACHE_VALID = 0x00008000; /** @@ -1329,7 +1333,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback { * {@hide} */ static final int ANIMATION_STARTED = 0x00010000; - + private static final int SAVE_STATE_CALLED = 0x00020000; /** @@ -1339,8 +1343,18 @@ public class View implements Drawable.Callback, KeyEvent.Callback { */ static final int ALPHA_SET = 0x00040000; + /** + * Set by {@link #setScrollContainer(boolean)}. + */ + static final int SCROLL_CONTAINER = 0x00080000; + + /** + * Set by {@link #setScrollContainer(boolean)}. + */ + static final int SCROLL_CONTAINER_ADDED = 0x00100000; + // Note: flag 0x00000040 is available - + /** * The parent this view is attached to. * {@hide} @@ -1357,10 +1371,11 @@ public class View implements Drawable.Callback, KeyEvent.Callback { /** * {@hide} */ + @ViewDebug.ExportedProperty int mPrivateFlags; - + /** - * Count of how many windows this view has been attached to. + * Count of how many windows this view has been attached to. */ int mWindowAttachCount; @@ -1376,6 +1391,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback { * The view flags hold various views states. * {@hide} */ + @ViewDebug.ExportedProperty int mViewFlags; /** @@ -1450,7 +1466,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback { */ @ViewDebug.ExportedProperty protected int mPaddingBottom; - + /** * Cache the paddingRight set by the user to append to the scrollbar's size. */ @@ -1462,7 +1478,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback { */ @ViewDebug.ExportedProperty int mUserPaddingBottom; - + private int mOldWidthMeasureSpec = Integer.MIN_VALUE; private int mOldHeightMeasureSpec = Integer.MIN_VALUE; @@ -1479,28 +1495,28 @@ public class View implements Drawable.Callback, KeyEvent.Callback { * {@hide} */ protected OnFocusChangeListener mOnFocusChangeListener; - + /** * Listener used to dispatch click events. * This field should be made private, so it is hidden from the SDK. * {@hide} */ protected OnClickListener mOnClickListener; - + /** * Listener used to dispatch long click events. * This field should be made private, so it is hidden from the SDK. * {@hide} */ protected OnLongClickListener mOnLongClickListener; - + /** * Listener used to build the context menu. * This field should be made private, so it is hidden from the SDK. * {@hide} */ protected OnCreateContextMenuListener mOnCreateContextMenuListener; - + private OnKeyListener mOnKeyListener; private OnTouchListener mOnTouchListener; @@ -1518,11 +1534,6 @@ public class View implements Drawable.Callback, KeyEvent.Callback { private Bitmap mDrawingCache; - /** - * Used for local (within a stackframe) calls that need a rect temporarily - */ - private final Rect mTempRect = new Rect(); - /** * When this view has focus and the next focus is {@link #FOCUS_LEFT}, * the user may specify which view to go to next. @@ -1542,13 +1553,13 @@ public class View implements Drawable.Callback, KeyEvent.Callback { private int mNextFocusUpId = View.NO_ID; /** - * When this view has focus and the next focus is {@link #FOCUS_DOWN}, + * When this view has focus and the next focus is {@link #FOCUS_DOWN}, * the user may specify which view to go to next. */ private int mNextFocusDownId = View.NO_ID; private CheckForLongPress mPendingCheckForLongPress; - + /** * Whether the long press's action has been invoked. The tap's action is invoked on the * up event while a long press is invoked as soon as the long press duration is reached, so @@ -1561,12 +1572,14 @@ public class View implements Drawable.Callback, KeyEvent.Callback { * The minimum height of the view. We'll try our best to have the height * of this view to at least this amount. */ + @ViewDebug.ExportedProperty private int mMinHeight; - + /** * The minimum width of the view. We'll try our best to have the width * of this view to at least this amount. */ + @ViewDebug.ExportedProperty private int mMinWidth; /** @@ -1574,7 +1587,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback { * but should be handled by another view. */ private TouchDelegate mTouchDelegate = null; - + /** * Solid color to use as a background when creating the drawing cache. Enables * the cache to use 16 bit bitmaps instead of 32 bit. @@ -1591,7 +1604,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback { /** * Simple constructor to use when creating a view from code. - * + * * @param context The Context the view is running in, through which it can * access the current theme, resources, etc. */ @@ -1607,11 +1620,11 @@ public class View implements Drawable.Callback, KeyEvent.Callback { * that were specified in the XML file. This version uses a default style of * 0, so the only attribute values applied are those in the Context's Theme * and the given AttributeSet. - * + * *

    * The method onFinishInflate() will be called after all children have been * added. - * + * * @param context The Context the view is running in, through which it can * access the current theme, resources, etc. * @param attrs The attributes of the XML tag that is inflating the view. @@ -1629,7 +1642,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback { * R.attr.buttonStyle for defStyle; this allows * the theme's button style to modify all of the base view attributes (in * particular its background) as well as the Button class's attributes. - * + * * @param context The Context the view is running in, through which it can * access the current theme, resources, etc. * @param attrs The attributes of the XML tag that is inflating the view. @@ -1663,7 +1676,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback { int scrollbarStyle = SCROLLBARS_INSIDE_OVERLAY; viewFlagValues |= SOUND_EFFECTS_ENABLED; - viewFlagMasks |= SOUND_EFFECTS_ENABLED; + viewFlagMasks |= SOUND_EFFECTS_ENABLED; final int N = a.getIndexCount(); for (int i = 0; i < N; i++) { @@ -1833,7 +1846,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback { if (viewFlagMasks != 0) { setFlags(viewFlagValues, viewFlagMasks); } - + // Needs to be called after mViewFlags is set if (scrollbarStyle != SCROLLBARS_INSIDE_OVERLAY) { recomputePadding(); @@ -1866,7 +1879,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback { * being inflated from XML. This method is automatically called when the XML * is inflated. *

    - * + * * @param a the styled attributes set to initialize the fading edges from */ protected void initializeFadingEdge(TypedArray a) { @@ -1875,7 +1888,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback { mScrollCache.fadingEdgeLength = a.getDimensionPixelSize( R.styleable.View_fadingEdgeLength, ViewConfiguration.getFadingEdgeLength()); } - + /** * Returns the size of the vertical faded edges used to indicate that more * content in this view is visible. @@ -1907,7 +1920,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback { initScrollCache(); mScrollCache.fadingEdgeLength = length; } - + /** * Returns the size of the horizontal faded edges used to indicate that more * content in this view is visible. @@ -1978,7 +1991,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback { * being inflated from XML. This method is automatically called when the XML * is inflated. *

    - * + * * @param a the styled attributes set to initialize the scrollbars from */ protected void initializeScrollbars(TypedArray a) { @@ -1999,8 +2012,8 @@ public class View implements Drawable.Callback, KeyEvent.Callback { if (thumb != null) { mScrollCache.scrollBar.setHorizontalThumbDrawable(thumb); } - - boolean alwaysDraw = a.getBoolean(R.styleable.View_scrollbarAlwaysDrawHorizontalTrack, + + boolean alwaysDraw = a.getBoolean(R.styleable.View_scrollbarAlwaysDrawHorizontalTrack, false); if (alwaysDraw) { mScrollCache.scrollBar.setAlwaysDrawHorizontalTrack(true); @@ -2013,13 +2026,13 @@ public class View implements Drawable.Callback, KeyEvent.Callback { if (thumb != null) { mScrollCache.scrollBar.setVerticalThumbDrawable(thumb); } - - alwaysDraw = a.getBoolean(R.styleable.View_scrollbarAlwaysDrawVerticalTrack, + + alwaysDraw = a.getBoolean(R.styleable.View_scrollbarAlwaysDrawVerticalTrack, false); if (alwaysDraw) { mScrollCache.scrollBar.setAlwaysDrawVerticalTrack(true); } - + // Re-apply user/background padding so that scrollbar(s) get added recomputePadding(); } @@ -2037,16 +2050,16 @@ public class View implements Drawable.Callback, KeyEvent.Callback { /** * Register a callback to be invoked when focus of this view changed. - * + * * @param l The callback that will run. */ public void setOnFocusChangeListener(OnFocusChangeListener l) { mOnFocusChangeListener = l; } - + /** * Returns the focus-change callback registered for this view. - * + * * @return The callback, or null if one is not registered. */ public OnFocusChangeListener getOnFocusChangeListener() { @@ -2056,7 +2069,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback { /** * Register a callback to be invoked when this view is clicked. If this view is not * clickable, it becomes clickable. - * + * * @param l The callback that will run * * @see #setClickable(boolean) @@ -2067,11 +2080,11 @@ public class View implements Drawable.Callback, KeyEvent.Callback { } mOnClickListener = l; } - + /** * Register a callback to be invoked when this view is clicked and held. If this view is not * long clickable, it becomes long clickable. - * + * * @param l The callback that will run * * @see #setLongClickable(boolean) @@ -2084,9 +2097,9 @@ public class View implements Drawable.Callback, KeyEvent.Callback { } /** - * Register a callback to be invoked when the context menu for this view is + * Register a callback to be invoked when the context menu for this view is * being built. If this view is not long clickable, it becomes long clickable. - * + * * @param l The callback that will run * */ @@ -2096,10 +2109,10 @@ public class View implements Drawable.Callback, KeyEvent.Callback { } mOnCreateContextMenuListener = l; } - + /** * Call this view's OnClickListener, if it is defined. - * + * * @return True there was an assigned OnClickListener that was called, false * otherwise is returned. */ @@ -2112,11 +2125,11 @@ public class View implements Drawable.Callback, KeyEvent.Callback { return false; } - + /** * Call this view's OnLongClickListener, if it is defined. Invokes the context menu * if the OnLongClickListener did not consume the event. - * + * * @return True there was an assigned OnLongClickListener that was called, false * otherwise is returned. */ @@ -2130,10 +2143,10 @@ public class View implements Drawable.Callback, KeyEvent.Callback { } return handled; } - + /** * Bring up the context menu for this view. - * + * * @return Whether a context menu was displayed. */ public boolean showContextMenu() { @@ -2155,7 +2168,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback { public void setOnTouchListener(OnTouchListener l) { mOnTouchListener = l; } - + /** * Give this view focus. This will cause {@link #onFocusChanged} to be called. * @@ -2191,7 +2204,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback { * Request that a rectangle of this view be visible on the screen, * scrolling if necessary just enough. * - * A View should call this if it maintains some notion of which part + *

    A View should call this if it maintains some notion of which part * of its content is interesting. For example, a text editing view * should call this when its cursor moves. * @@ -2206,11 +2219,11 @@ public class View implements Drawable.Callback, KeyEvent.Callback { * Request that a rectangle of this view be visible on the screen, * scrolling if necessary just enough. * - * A View should call this if it maintains some notion of which part + *

    A View should call this if it maintains some notion of which part * of its content is interesting. For example, a text editing view * should call this when its cursor moves. * - * When immediate is set to true, scrolling will not be + *

    When immediate is set to true, scrolling will not be * animated. * * @param rectangle The rectangle. @@ -2221,9 +2234,8 @@ public class View implements Drawable.Callback, KeyEvent.Callback { View child = this; ViewParent parent = mParent; boolean scrolled = false; - while (parent instanceof ViewGroup) { - ViewGroup vgParent = (ViewGroup) parent; - scrolled |= vgParent.requestChildRectangleOnScreen(child, + while (parent != null) { + scrolled |= parent.requestChildRectangleOnScreen(child, rectangle, immediate); // offset rect so next call has the rectangle in the @@ -2231,12 +2243,16 @@ public class View implements Drawable.Callback, KeyEvent.Callback { rectangle.offset(child.getLeft(), child.getTop()); rectangle.offset(-child.getScrollX(), -child.getScrollY()); + if (!(parent instanceof View)) { + break; + } + child = (View) parent; parent = child.getParent(); } return scrolled; } - + /** * Called when this view wants to give up focus. This will cause * {@link #onFocusChanged} to be called. @@ -2257,7 +2273,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback { refreshDrawableState(); } } - + /** * Called to clear the focus of a view that is about to be removed. * Doesn't call clearChildFocus, which prevents this view from taking @@ -2271,7 +2287,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback { refreshDrawableState(); } } - + /** * Called internally by the view system when a new view is getting focus. * This is what clears the old focus. @@ -2292,7 +2308,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback { /** * Returns true if this view has focus iteself, or is the ancestor of the * view that has focus. - * + * * @return True if this view has or contains focus, false otherwise. */ @ViewDebug.ExportedProperty @@ -2315,17 +2331,19 @@ public class View implements Drawable.Callback, KeyEvent.Callback { public boolean hasFocusable() { return (mViewFlags & VISIBILITY_MASK) == VISIBLE && isFocusable(); } - + /** * Called by the view system when the focus state of this view changes. * When the focus change event is caused by directional navigation, direction * and previouslyFocusedRect provide insight into where the focus is coming from. + * When overriding, be sure to call up through to the super class so that + * the standard focus handling will occur. * * @param gainFocus True if the View has focus; false otherwise. - * @param direction The direction focus has moved when requestFocus() - * is called to give this view focus. Values are - * View.FOCUS_UP, View.FOCUS_DOWN, View.FOCUS_LEFT or - * View.FOCUS_RIGHT. It may not always apply, in which + * @param direction The direction focus has moved when requestFocus() + * is called to give this view focus. Values are + * View.FOCUS_UP, View.FOCUS_DOWN, View.FOCUS_LEFT or + * View.FOCUS_RIGHT. It may not always apply, in which * case use the default. * @param previouslyFocusedRect The rectangle, in this view's coordinate * system, of the previously focused view. If applicable, this will be @@ -2333,20 +2351,29 @@ public class View implements Drawable.Callback, KeyEvent.Callback { * from (in addition to direction). Will be null otherwise. */ protected void onFocusChanged(boolean gainFocus, int direction, Rect previouslyFocusedRect) { + InputMethodManager imm = InputMethodManager.peekInstance(); if (!gainFocus) { if (isPressed()) { setPressed(false); } + if (imm != null && mAttachInfo != null + && mAttachInfo.mHasWindowFocus) { + imm.focusOut(this); + } + } else if (imm != null && mAttachInfo != null + && mAttachInfo.mHasWindowFocus) { + imm.focusIn(this); } + invalidate(); if (mOnFocusChangeListener != null) { mOnFocusChangeListener.onFocusChange(this, gainFocus); } } - + /** * Returns true if this view has focus - * + * * @return True if this view has focus, false otherwise. */ @ViewDebug.ExportedProperty @@ -2357,7 +2384,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback { /** * Find the view in the hierarchy rooted at this view that currently has * focus. - * + * * @return The view that currently has focus, or null if no focused view can * be found. */ @@ -2365,6 +2392,28 @@ public class View implements Drawable.Callback, KeyEvent.Callback { return (mPrivateFlags & FOCUSED) != 0 ? this : null; } + /** + * Change whether this view is one of the set of scrollable containers in + * its window. This will be used to determine whether the window can + * resize or must pan when a soft input area is open -- scrollable + * containers allow the window to use resize mode since the container + * will appropriately shrink. + */ + public void setScrollContainer(boolean isScrollContainer) { + if (isScrollContainer) { + if (mAttachInfo != null && (mPrivateFlags&SCROLL_CONTAINER_ADDED) == 0) { + mAttachInfo.mScrollContainers.add(this); + mPrivateFlags |= SCROLL_CONTAINER_ADDED; + } + mPrivateFlags |= SCROLL_CONTAINER; + } else { + if ((mPrivateFlags&SCROLL_CONTAINER_ADDED) != 0) { + mAttachInfo.mScrollContainers.remove(this); + } + mPrivateFlags &= ~(SCROLL_CONTAINER|SCROLL_CONTAINER_ADDED); + } + } + /** * Returns the quality of the drawing cache. * @@ -2388,7 +2437,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback { * @param quality One of {@link #DRAWING_CACHE_QUALITY_AUTO}, * {@link #DRAWING_CACHE_QUALITY_LOW}, or {@link #DRAWING_CACHE_QUALITY_HIGH} * - * @see #getDrawingCacheQuality() + * @see #getDrawingCacheQuality() * @see #setDrawingCacheEnabled(boolean) * @see #isDrawingCacheEnabled() * @@ -2418,7 +2467,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback { * * @param keepScreenOn Supply true to set {@link #KEEP_SCREEN_ON}. * - * @see #getKeepScreenOn() + * @see #getKeepScreenOn() * * @attr ref android.R.styleable#View_keepScreenOn */ @@ -2508,10 +2557,10 @@ public class View implements Drawable.Callback, KeyEvent.Callback { /** * Returns the visibility of this view and all of its ancestors - * + * * @return True if this view and all of its ancestors are {@link #VISIBLE} */ - public boolean isShown() { + public boolean isShown() { View current = this; //noinspection ConstantConditions do { @@ -2522,7 +2571,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback { if (parent == null) { return false; // We are not attached to the view root } - if (parent instanceof ViewRoot) { + if (!(parent instanceof View)) { return true; } current = (View) parent; @@ -2534,7 +2583,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback { /** * Apply the insets for system windows to this view, if the FITS_SYSTEM_WINDOWS flag * is set - * + * * @param insets Insets for system windows * * @return True if this view applied the insets, false otherwise @@ -2545,14 +2594,15 @@ public class View implements Drawable.Callback, KeyEvent.Callback { mPaddingTop = insets.top; mPaddingRight = insets.right; mPaddingBottom = insets.bottom; + requestLayout(); return true; } return false; } - + /** * Returns the visibility status for this view. - * + * * @return One of {@link #VISIBLE}, {@link #INVISIBLE}, or {@link #GONE}. * @attr ref android.R.styleable#View_visibility */ @@ -2567,7 +2617,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback { /** * Set the enabled state of this view. - * + * * @param visibility One of {@link #VISIBLE}, {@link #INVISIBLE}, or {@link #GONE}. * @attr ref android.R.styleable#View_visibility */ @@ -2578,40 +2628,40 @@ public class View implements Drawable.Callback, KeyEvent.Callback { /** * Returns the enabled status for this view. The interpretation of the * enabled state varies by subclass. - * + * * @return True if this view is enabled, false otherwise. */ @ViewDebug.ExportedProperty public boolean isEnabled() { return (mViewFlags & ENABLED_MASK) == ENABLED; } - + /** * Set the enabled state of this view. The interpretation of the enabled * state varies by subclass. - * + * * @param enabled True if this view is enabled, false otherwise. */ public void setEnabled(boolean enabled) { setFlags(enabled ? ENABLED : DISABLED, ENABLED_MASK); - + /* * The View most likely has to change its appearance, so refresh * the drawable state. */ refreshDrawableState(); - + // Invalidate too, since the default behavior for views is to be // be drawn at 50% alpha rather than to change the drawable. invalidate(); } - + /** * Set whether this view can receive the focus. * * Setting this to false will also ensure that this view is not focusable * in touch mode. - * + * * @param focusable If true, this view can receive the focus. * * @see #setFocusableInTouchMode(boolean) @@ -2631,7 +2681,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback { * * @param focusableInTouchMode If true, this view can receive the focus while * in touch mode. - * + * * @see #setFocusable(boolean) * @attr ref android.R.styleable#View_focusableInTouchMode */ @@ -2676,18 +2726,18 @@ public class View implements Drawable.Callback, KeyEvent.Callback { } /** - * If this view doesn't do any drawing on its own, set this flag to + * If this view doesn't do any drawing on its own, set this flag to * allow further optimizations. By default, this flag is not set on * View, but could be set on some View subclasses such as ViewGroup. - * + * * Typically, if you override {@link #onDraw} you should clear this flag. - * + * * @param willNotDraw whether or not this View draw on its own */ public void setWillNotDraw(boolean willNotDraw) { setFlags(willNotDraw ? WILL_NOT_DRAW : 0, DRAW_MASK); } - + /** * Returns whether or not this View draws on its own. * @@ -2739,7 +2789,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback { * is clickable it will change its state to "pressed" on every click. * Subclasses should set the view clickable to visually react to * user's clicks. - * + * * @param clickable true to make the view clickable, false otherwise * * @see #isClickable() @@ -2766,7 +2816,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback { * clickable it reacts to the user holding down the button for a longer * duration than a tap. This event can either launch the listener or a * context menu. - * + * * @param longClickable true to make the view long clickable, false otherwise * @see #isLongClickable() * @attr ref android.R.styleable#View_longClickable @@ -2777,10 +2827,10 @@ public class View implements Drawable.Callback, KeyEvent.Callback { /** * Sets the pressed that for this view. - * + * * @see #isClickable() * @see #setClickable(boolean) - * + * * @param pressed Pass true to set the View's internal state to "pressed", or false to reverts * the View's internal state from a previously set "pressed" state. */ @@ -2793,12 +2843,12 @@ public class View implements Drawable.Callback, KeyEvent.Callback { refreshDrawableState(); dispatchSetPressed(pressed); } - + /** * Dispatch setPressed to all of this View's children. - * + * * @see #setPressed(boolean) - * + * * @param pressed The new pressed state */ protected void dispatchSetPressed(boolean pressed) { @@ -2818,7 +2868,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback { public boolean isPressed() { return (mPrivateFlags & PRESSED) == PRESSED; } - + /** * Indicates whether this view will save its state (that is, * whether its {@link #onSaveInstanceState} method will be called). @@ -2839,12 +2889,12 @@ public class View implements Drawable.Callback, KeyEvent.Callback { * view still must have an id assigned to it (via {@link #setId setId()}) * for its state to be saved. This flag can only disable the * saving of this view; any child views may still have their state saved. - * + * * @param enabled Set to false to disable state saving, or true * (the default) to allow it. * * @see #isSaveEnabled() - * @see #setId(int) + * @see #setId(int) * @see #onSaveInstanceState() * @attr ref android.R.styleable#View_saveEnabled */ @@ -2855,7 +2905,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback { /** * Returns whether this View is able to take focus. - * + * * @return True if this view can take focus, or false otherwise. * @attr ref android.R.styleable#View_focusable */ @@ -2880,9 +2930,9 @@ public class View implements Drawable.Callback, KeyEvent.Callback { /** * Find the nearest view in the specified direction that can take focus. * This does not actually give focus to that view. - * + * * @param direction One of FOCUS_UP, FOCUS_DOWN, FOCUS_LEFT, and FOCUS_RIGHT - * + * * @return The nearest focusable in the specified direction, or null if none * can be found. */ @@ -2893,7 +2943,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback { return null; } } - + /** * This method is the last chance for the focused view and its ancestors to * respond to an arrow key. This is called when the focused view did not @@ -2943,7 +2993,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback { } return result; } - + /** * Find and return all focusable views that are descendants of this view, * possibly including this view if it is focusable itself. @@ -2961,7 +3011,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback { * Add any focusable views that are descendants of this view (possibly * including this view if it is focusable itself) to views. If we are in touch mode, * only add views that are also focusable in touch mode. - * + * * @param views Focusable views found so far * @param direction The direction of the focus */ @@ -2972,11 +3022,11 @@ public class View implements Drawable.Callback, KeyEvent.Callback { views.add(this); } - + /** * Find and return all touchable views that are descendants of this view, * possibly including this view if it is touchable itself. - * + * * @return A list of touchable views */ public ArrayList getTouchables() { @@ -2987,13 +3037,13 @@ public class View implements Drawable.Callback, KeyEvent.Callback { /** * Add any touchable views that are descendants of this view (possibly - * including this view if it is touchable itself) to views. - * + * including this view if it is touchable itself) to views. + * * @param views Touchable views found so far */ public void addTouchables(ArrayList views) { final int viewFlags = mViewFlags; - + if (((viewFlags & CLICKABLE) == CLICKABLE || (viewFlags & LONG_CLICKABLE) == LONG_CLICKABLE) && (viewFlags & ENABLED_MASK) == ENABLED) { views.add(this); @@ -3024,14 +3074,14 @@ public class View implements Drawable.Callback, KeyEvent.Callback { /** * Call this to try to give focus to a specific view or to one of its * descendants and give it a hint about what direction focus is heading. - * + * * A view will not actually take focus if it is not focusable ({@link #isFocusable} returns false), * or if it is focusable and it is not focusable in touch mode ({@link #isFocusableInTouchMode}) * while the device is in touch mode. * * See also {@link #focusSearch}, which is what you call to say that you * have focus, and you want your parent to look for the next one. - * + * * This is equivalent to calling {@link #requestFocus(int, Rect)} with * null set for the previously focused rectangle. * @@ -3096,11 +3146,11 @@ public class View implements Drawable.Callback, KeyEvent.Callback { * Call this to try to give focus to a specific view or to one of its descendants. This is a * special variant of {@link #requestFocus() } that will allow views that are not focuable in * touch mode to request focus when they are touched. - * + * * @return Whether this view or one of its descendants actually took focus. - * + * * @see #isInTouchMode() - * + * */ public final boolean requestFocusFromTouch() { // Leave touch mode if we need to @@ -3115,7 +3165,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback { } return requestFocus(View.FOCUS_DOWN); } - + /** * @return Whether any ancestor of this view blocks descendant focus. */ @@ -3131,42 +3181,74 @@ public class View implements Drawable.Callback, KeyEvent.Callback { } return false; } - + + /** + * capture information of this view for later analysis: developement only + * check dynamic switch to make sure we only dump view + * when ViewDebug.SYSTEM_PROPERTY_CAPTURE_VIEW) is set + */ + private static void captureViewInfo(String subTag, View v) { + if (v == null || + SystemProperties.getInt(ViewDebug.SYSTEM_PROPERTY_CAPTURE_VIEW, 0) == 0) { + return; + } + ViewDebug.dumpCapturedView(subTag, v); + } + + /** + * Dispatch a key event before it is processed by any input method + * associated with the view hierarchy. This can be used to intercept + * key events in special situations before the IME consumes them; a + * typical example would be handling the BACK key to update the application's + * UI instead of allowing the IME to see it and close itself. + * + * @param event The key event to be dispatched. + * @return True if the event was handled, false otherwise. + */ + public boolean dispatchKeyEventPreIme(KeyEvent event) { + return onKeyPreIme(event.getKeyCode(), event); + } + /** * Dispatch a key event to the next view on the focus path. This path runs * from the top of the view tree down to the currently focused view. If this * view has focus, it will dispatch to itself. Otherwise it will dispatch * the next node down the focus path. This method also fires any key * listeners. - * + * * @param event The key event to be dispatched. * @return True if the event was handled, false otherwise. */ public boolean dispatchKeyEvent(KeyEvent event) { // If any attached key listener a first crack at the event. //noinspection SimplifiableIfStatement + + if (android.util.Config.LOGV) { + captureViewInfo("captureViewKeyEvent", this); + } + if (mOnKeyListener != null && (mViewFlags & ENABLED_MASK) == ENABLED && mOnKeyListener.onKey(this, event.getKeyCode(), event)) { return true; } - + return event.dispatch(this); } /** * Dispatches a key shortcut event. - * + * * @param event The key event to be dispatched. * @return True if the event was handled by the view, false otherwise. */ public boolean dispatchKeyShortcutEvent(KeyEvent event) { return onKeyShortcut(event.getKeyCode(), event); } - + /** * Pass the touch screen motion event down to the target view, or this * view if it is the target. - * + * * @param event The motion event to be dispatched. * @return True if the event was handled by the view, false otherwise. */ @@ -3180,7 +3262,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback { /** * Pass a trackball motion event down to the focused view. - * + * * @param event The motion event to be dispatched. * @return True if the event was handled by the view, false otherwise. */ @@ -3192,7 +3274,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback { /** * Called when the window containing this view gains or loses window focus. * ViewGroups should override to route to their children. - * + * * @param hasFocus True if the window containing this view now has focus, * false otherwise. */ @@ -3206,23 +3288,29 @@ public class View implements Drawable.Callback, KeyEvent.Callback { * your view and its window must have focus. If a window is displayed * on top of yours that takes input focus, then your own window will lose * focus but the view focus will remain unchanged. - * + * * @param hasWindowFocus True if the window containing this view now has * focus, false otherwise. */ public void onWindowFocusChanged(boolean hasWindowFocus) { + InputMethodManager imm = InputMethodManager.peekInstance(); if (!hasWindowFocus) { if (isPressed()) { setPressed(false); } + if (imm != null && (mPrivateFlags & FOCUSED) != 0) { + imm.focusOut(this); + } + } else if (imm != null && (mPrivateFlags & FOCUSED) != 0) { + imm.focusIn(this); } refreshDrawableState(); } - + /** * Returns true if this view is in a window that currently has window focus. * Note that this is not the same as the view itself having focus. - * + * * @return True if this view is in a window that currently has window focus. */ public boolean hasWindowFocus() { @@ -3232,9 +3320,9 @@ public class View implements Drawable.Callback, KeyEvent.Callback { /** * Dispatch a window visibility change down the view hierarchy. * ViewGroups should override to route to their children. - * + * * @param visibility The new visibility of the window. - * + * * @see #onWindowVisibilityChanged */ public void dispatchWindowVisibilityChanged(int visibility) { @@ -3248,22 +3336,59 @@ public class View implements Drawable.Callback, KeyEvent.Callback { * to the window manager; this does not tell you whether or not * your window is obscured by other windows on the screen, even if it * is itself visible. - * + * * @param visibility The new visibility of the window. */ protected void onWindowVisibilityChanged(int visibility) { } - + /** * Returns the current visibility of the window this view is attached to * (either {@link #GONE}, {@link #INVISIBLE}, or {@link #VISIBLE}). - * + * * @return Returns the current visibility of the view's window. */ public int getWindowVisibility() { return mAttachInfo != null ? mAttachInfo.mWindowVisibility : GONE; } - + + /** + * Retrieve the overall visible display size in which the window this view is + * attached to has been positioned in. This takes into account screen + * decorations above the window, for both cases where the window itself + * is being position inside of them or the window is being placed under + * then and covered insets are used for the window to position its content + * inside. In effect, this tells you the available area where content can + * be placed and remain visible to users. + * + *

    This function requires an IPC back to the window manager to retrieve + * the requested information, so should not be used in performance critical + * code like drawing. + * + * @param outRect Filled in with the visible display frame. If the view + * is not attached to a window, this is simply the raw display size. + */ + public void getWindowVisibleDisplayFrame(Rect outRect) { + if (mAttachInfo != null) { + try { + mAttachInfo.mSession.getDisplayFrame(mAttachInfo.mWindow, outRect); + } catch (RemoteException e) { + return; + } + // XXX This is really broken, and probably all needs to be done + // in the window manager, and we need to know more about whether + // we want the area behind or in front of the IME. + final Rect insets = mAttachInfo.mVisibleInsets; + outRect.left += insets.left; + outRect.top += insets.top; + outRect.right -= insets.right; + outRect.bottom -= insets.bottom; + return; + } + Display d = WindowManagerImpl.getDefault().getDefaultDisplay(); + outRect.set(0, 0, d.getWidth(), d.getHeight()); + } + /** * Private function to aggregate all per-view attributes in to the view * root. @@ -3278,7 +3403,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback { mAttachInfo.mKeepScreenOn = true; } } - + void needGlobalAttributesUpdate(boolean force) { AttachInfo ai = mAttachInfo; if (ai != null) { @@ -3287,7 +3412,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback { } } } - + /** * Returns whether the device is currently in touch mode. Touch mode is entered * once the user begins interacting with the device by touch, and affects various @@ -3306,21 +3431,38 @@ public class View implements Drawable.Callback, KeyEvent.Callback { /** * Returns the context the view is running in, through which it can - * access the current theme, resources, etc. - * + * access the current theme, resources, etc. + * * @return The view's Context. */ + @ViewDebug.CapturedViewProperty public final Context getContext() { return mContext; } + /** + * Handle a key event before it is processed by any input method + * associated with the view hierarchy. This can be used to intercept + * key events in special situations before the IME consumes them; a + * typical example would be handling the BACK key to update the application's + * UI instead of allowing the IME to see it and close itself. + * + * @param keyCode The value in event.getKeyCode(). + * @param event Description of the key event. + * @return If you handled the event, return true. If you want to allow the + * event to be handled by the next receiver, return false. + */ + public boolean onKeyPreIme(int keyCode, KeyEvent event) { + return false; + } + /** * Default implementation of {@link KeyEvent.Callback#onKeyMultiple(int, int, KeyEvent) * KeyEvent.Callback.onKeyMultiple()}: perform press of the view * when {@link KeyEvent#KEYCODE_DPAD_CENTER} or {@link KeyEvent#KEYCODE_ENTER} * is released, if the view is enabled and clickable. - * - * @param keyCode A key code that represents the button pressed, from + * + * @param keyCode A key code that represents the button pressed, from * {@link android.view.KeyEvent}. * @param event The KeyEvent object that defines the button action. */ @@ -3354,8 +3496,8 @@ public class View implements Drawable.Callback, KeyEvent.Callback { * KeyEvent.Callback.onKeyMultiple()}: perform clicking of the view * when {@link KeyEvent#KEYCODE_DPAD_CENTER} or * {@link KeyEvent#KEYCODE_ENTER} is released. - * - * @param keyCode A key code that represents the button pressed, from + * + * @param keyCode A key code that represents the button pressed, from * {@link android.view.KeyEvent}. * @param event The KeyEvent object that defines the button action. */ @@ -3390,8 +3532,8 @@ public class View implements Drawable.Callback, KeyEvent.Callback { * Default implementation of {@link KeyEvent.Callback#onKeyMultiple(int, int, KeyEvent) * KeyEvent.Callback.onKeyMultiple()}: always returns false (doesn't handle * the event). - * - * @param keyCode A key code that represents the button pressed, from + * + * @param keyCode A key code that represents the button pressed, from * {@link android.view.KeyEvent}. * @param repeatCount The number of times the action was made. * @param event The KeyEvent object that defines the button action. @@ -3402,7 +3544,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback { /** * Called when an unhandled key shortcut event occurs. - * + * * @param keyCode The value in event.getKeyCode(). * @param event Description of the key event. * @return If you handled the event, return true. If you want to allow the @@ -3411,11 +3553,23 @@ public class View implements Drawable.Callback, KeyEvent.Callback { public boolean onKeyShortcut(int keyCode, KeyEvent event) { return false; } - + + /** + * Create a new InputConnection for an InputMethod to interact + * with the view. The default implementation returns null, since it doesn't + * support input methods. You can override this to implement such support. + * This is only needed for views that take focus and text input. + * + * @param outAttrs Fill in with attribute information about the connection. + */ + public InputConnection createInputConnection(EditorInfo outAttrs) { + return null; + } + /** * Show the context menu for this view. It is not safe to hold on to the * menu after returning from this method. - * + * * @param menu The context menu to populate */ public void createContextMenu(ContextMenu menu) { @@ -3517,7 +3671,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback { if (mPendingCheckForLongPress != null) { removeCallbacks(mPendingCheckForLongPress); } - + // Only perform take click actions if we were in the pressed state if (!focusTaken) { performClick(); @@ -3548,10 +3702,10 @@ public class View implements Drawable.Callback, KeyEvent.Callback { case MotionEvent.ACTION_MOVE: final int x = (int) event.getX(); final int y = (int) event.getY(); - + // Be lenient about moving outside of buttons int slop = ViewConfiguration.getTouchSlop(); - if ((x < 0 - slop) || (x >= getWidth() + slop) || + if ((x < 0 - slop) || (x >= getWidth() + slop) || (y < 0 - slop) || (y >= getHeight() + slop)) { // Outside button if ((mPrivateFlags & PRESSED) != 0) { @@ -3598,7 +3752,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback { public void setTouchDelegate(TouchDelegate delegate) { mTouchDelegate = delegate; } - + /** * Gets the TouchDelegate for this View. */ @@ -3608,7 +3762,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback { /** * Set flags controlling behavior of this view. - * + * * @param flags Constant indicating the value which should be set * @param mask Constant indicating the bit range that should be changed */ @@ -3648,7 +3802,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback { mPrivateFlags |= DRAWN; needGlobalAttributesUpdate(true); - + // a view becoming visible is worth notifying the parent // about in case nothing has focus. even if this specific view // isn't focusable, it may contain something that is, so let @@ -3668,6 +3822,9 @@ public class View implements Drawable.Callback, KeyEvent.Callback { if (((mViewFlags & VISIBILITY_MASK) == GONE) && hasFocus()) { clearFocus(); } + if (mAttachInfo != null) { + mAttachInfo.mViewVisibilityChanged = true; + } } /* Check if the VISIBLE bit has changed */ @@ -3681,6 +3838,9 @@ public class View implements Drawable.Callback, KeyEvent.Callback { clearFocus(); } } + if (mAttachInfo != null) { + mAttachInfo.mViewVisibilityChanged = true; + } } if ((changed & WILL_NOT_CACHE_DRAWING) != 0) { @@ -3712,7 +3872,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback { mPrivateFlags &= ~SKIP_DRAW; mPrivateFlags |= ONLY_DRAWS_BACKGROUND; } else { - mPrivateFlags |= SKIP_DRAW; + mPrivateFlags |= SKIP_DRAW; } } else { mPrivateFlags &= ~SKIP_DRAW; @@ -3720,7 +3880,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback { requestLayout(); invalidate(); } - + if ((changed & KEEP_SCREEN_ON) != 0) { if (mParent != null) { mParent.recomputeViewAttributes(this); @@ -3740,10 +3900,10 @@ public class View implements Drawable.Callback, KeyEvent.Callback { /** * This is called in response to an internal scroll in this view (i.e., the - * view scrolled its own contents). This is typically as a result of + * view scrolled its own contents). This is typically as a result of * {@link #scrollBy(int, int)} or {@link #scrollTo(int, int)} having been * called. - * + * * @param l Current horizontal scroll origin. * @param t Current vertical scroll origin. * @param oldl Previous horizontal scroll origin. @@ -3757,7 +3917,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback { * This is called during layout when the size of this view has changed. If * you were just added to the view hierarchy, you're called with the old * values of 0. - * + * * @param w Current width of this view. * @param h Current height of this view. * @param oldw Old width of this view. @@ -3765,7 +3925,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback { */ protected void onSizeChanged(int w, int h, int oldw, int oldh) { } - + /** * Called by draw to draw the child views. This may be overridden * by derived classes to gain control just before its children are drawn @@ -3778,7 +3938,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback { /** * Gets the parent of this view. Note that the parent is a * ViewParent and not necessarily a View. - * + * * @return Parent of this view. */ public final ViewParent getParent() { @@ -3790,7 +3950,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback { * the displayed part of your view. You do not need to draw any pixels * farther left, since those are outside of the frame of your view on * screen. - * + * * @return The left edge of the displayed part of your view, in pixels. */ public final int getScrollX() { @@ -3801,7 +3961,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback { * Return the scrolled top position of this view. This is the top edge of * the displayed part of your view. You do not need to draw any pixels above * it, since those are outside of the frame of your view on screen. - * + * * @return The top edge of the displayed part of your view, in pixels. */ public final int getScrollY() { @@ -3810,7 +3970,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback { /** * Return the width of the your view. - * + * * @return The width of your view, in pixels. */ @ViewDebug.ExportedProperty @@ -3820,7 +3980,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback { /** * Return the height of your view. - * + * * @return The height of your view, in pixels. */ @ViewDebug.ExportedProperty @@ -3832,7 +3992,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback { * Return the visible drawing bounds of your view. Fills in the output * rectangle with the values from getScrollX(), getScrollY(), * getWidth(), and getHeight(). - * + * * @param outRect The (scrolled) drawing bounds of the view. */ public void getDrawingRect(Rect outRect) { @@ -3846,69 +4006,73 @@ public class View implements Drawable.Callback, KeyEvent.Callback { * The width of this view as measured in the most recent call to measure(). * This should be used during measurement and layout calculations only. Use * {@link #getWidth()} to see how wide a view is after layout. - * + * * @return The measured width of this view. */ public final int getMeasuredWidth() { return mMeasuredWidth; } - + /** * The height of this view as measured in the most recent call to measure(). * This should be used during measurement and layout calculations only. Use * {@link #getHeight()} to see how tall a view is after layout. - * + * * @return The measured height of this view. */ public final int getMeasuredHeight() { return mMeasuredHeight; } - + /** * Top position of this view relative to its parent. - * + * * @return The top of this view, in pixels. */ + @ViewDebug.CapturedViewProperty public final int getTop() { return mTop; } - + /** * Bottom position of this view relative to its parent. - * + * * @return The bottom of this view, in pixels. */ + @ViewDebug.CapturedViewProperty public final int getBottom() { return mBottom; } - + /** * Left position of this view relative to its parent. - * + * * @return The left edge of this view, in pixels. */ + @ViewDebug.CapturedViewProperty public final int getLeft() { return mLeft; } - + /** * Right position of this view relative to its parent. - * + * * @return The right edge of this view, in pixels. */ + @ViewDebug.CapturedViewProperty public final int getRight() { return mRight; } /** * Hit rectangle in parent's coordinates - * + * * @param outRect The hit rectangle of the view. */ public void getHitRect(Rect outRect) { outRect.set(mLeft, mTop, mRight, mBottom); } - + /** * When a view has focus and the user navigates away from it, the next view is searched for * starting from the rectangle filled in by this method. @@ -3929,7 +4093,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback { * coordinates, offset it by -globalOffset (e.g. r.offset(-globalOffset.x, * -globalOffset.y)) If the view is completely clipped or translated out, * return false. - * + * * @param r If true is returned, r holds the global coordinates of the * visible portion of this view. * @param globalOffset If true is returned, globalOffset holds the dx,dy @@ -3962,7 +4126,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback { } return false; } - + /** * Offset this view's vertical location by the specified number of pixels. * @@ -3975,18 +4139,18 @@ public class View implements Drawable.Callback, KeyEvent.Callback { /** * Offset this view's horizontal location by the specified amount of pixels. - * + * * @param offset the numer of pixels to offset the view by */ public void offsetLeftAndRight(int offset) { mLeft += offset; mRight += offset; } - + /** * Get the LayoutParams associated with this view. All views should have - * layout parameters. These supply parameters to the parent of this - * view specifying how it should be arranged. There are many subclasses of + * layout parameters. These supply parameters to the parent of this + * view specifying how it should be arranged. There are many subclasses of * ViewGroup.LayoutParams, and these correspond to the different subclasses * of ViewGroup that are responsible for arranging their children. * @return The LayoutParams associated with this view @@ -4012,7 +4176,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback { mLayoutParams = params; requestLayout(); } - + /** * Set the scrolled position of your view. This will cause a call to * {@link #onScrollChanged(int, int, int, int)} and the view will be @@ -4047,7 +4211,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback { * visible, {@link #onDraw} will be called at some point in the future. * This must be called from a UI thread. To call from a non-UI thread, call * {@link #postInvalidate()}. - * + * * WARNING: This method is destructive to dirty. * @param dirty the rectangle representing the bounds of the dirty region */ @@ -4058,13 +4222,15 @@ public class View implements Drawable.Callback, KeyEvent.Callback { if ((mPrivateFlags & (DRAWN | HAS_BOUNDS)) == (DRAWN | HAS_BOUNDS)) { mPrivateFlags &= ~DRAWING_CACHE_VALID; - ViewParent p = mParent; - if (p != null) { + final ViewParent p = mParent; + final AttachInfo ai = mAttachInfo; + if (p != null && ai != null) { final int scrollX = mScrollX; final int scrollY = mScrollY; - mTempRect.set(dirty.left - scrollX, dirty.top - scrollY, - dirty.right - scrollX, dirty.bottom - scrollY); - p.invalidateChild(this, mTempRect); + final Rect r = ai.mTmpInvalRect; + r.set(dirty.left - scrollX, dirty.top - scrollY, + dirty.right - scrollX, dirty.bottom - scrollY); + mParent.invalidateChild(this, r); } } } @@ -4087,12 +4253,14 @@ public class View implements Drawable.Callback, KeyEvent.Callback { if ((mPrivateFlags & (DRAWN | HAS_BOUNDS)) == (DRAWN | HAS_BOUNDS)) { mPrivateFlags &= ~DRAWING_CACHE_VALID; - ViewParent p = mParent; - if (p != null && l < r && t < b) { + final ViewParent p = mParent; + final AttachInfo ai = mAttachInfo; + if (p != null && ai != null && l < r && t < b) { final int scrollX = mScrollX; final int scrollY = mScrollY; - mTempRect.set(l - scrollX, t - scrollY, r - scrollX, b - scrollY); - p.invalidateChild(this, mTempRect); + final Rect tmpr = ai.mTmpInvalRect; + tmpr.set(l - scrollX, t - scrollY, r - scrollX, b - scrollY); + p.invalidateChild(this, tmpr); } } } @@ -4109,25 +4277,27 @@ public class View implements Drawable.Callback, KeyEvent.Callback { if ((mPrivateFlags & (DRAWN | HAS_BOUNDS)) == (DRAWN | HAS_BOUNDS)) { mPrivateFlags &= ~DRAWN & ~DRAWING_CACHE_VALID; - ViewParent p = mParent; - if (p != null) { - mTempRect.set(0, 0, mRight - mLeft, mBottom - mTop); + final ViewParent p = mParent; + final AttachInfo ai = mAttachInfo; + if (p != null && ai != null) { + final Rect r = ai.mTmpInvalRect; + r.set(0, 0, mRight - mLeft, mBottom - mTop); // Don't call invalidate -- we don't want to internally scroll // our own bounds - p.invalidateChild(this, mTempRect); + p.invalidateChild(this, r); } } } - + /** * @return A handler associated with the thread running the View. This * handler can be used to pump events in the UI events queue. */ - protected Handler getHandler() { + public Handler getHandler() { if (mAttachInfo != null) { return mAttachInfo.mHandler; } - return null; + return null; } /** @@ -4260,7 +4430,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback { /** * Cause an invalidate to happen on a subsequent cycle through the event * loop. Waits for the specified amount of time. - * + * * @param delayMilliseconds the duration in milliseconds to delay the * invalidation by */ @@ -4304,7 +4474,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback { * Called by a parent to request that a child update its values for mScrollX * and mScrollY if necessary. This will typically be done if the child is * animating a scroll using a {@link android.widget.Scroller Scroller} - * object. + * object. */ public void computeScroll() { } @@ -4337,7 +4507,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback { public void setHorizontalFadingEdgeEnabled(boolean horizontalFadingEdgeEnabled) { if (isHorizontalFadingEdgeEnabled() != horizontalFadingEdgeEnabled) { if (horizontalFadingEdgeEnabled) { - initScrollCache(); + initScrollCache(); } mViewFlags ^= FADING_EDGE_HORIZONTAL; @@ -4504,12 +4674,12 @@ public class View implements Drawable.Callback, KeyEvent.Callback { * inset. When inset, they add to the padding of the view. And the scrollbars * can be drawn inside the padding area or on the edge of the view. For example, * if a view has a background drawable and you want to draw the scrollbars - * inside the padding specified by the drawable, you can use + * inside the padding specified by the drawable, you can use * SCROLLBARS_INSIDE_OVERLAY or SCROLLBARS_INSIDE_INSET. If you want them to * appear at the edge of the view, ignoring the padding, then you can use - * SCROLLBARS_OUTSIDE_OVERLAY or SCROLLBARS_OUTSIDE_INSET.

    - * @param style the style of the scrollbars. Should be one of - * SCROLLBARS_INSIDE_OVERLAY, SCROLLBARS_INSIDE_INSET, + * SCROLLBARS_OUTSIDE_OVERLAY or SCROLLBARS_OUTSIDE_INSET.

    + * @param style the style of the scrollbars. Should be one of + * SCROLLBARS_INSIDE_OVERLAY, SCROLLBARS_INSIDE_INSET, * SCROLLBARS_OUTSIDE_OVERLAY or SCROLLBARS_OUTSIDE_INSET. * @see #SCROLLBARS_INSIDE_OVERLAY * @see #SCROLLBARS_INSIDE_INSET @@ -4517,12 +4687,12 @@ public class View implements Drawable.Callback, KeyEvent.Callback { * @see #SCROLLBARS_OUTSIDE_INSET */ public void setScrollBarStyle(int style) { - if (style != (mViewFlags & SCROLLBARS_STYLE_MASK)) { + if (style != (mViewFlags & SCROLLBARS_STYLE_MASK)) { mViewFlags = (mViewFlags & ~SCROLLBARS_STYLE_MASK) | (style & SCROLLBARS_STYLE_MASK); recomputePadding(); } } - + /** *

    Returns the current scrollbar style.

    * @return the current scrollbar style @@ -4534,7 +4704,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback { public int getScrollBarStyle() { return mViewFlags & SCROLLBARS_STYLE_MASK; } - + /** *

    Compute the horizontal range that the horizontal scrollbar * represents.

    @@ -4670,10 +4840,10 @@ public class View implements Drawable.Callback, KeyEvent.Callback { final ScrollabilityCache cache = mScrollCache; if (cache != null) { final int viewFlags = mViewFlags; - - final boolean drawHorizontalScrollBar = + + final boolean drawHorizontalScrollBar = (viewFlags & SCROLLBARS_HORIZONTAL) == SCROLLBARS_HORIZONTAL; - final boolean drawVerticalScrollBar = + final boolean drawVerticalScrollBar = (viewFlags & SCROLLBARS_VERTICAL) == SCROLLBARS_VERTICAL; if (drawVerticalScrollBar || drawHorizontalScrollBar) { @@ -4728,12 +4898,12 @@ public class View implements Drawable.Callback, KeyEvent.Callback { final int scrollY = mScrollY; final int inside = (viewFlags & SCROLLBARS_OUTSIDE_MASK) == 0 ? ~0 : 0; final int top = scrollY + height - size - (mUserPaddingBottom & inside); - - final int verticalScrollBarGap = + + final int verticalScrollBarGap = (viewFlags & SCROLLBARS_VERTICAL) == SCROLLBARS_VERTICAL ? getVerticalScrollbarWidth() : 0; - - scrollBar.setBounds(scrollX + (mPaddingLeft & inside) + getScrollBarPaddingLeft(), top, + + scrollBar.setBounds(scrollX + (mPaddingLeft & inside) + getScrollBarPaddingLeft(), top, scrollX + width - (mUserPaddingRight & inside) - verticalScrollBarGap, top + size); scrollBar.setParameters( computeHorizontalScrollRange(), @@ -4773,8 +4943,8 @@ public class View implements Drawable.Callback, KeyEvent.Callback { final int inside = (mViewFlags & SCROLLBARS_OUTSIDE_MASK) == 0 ? ~0 : 0; // TODO: Deal with RTL languages to position scrollbar on left final int left = scrollX + width - size - (mUserPaddingRight & inside); - - scrollBar.setBounds(left, scrollY + (mPaddingTop & inside), + + scrollBar.setBounds(left, scrollY + (mPaddingTop & inside), left + size, scrollY + height - (mUserPaddingBottom & inside)); scrollBar.setParameters( computeVerticalScrollRange(), @@ -4832,7 +5002,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback { removeCallbacks(mPendingCheckForLongPress); } } - + /** * @return The number of times this view has been attached to a window */ @@ -4855,7 +5025,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback { * {@link #getWindowToken}, except if the window this view in is a panel * window (attached to another containing window), then the token of * the containing window is returned instead. - * + * * @return Returns the associated window token, either * {@link #getWindowToken()} or the containing window's token. */ @@ -4892,6 +5062,10 @@ public class View implements Drawable.Callback, KeyEvent.Callback { info.mTreeObserver.merge(mFloatingTreeObserver); mFloatingTreeObserver = null; } + if ((mPrivateFlags&SCROLL_CONTAINER) != 0) { + mAttachInfo.mScrollContainers.add(this); + mPrivateFlags |= SCROLL_CONTAINER_ADDED; + } performCollectViewAttributes(visibility); onAttachedToWindow(); int vis = info.mWindowVisibility; @@ -4909,16 +5083,20 @@ public class View implements Drawable.Callback, KeyEvent.Callback { onWindowVisibilityChanged(GONE); } } - + onDetachedFromWindow(); + if ((mPrivateFlags&SCROLL_CONTAINER_ADDED) != 0) { + mAttachInfo.mScrollContainers.remove(this); + mPrivateFlags &= ~SCROLL_CONTAINER_ADDED; + } mAttachInfo = null; } /** * Store this view hierarchy's frozen state into the given container. - * + * * @param container The SparseArray in which to save the view's state. - * + * * @see #restoreHierarchyState * @see #dispatchSaveInstanceState * @see #onSaveInstanceState @@ -4931,9 +5109,9 @@ public class View implements Drawable.Callback, KeyEvent.Callback { * Called by {@link #saveHierarchyState} to store the state for this view and its children. * May be overridden to modify how freezing happens to a view's children; for example, some * views may want to not store state for their children. - * + * * @param container The SparseArray in which to save the view's state. - * + * * @see #dispatchRestoreInstanceState * @see #saveHierarchyState * @see #onSaveInstanceState @@ -4966,7 +5144,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback { * in a text view (but usually not the text itself since that is stored in a * content provider or other persistent storage), the currently selected * item in a list view. - * + * * @return Returns a Parcelable object containing the view's current dynamic * state, or null if there is nothing interesting to save. The * default implementation returns null. @@ -4982,9 +5160,9 @@ public class View implements Drawable.Callback, KeyEvent.Callback { /** * Restore this view hierarchy's frozen state from the given container. - * + * * @param container The SparseArray which holds previously frozen states. - * + * * @see #saveHierarchyState * @see #dispatchRestoreInstanceState * @see #onRestoreInstanceState @@ -4997,9 +5175,9 @@ public class View implements Drawable.Callback, KeyEvent.Callback { * Called by {@link #restoreHierarchyState} to retrieve the state for this view and its * children. May be overridden to modify how restoreing happens to a view's children; for * example, some views may want to not store state for their children. - * + * * @param container The SparseArray which holds previously saved state. - * + * * @see #dispatchSaveInstanceState * @see #restoreHierarchyState * @see #onRestoreInstanceState @@ -5024,10 +5202,10 @@ public class View implements Drawable.Callback, KeyEvent.Callback { * Hook allowing a view to re-apply a representation of its internal state that had previously * been generated by {@link #onSaveInstanceState}. This function will never be called with a * null state. - * + * * @param state The frozen state that had previously been returned by * {@link #onSaveInstanceState}. - * + * * @see #onSaveInstanceState * @see #restoreHierarchyState * @see #dispatchRestoreInstanceState @@ -5038,7 +5216,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback { throw new IllegalArgumentException("Wrong state class -- expecting View State"); } } - + /** *

    Return the time at which the drawing of the view hierarchy started.

    * @@ -5095,7 +5273,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback { * * @see #isDrawingCacheEnabled() * @see #getDrawingCache() - * @see #buildDrawingCache() + * @see #buildDrawingCache() */ public void setDrawingCacheEnabled(boolean enabled) { setFlags(enabled ? DRAWING_CACHE_ENABLED : 0, DRAWING_CACHE_ENABLED); @@ -5126,7 +5304,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback { * * @see #setDrawingCacheEnabled(boolean) * @see #isDrawingCacheEnabled() - * @see #buildDrawingCache() + * @see #buildDrawingCache() * @see #destroyDrawingCache() */ public Bitmap getDrawingCache() { @@ -5148,7 +5326,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback { * * @see #setDrawingCacheEnabled(boolean) * @see #buildDrawingCache() - * @see #getDrawingCache() + * @see #getDrawingCache() */ public void destroyDrawingCache() { if (mDrawingCache != null) { @@ -5156,31 +5334,31 @@ public class View implements Drawable.Callback, KeyEvent.Callback { mDrawingCache = null; } } - + /** * Setting a solid background color for the drawing cache's bitmaps will improve * perfromance and memory usage. Note, though that this should only be used if this * view will always be drawn on top of a solid color. - * + * * @param color The background color to use for the drawing cache's bitmap - * + * * @see #setDrawingCacheEnabled(boolean) * @see #buildDrawingCache() - * @see #getDrawingCache() + * @see #getDrawingCache() */ public void setDrawingCacheBackgroundColor(int color) { mDrawingCacheBackgroundColor = color; } - + /** * @see #setDrawingCacheBackgroundColor(int) - * + * * @return The background color to used for the drawing cache's bitmap */ public int getDrawingCacheBackgroundColor() { return mDrawingCacheBackgroundColor; } - + /** *

    Forces the drawing cache to be built if the drawing cache is invalid.

    * @@ -5204,7 +5382,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback { final int height = mBottom - mTop; final int drawingCacheBackgroundColor = mDrawingCacheBackgroundColor; - final boolean opaque = drawingCacheBackgroundColor != 0 || + final boolean opaque = drawingCacheBackgroundColor != 0 || (mBGDrawable != null && mBGDrawable.getOpacity() == PixelFormat.OPAQUE); if (width <= 0 || height <= 0 || @@ -5242,9 +5420,22 @@ public class View implements Drawable.Callback, KeyEvent.Callback { quality = Bitmap.Config.RGB_565; } - mDrawingCache = bitmap = Bitmap.createBitmap(width, height, quality); + // Try to cleanup memory + if (mDrawingCache != null) { + mDrawingCache.recycle(); + } - clear = drawingCacheBackgroundColor != 0; + try { + mDrawingCache = bitmap = Bitmap.createBitmap(width, height, quality); + } catch (OutOfMemoryError e) { + // If there is not enough memory to create the bitmap cache, just + // ignore the issue as bitmap caches are not required to draw the + // view hierarchy + mDrawingCache = null; + return; + } + + clear = drawingCacheBackgroundColor != 0; } Canvas canvas; @@ -5293,7 +5484,103 @@ public class View implements Drawable.Callback, KeyEvent.Callback { mPrivateFlags |= DRAWING_CACHE_VALID; } } - + + /** + * Indicates whether this View is currently in edit mode. A View is usually + * in edit mode when displayed within a developer tool. For instance, if + * this View is being drawn by a visual user interface builder, this method + * should return true. + * + * Subclasses should check the return value of this method to provide + * different behaviors if their normal behavior might interfere with the + * host environment. For instance: the class spawns a thread in its + * constructor, the drawing code relies on device-specific features, etc. + * + * This method is usually checked in the drawing code of custom widgets. + * + * @return True if this View is in edit mode, false otherwise. + */ + public boolean isInEditMode() { + return false; + } + + /** + * If the View draws content inside its padding and enables fading edges, + * it needs to support padding offsets. Padding offsets are added to the + * fading edges to extend the length of the fade so that it covers pixels + * drawn inside the padding. + * + * Subclasses of this class should override this method if they need + * to draw content inside the padding. + * + * @return True if padding offset must be applied, false otherwise. + * + * @see #getLeftPaddingOffset() + * @see #getRightPaddingOffset() + * @see #getTopPaddingOffset() + * @see #getBottomPaddingOffset() + * + * @since CURRENT + */ + protected boolean isPaddingOffsetRequired() { + return false; + } + + /** + * Amount by which to extend the left fading region. Called only when + * {@link #isPaddingOffsetRequired()} returns true. + * + * @return The left padding offset in pixels. + * + * @see #isPaddingOffsetRequired() + * + * @since CURRENT + */ + protected int getLeftPaddingOffset() { + return 0; + } + + /** + * Amount by which to extend the right fading region. Called only when + * {@link #isPaddingOffsetRequired()} returns true. + * + * @return The right padding offset in pixels. + * + * @see #isPaddingOffsetRequired() + * + * @since CURRENT + */ + protected int getRightPaddingOffset() { + return 0; + } + + /** + * Amount by which to extend the top fading region. Called only when + * {@link #isPaddingOffsetRequired()} returns true. + * + * @return The top padding offset in pixels. + * + * @see #isPaddingOffsetRequired() + * + * @since CURRENT + */ + protected int getTopPaddingOffset() { + return 0; + } + + /** + * Amount by which to extend the bottom fading region. Called only when + * {@link #isPaddingOffsetRequired()} returns true. + * + * @return The bottom padding offset in pixels. + * + * @see #isPaddingOffsetRequired() + * + * @since CURRENT + */ + protected int getBottomPaddingOffset() { + return 0; + } /** * Manually render this view (and all of its children) to the given Canvas. @@ -5379,13 +5666,24 @@ public class View implements Drawable.Callback, KeyEvent.Callback { float rightFadeStrength = 0.0f; // Step 2, save the canvas' layers - final int paddingLeft = mPaddingLeft; - final int paddingTop = mPaddingTop; + int paddingLeft = mPaddingLeft; + int paddingTop = mPaddingTop; + + final boolean offsetRequired = isPaddingOffsetRequired(); + if (offsetRequired) { + paddingLeft += getLeftPaddingOffset(); + paddingTop += getTopPaddingOffset(); + } - final int left = mScrollX + paddingLeft; - final int right = left + mRight - mLeft - mPaddingRight - paddingLeft; - final int top = mScrollY + paddingTop; - final int bottom = top + mBottom - mTop - mPaddingBottom - paddingTop; + int left = mScrollX + paddingLeft; + int right = left + mRight - mLeft - mPaddingRight - paddingLeft; + int top = mScrollY + paddingTop; + int bottom = top + mBottom - mTop - mPaddingBottom - paddingTop; + + if (offsetRequired) { + right += getRightPaddingOffset(); + bottom += getBottomPaddingOffset(); + } final ScrollabilityCache scrollabilityCache = mScrollCache; int length = scrollabilityCache.fadingEdgeLength; @@ -5416,23 +5714,23 @@ public class View implements Drawable.Callback, KeyEvent.Callback { } saveCount = canvas.getSaveCount(); - + int solidColor = getSolidColor(); if (solidColor == 0) { final int flags = Canvas.HAS_ALPHA_LAYER_SAVE_FLAG; - + if (drawTop) { canvas.saveLayer(left, top, right, top + length, null, flags); } - + if (drawBottom) { canvas.saveLayer(left, bottom - length, right, bottom, null, flags); } - + if (drawLeft) { canvas.saveLayer(left, top, left + length, bottom, null, flags); } - + if (drawRight) { canvas.saveLayer(right - length, top, right, bottom, null, flags); } @@ -5495,10 +5793,10 @@ public class View implements Drawable.Callback, KeyEvent.Callback { * and needs to draw fading edges. Returning a non-zero color enables the view system to * optimize the drawing of the fading edges. If you do return a non-zero color, the alpha * should be set to 0xFF. - * + * * @see #setVerticalFadingEdgeEnabled * @see #setHorizontalFadingEdgeEnabled - * + * * @return The known solid color background for this view, or 0 if the color may vary */ public int getSolidColor() { @@ -5550,12 +5848,12 @@ public class View implements Drawable.Callback, KeyEvent.Callback { private static String printPrivateFlags(int privateFlags) { String output = ""; int numFlags = 0; - + if ((privateFlags & WANTS_FOCUS) == WANTS_FOCUS) { output += "WANTS_FOCUS"; numFlags++; } - + if ((privateFlags & FOCUSED) == FOCUSED) { if (numFlags > 0) { output += " "; @@ -5563,7 +5861,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback { output += "FOCUSED"; numFlags++; } - + if ((privateFlags & SELECTED) == SELECTED) { if (numFlags > 0) { output += " "; @@ -5571,15 +5869,15 @@ public class View implements Drawable.Callback, KeyEvent.Callback { output += "SELECTED"; numFlags++; } - + if ((privateFlags & IS_ROOT_NAMESPACE) == IS_ROOT_NAMESPACE) { if (numFlags > 0) { output += " "; } output += "IS_ROOT_NAMESPACE"; numFlags++; - } - + } + if ((privateFlags & HAS_BOUNDS) == HAS_BOUNDS) { if (numFlags > 0) { output += " "; @@ -5587,7 +5885,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback { output += "HAS_BOUNDS"; numFlags++; } - + if ((privateFlags & DRAWN) == DRAWN) { if (numFlags > 0) { output += " "; @@ -5611,17 +5909,17 @@ public class View implements Drawable.Callback, KeyEvent.Callback { /** * Assign a size and position to a view and all of its * descendants - * - *

    This is the second phase of the layout mechanism. + * + *

    This is the second phase of the layout mechanism. * (The first is measuring). In this phase, each parent calls * layout on all of its children to position them. * This is typically done using the child measurements * that were stored in the measure pass(). - * + * * Derived classes with children should override * onLayout. In that method, they should * call layout on each of their their children. - * + * * @param l Left position, relative to parent * @param t Top position, relative to parent * @param r Right position, relative to parent @@ -5639,11 +5937,11 @@ public class View implements Drawable.Callback, KeyEvent.Callback { } mPrivateFlags &= ~FORCE_LAYOUT; } - + /** * Called from layout when this view should * assign a size and position to each of its children. - * + * * Derived classes with children should override * this method and call layout on each of * their their children. @@ -5655,12 +5953,12 @@ public class View implements Drawable.Callback, KeyEvent.Callback { */ protected void onLayout(boolean changed, int left, int top, int right, int bottom) { } - + /** * Assign a size and position to this view. - * + * * This is called from layout. - * + * * @param left Left position, relative to parent * @param top Top position, relative to parent * @param right Right position, relative to parent @@ -5699,7 +5997,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback { int newWidth = right - left; int newHeight = bottom - top; - + if (newWidth != oldWidth || newHeight != oldHeight) { onSizeChanged(newWidth, newHeight, oldWidth, oldHeight); } @@ -5725,7 +6023,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback { /** * Finalize inflating a view from XML. This is called as the last phase * of inflation, after all child views have been added. - * + * *

    Even if the subclass overrides onFinishInflate, they should always be * sure to call the super method, so that we get called. */ @@ -5734,7 +6032,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback { /** * Returns the resources associated with this view. - * + * * @return Resources object. */ public Resources getResources() { @@ -5787,9 +6085,9 @@ public class View implements Drawable.Callback, KeyEvent.Callback { * Unschedule any events associated with the given Drawable. This can be * used when selecting a new Drawable into a view, so that the previous * one is completely unscheduled. - * + * * @param who The Drawable to unschedule. - * + * * @see #drawableStateChanged */ public void unscheduleDrawable(Drawable who) { @@ -5803,17 +6101,17 @@ public class View implements Drawable.Callback, KeyEvent.Callback { * override this function and return true for any Drawable it is * displaying. This allows animations for those drawables to be * scheduled. - * + * *

    Be sure to call through to the super class when overriding this * function. - * + * * @param who The Drawable to verify. Return true if it is one you are * displaying, else return the result of calling through to the * super class. - * + * * @return boolean If true than the Drawable is being displayed in the * view; else false and it is not allowed to animate. - * + * * @see #unscheduleDrawable * @see #drawableStateChanged */ @@ -5824,7 +6122,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback { /** * This function is called whenever the state of the view changes in such * a way that it impacts the state of drawables being shown. - * + * *

    Be sure to call through to the superclass when overriding this * function. * @@ -5836,12 +6134,12 @@ public class View implements Drawable.Callback, KeyEvent.Callback { d.setState(getDrawableState()); } } - + /** * Call this to force a view to update its drawable state. This will cause * drawableStateChanged to be called on this view. Views that are interested * in the new state should call getDrawableState. - * + * * @see #drawableStateChanged * @see #getDrawableState */ @@ -5858,9 +6156,9 @@ public class View implements Drawable.Callback, KeyEvent.Callback { /** * Return an array of resource IDs of the drawable states representing the * current state of the view. - * + * * @return The current drawable state - * + * * @see Drawable#setState * @see #drawableStateChanged * @see #onCreateDrawableState @@ -5880,14 +6178,14 @@ public class View implements Drawable.Callback, KeyEvent.Callback { * this view. This is called by the view * system when the cached Drawable state is determined to be invalid. To * retrieve the current state, you should use {@link #getDrawableState}. - * + * * @param extraSpace if non-zero, this is the number of extra entries you * would like in the returned array in which you can place your own * states. - * + * * @return Returns an array holding the current {@link Drawable} state of * the view. - * + * * @see #mergeDrawableStates */ protected int[] onCreateDrawableState(int extraSpace) { @@ -5897,22 +6195,20 @@ public class View implements Drawable.Callback, KeyEvent.Callback { } int[] drawableState; - + int privateFlags = mPrivateFlags; - boolean isPressed = (privateFlags & PRESSED) != 0; - int viewStateIndex = (isPressed ? 1 : 0); + int viewStateIndex = (((privateFlags & PRESSED) != 0) ? 1 : 0); - boolean isEnabled = (mViewFlags & ENABLED_MASK) == ENABLED; - viewStateIndex = (viewStateIndex << 1) + (isEnabled ? 1 : 0); + viewStateIndex = (viewStateIndex << 1) + + (((mViewFlags & ENABLED_MASK) == ENABLED) ? 1 : 0); - boolean isFocused = isFocused(); - viewStateIndex = (viewStateIndex << 1) + (isFocused ? 1 : 0); - - boolean isSelected = (privateFlags & SELECTED) != 0; - viewStateIndex = (viewStateIndex << 1) + (isSelected ? 1 : 0); - - boolean hasWindowFocus = hasWindowFocus(); + viewStateIndex = (viewStateIndex << 1) + (isFocused() ? 1 : 0); + + viewStateIndex = (viewStateIndex << 1) + + (((privateFlags & SELECTED) != 0) ? 1 : 0); + + final boolean hasWindowFocus = hasWindowFocus(); viewStateIndex = (viewStateIndex << 1) + (hasWindowFocus ? 1 : 0); drawableState = VIEW_STATE_SETS[viewStateIndex]; @@ -5920,9 +6216,12 @@ public class View implements Drawable.Callback, KeyEvent.Callback { //noinspection ConstantIfStatement if (false) { Log.i("View", "drawableStateIndex=" + viewStateIndex); - Log.i("View", toString() + " pressed=" + isPressed - + " en=" + isEnabled + " fo=" + isFocused - + " sl=" + isSelected + " wf=" + hasWindowFocus + Log.i("View", toString() + + " pressed=" + ((privateFlags & PRESSED) != 0) + + " en=" + ((mViewFlags & ENABLED_MASK) == ENABLED) + + " fo=" + hasFocus() + + " sl=" + ((privateFlags & SELECTED) != 0) + + " wf=" + hasWindowFocus + ": " + Arrays.toString(drawableState)); } @@ -5940,22 +6239,22 @@ public class View implements Drawable.Callback, KeyEvent.Callback { return fullState; } - + /** * Merge your own state values in additionalState into the base * state values baseState that were returned by * {@link #onCreateDrawableState}. - * + * * @param baseState The base state values returned by * {@link #onCreateDrawableState}, which will be modified to also hold your * own additional state values. - * + * * @param additionalState The additional state values you would like * added to baseState; this array is not modified. - * + * * @return As a convenience, the baseState array you originally * passed into the function is returned. - * + * * @see #onCreateDrawableState */ protected static int[] mergeDrawableStates(int[] baseState, int[] additionalState) { @@ -5967,7 +6266,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback { System.arraycopy(additionalState, 0, baseState, i + 1, additionalState.length); return baseState; } - + /** * Sets the background color for this view. * @param color the color of the background @@ -5975,7 +6274,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback { public void setBackgroundColor(int color) { setBackgroundDrawable(new ColorDrawable(color)); } - + /** * Set the background to a given resource. The resource should refer to * a Drawable object. @@ -6002,13 +6301,13 @@ public class View implements Drawable.Callback, KeyEvent.Callback { * padding. However, when a background is removed, this View's padding isn't * touched. If setting the padding is desired, please use * {@link #setPadding(int, int, int, int)}. - * + * * @param d The Drawable to use as the background, or null to remove the * background */ public void setBackgroundDrawable(Drawable d) { boolean requestLayout = false; - + mBackgroundResource = 0; /* @@ -6021,11 +6320,15 @@ public class View implements Drawable.Callback, KeyEvent.Callback { } if (d != null) { - final Rect padding = mTempRect; + Rect padding = sThreadLocal.get(); + if (padding == null) { + padding = new Rect(); + sThreadLocal.set(padding); + } if (d.getPadding(padding)) { setPadding(padding.left, padding.top, padding.right, padding.bottom); } - + // Compare the minimum sizes of the old Drawable and the new. If there isn't an old or // if it has a different minimum size, we should layout again if (mBGDrawable == null || mBGDrawable.getMinimumHeight() != d.getMinimumHeight() || @@ -6048,7 +6351,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback { } else { /* Remove the background */ mBGDrawable = null; - + if ((mPrivateFlags & ONLY_DRAWS_BACKGROUND) != 0) { /* * This view ONLY drew the background before and we're removing @@ -6065,7 +6368,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback { * padding. This is noted in the Javadocs. Hence, we don't need to * requestLayout(), the invalidate() below is sufficient. */ - + // The old background's minimum size could have affected this // View's layout, so let's requestLayout requestLayout = true; @@ -6091,7 +6394,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback { // TODO: Deal with RTL languages return 0; } - + /* * Returns the pixels occupied by the vertical scrollbar, if not overlaid */ @@ -6114,7 +6417,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback { } /** - * Sets the padding. The view may add on the space required to display + * Sets the padding. The view may add on the space required to display * the scrollbars, depending on the style and visibility of the scrollbars. * So the values returned from {@link #getPaddingLeft}, {@link #getPaddingTop}, * {@link #getPaddingRight} and {@link #getPaddingBottom} may be different @@ -6132,10 +6435,10 @@ public class View implements Drawable.Callback, KeyEvent.Callback { */ public void setPadding(int left, int top, int right, int bottom) { boolean changed = false; - + mUserPaddingRight = right; mUserPaddingBottom = bottom; - + if (mPaddingLeft != left + getScrollBarPaddingLeft()) { changed = true; mPaddingLeft = left; @@ -6216,17 +6519,17 @@ public class View implements Drawable.Callback, KeyEvent.Callback { dispatchSetSelected(selected); } } - + /** * Dispatch setSelected to all of this View's children. - * + * * @see #setSelected(boolean) - * + * * @param selected The new selected state */ protected void dispatchSetSelected(boolean selected) { } - + /** * Indicates the selection state of this view. * @@ -6265,6 +6568,13 @@ public class View implements Drawable.Callback, KeyEvent.Callback { * @return the topmost view containing this view */ public View getRootView() { + if (mAttachInfo != null) { + final View v = mAttachInfo.mRootView; + if (v != null) { + return v; + } + } + View parent = this; while (parent.mParent != null && parent.mParent instanceof View) { @@ -6305,22 +6615,18 @@ public class View implements Drawable.Callback, KeyEvent.Callback { location[0] = mLeft; location[1] = mTop; - if (!(mParent instanceof View)) { - return; + ViewParent viewParent = mParent; + while (viewParent instanceof View) { + final View view = (View)viewParent; + location[0] += view.mLeft - view.mScrollX; + location[1] += view.mTop - view.mScrollY; + viewParent = view.mParent; } - - View parent = (View) mParent; - - while (parent != null) { - location[0] += parent.mLeft - parent.mScrollX; - location[1] += parent.mTop - parent.mScrollY; - - final ViewParent viewParent = parent.mParent; - if (viewParent != null && viewParent instanceof View) { - parent = (View) viewParent; - } else { - parent = null; - } + + if (viewParent instanceof ViewRoot) { + // *cough* + final ViewRoot vr = (ViewRoot)viewParent; + location[1] -= vr.mCurScrollY; } } @@ -6380,13 +6686,13 @@ public class View implements Drawable.Callback, KeyEvent.Callback { * Sets the identifier for this view. The identifier does not have to be * unique in this view's hierarchy. The identifier should be a positive * number. - * + * * @see #NO_ID * @see #getId * @see #findViewById * * @param id a number used to identify the view - * + * * @attr ref android.R.styleable#View_id */ public void setId(int id) { @@ -6421,11 +6727,12 @@ public class View implements Drawable.Callback, KeyEvent.Callback { * * @return a positive integer used to identify the view or {@link #NO_ID} * if the view has no ID - * + * * @see #setId * @see #findViewById * @attr ref android.R.styleable#View_id */ + @ViewDebug.CapturedViewProperty public int getId() { return mID; } @@ -6433,7 +6740,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback { /** * Returns this view's tag. * - * @return the Object stored in this view as a tag + * @return the Object stored in this view as a tag */ @ViewDebug.ExportedProperty public Object getTag() { @@ -6473,7 +6780,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback { */ protected void debug(int depth) { String output = debugIndent(depth - 1); - + output += "+ " + this; int id = getId(); if (id != -1) { @@ -6484,18 +6791,18 @@ public class View implements Drawable.Callback, KeyEvent.Callback { output += " (tag=" + tag + ")"; } Log.d(VIEW_LOG_TAG, output); - + if ((mPrivateFlags & FOCUSED) != 0) { - output = debugIndent(depth) + " FOCUSED"; + output = debugIndent(depth) + " FOCUSED"; Log.d(VIEW_LOG_TAG, output); } - + output = debugIndent(depth); output += "frame={" + mLeft + ", " + mTop + ", " + mRight + ", " + mBottom + "} scroll={" + mScrollX + ", " + mScrollY + "} "; Log.d(VIEW_LOG_TAG, output); - + if (mPaddingLeft != 0 || mPaddingTop != 0 || mPaddingRight != 0 || mPaddingBottom != 0) { output = debugIndent(depth); @@ -6503,12 +6810,12 @@ public class View implements Drawable.Callback, KeyEvent.Callback { + ", " + mPaddingRight + ", " + mPaddingBottom + "}"; Log.d(VIEW_LOG_TAG, output); } - + output = debugIndent(depth); output += "mMeasureWidth=" + mMeasuredWidth + " mMeasureHeight=" + mMeasuredHeight; Log.d(VIEW_LOG_TAG, output); - + output = debugIndent(depth); if (mLayoutParams == null) { output += "BAD! no layout params"; @@ -6516,7 +6823,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback { output = mLayoutParams.debug(output); } Log.d(VIEW_LOG_TAG, output); - + output = debugIndent(depth); output += "flags={"; output += View.printFlags(mViewFlags); @@ -6583,8 +6890,8 @@ public class View implements Drawable.Callback, KeyEvent.Callback { */ public void forceLayout() { mPrivateFlags |= FORCE_LAYOUT; - } - + } + /** *

    * This is called to find out how big a view should be. The parent @@ -6596,14 +6903,14 @@ public class View implements Drawable.Callback, KeyEvent.Callback { * {@link #onMeasure(int, int)}, called by this method. Therefore, only * {@link #onMeasure(int, int)} can and must be overriden by subclasses. *

    - * - * + * + * * @param widthMeasureSpec Horizontal space requirements as imposed by the * parent * @param heightMeasureSpec Vertical space requirements as imposed by the * parent * - * @see #onMeasure(int, int) + * @see #onMeasure(int, int) */ public final void measure(int widthMeasureSpec, int heightMeasureSpec) { if ((mPrivateFlags & FORCE_LAYOUT) == FORCE_LAYOUT || @@ -6642,7 +6949,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback { * should be overriden by subclasses to provide accurate and efficient * measurement of their contents. *

    - * + * *

    * CONTRACT: When overriding this method, you * must call {@link #setMeasuredDimension(int, int)} to store the @@ -6651,35 +6958,35 @@ public class View implements Drawable.Callback, KeyEvent.Callback { * {@link #measure(int, int)}. Calling the superclass' * {@link #onMeasure(int, int)} is a valid use. *

    - * + * *

    * The base class implementation of measure defaults to the background size, * unless a larger size is allowed by the MeasureSpec. Subclasses should * override {@link #onMeasure(int, int)} to provide better measurements of * their content. *

    - * + * *

    * If this method is overridden, it is the subclass's responsibility to make * sure the measured height and width are at least the view's minimum height * and width ({@link #getSuggestedMinimumHeight()} and * {@link #getSuggestedMinimumWidth()}). *

    - * + * * @param widthMeasureSpec horizontal space requirements as imposed by the parent. * The requirements are encoded with * {@link android.view.View.MeasureSpec}. * @param heightMeasureSpec vertical space requirements as imposed by the parent. * The requirements are encoded with * {@link android.view.View.MeasureSpec}. - * + * * @see #getMeasuredWidth() * @see #getMeasuredHeight() * @see #setMeasuredDimension(int, int) * @see #getSuggestedMinimumHeight() * @see #getSuggestedMinimumWidth() * @see android.view.View.MeasureSpec#getMode(int) - * @see android.view.View.MeasureSpec#getSize(int) + * @see android.view.View.MeasureSpec#getSize(int) */ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { setMeasuredDimension(getDefaultSize(getSuggestedMinimumWidth(), widthMeasureSpec), @@ -6704,7 +7011,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback { /** * Utility to reconcile a desired size with constraints imposed by a MeasureSpec. * Will take the desired size, unless a different size is imposed by the constraints. - * + * * @param size How big the view wants to be * @param measureSpec Constraints imposed by the parent * @return The size this view should be. @@ -6726,12 +7033,12 @@ public class View implements Drawable.Callback, KeyEvent.Callback { } return result; } - + /** * Utility to return a default size. Uses the supplied size if the * MeasureSpec imposed no contraints. Will get larger if allowed * by the MeasureSpec. - * + * * @param size Default size for this view * @param measureSpec Constraints imposed by the parent * @return The size this view should be. @@ -6740,7 +7047,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback { int result = size; int specMode = MeasureSpec.getMode(measureSpec); int specSize = MeasureSpec.getSize(measureSpec); - + switch (specMode) { case MeasureSpec.UNSPECIFIED: result = size; @@ -6761,19 +7068,19 @@ public class View implements Drawable.Callback, KeyEvent.Callback { *

    * When being used in {@link #onMeasure(int, int)}, the caller should still * ensure the returned height is within the requirements of the parent. - * + * * @return The suggested minimum height of the view. */ protected int getSuggestedMinimumHeight() { int suggestedMinHeight = mMinHeight; - + if (mBGDrawable != null) { final int bgMinHeight = mBGDrawable.getMinimumHeight(); if (suggestedMinHeight < bgMinHeight) { suggestedMinHeight = bgMinHeight; } } - + return suggestedMinHeight; } @@ -6785,19 +7092,19 @@ public class View implements Drawable.Callback, KeyEvent.Callback { *

    * When being used in {@link #onMeasure(int, int)}, the caller should still * ensure the returned width is within the requirements of the parent. - * + * * @return The suggested minimum width of the view. */ protected int getSuggestedMinimumWidth() { int suggestedMinWidth = mMinWidth; - + if (mBGDrawable != null) { final int bgMinWidth = mBGDrawable.getMinimumWidth(); if (suggestedMinWidth < bgMinWidth) { suggestedMinWidth = bgMinWidth; } } - + return suggestedMinWidth; } @@ -6805,7 +7112,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback { * Sets the minimum height of the view. It is not guaranteed the view will * be able to achieve this minimum height (for example, if its parent layout * constrains it with less available height). - * + * * @param minHeight The minimum height the view will try to be. */ public void setMinimumHeight(int minHeight) { @@ -6816,7 +7123,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback { * Sets the minimum width of the view. It is not guaranteed the view will * be able to achieve this minimum width (for example, if its parent layout * constrains it with less available width). - * + * * @param minWidth The minimum width the view will try to be. */ public void setMinimumWidth(int minWidth) { @@ -6832,10 +7139,10 @@ public class View implements Drawable.Callback, KeyEvent.Callback { public Animation getAnimation() { return mCurrentAnimation; } - + /** * Start the specified animation now. - * + * * @param animation the animation to start now */ public void startAnimation(Animation animation) { @@ -6843,23 +7150,23 @@ public class View implements Drawable.Callback, KeyEvent.Callback { setAnimation(animation); invalidate(); } - + /** * Cancels any animations for this view. */ public void clearAnimation() { mCurrentAnimation = null; } - + /** * Sets the next animation to play for this view. * If you want the animation to play immediately, use * startAnimation. This method provides allows fine-grained * control over the start time and invalidation, but you * must make sure that 1) the animation has a start time set, and - * 2) the view will be invalidated when the animation is supposed to + * 2) the view will be invalidated when the animation is supposed to * start. - * + * * @param animation The next animation, or null. */ public void setAnimation(Animation animation) { @@ -6914,25 +7221,26 @@ public class View implements Drawable.Callback, KeyEvent.Callback { * SurfaceView is always considered transparent, but its children are not, * therefore all View objects remove themselves from the global transparent * region (passed as a parameter to this function). - * + * * @param region The transparent region for this ViewRoot (window). - * + * * @return Returns true if the effective visibility of the view at this * point is opaque, regardless of the transparent region; returns false * if it is possible for underlying windows to be seen behind the view. - * + * * {@hide} */ public boolean gatherTransparentRegion(Region region) { - if (region != null) { + final AttachInfo attachInfo = mAttachInfo; + if (region != null && attachInfo != null) { final int pflags = mPrivateFlags; if ((pflags & SKIP_DRAW) == 0) { // The SKIP_DRAW flag IS NOT set, so this view draws. We need to // remove it from the transparent region. - getLocationInWindow(mLocation); - region.op(mLocation[0], mLocation[1], - mLocation[0] + mRight - mLeft, mLocation[1] + mBottom - mTop, - Region.Op.DIFFERENCE); + final int[] location = attachInfo.mTransparentLocation; + getLocationInWindow(location); + region.op(location[0], location[1], location[0] + mRight - mLeft, + location[1] + mBottom - mTop, Region.Op.DIFFERENCE); } else if ((pflags & ONLY_DRAWS_BACKGROUND) != 0 && mBGDrawable != null) { // The ONLY_DRAWS_BACKGROUND flag IS set and the background drawable // exists, so we remove the background drawable's non-transparent @@ -6952,7 +7260,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback { * * The sound effect will only be played if sound effects are enabled by the user, and * {@link #isSoundEffectsEnabled()} is true. - * + * * @param soundConstant One of the constants defined in {@link SoundEffectConstants} */ protected void playSoundEffect(int soundConstant) { @@ -6967,7 +7275,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback { * update a Region being computed for {@link #gatherTransparentRegion} so * that any non-transparent parts of the Drawable are removed from the * given transparent region. - * + * * @param dr The Drawable whose transparency is to be applied to the region. * @param region A Region holding the current transparency information, * where any parts of the region that are set are considered to be @@ -6982,7 +7290,8 @@ public class View implements Drawable.Callback, KeyEvent.Callback { } final Region r = dr.getTransparentRegion(); final Rect db = dr.getBounds(); - if (r != null) { + final AttachInfo attachInfo = mAttachInfo; + if (r != null && attachInfo != null) { final int w = getRight()-getLeft(); final int h = getBottom()-getTop(); if (db.left > 0) { @@ -7001,8 +7310,9 @@ public class View implements Drawable.Callback, KeyEvent.Callback { //Log.i("VIEW", "Drawable bottom " + db.bottom + " < view " + h); r.op(0, db.bottom, w, h, Region.Op.UNION); } - getLocationInWindow(mLocation); - r.translate(mLocation[0], mLocation[1]); + final int[] location = attachInfo.mTransparentLocation; + getLocationInWindow(location); + r.translate(location[0], location[1]); region.op(r, Region.Op.INTERSECT); } else { region.op(db, Region.Op.DIFFERENCE); @@ -7177,10 +7487,10 @@ public class View implements Drawable.Callback, KeyEvent.Callback { } class CheckForLongPress implements Runnable { - + private int mOriginalWindowAttachCount; - - public void run() { + + public void run() { if (isPressed() && (mParent != null) && hasWindowFocus() && mOriginalWindowAttachCount == mWindowAttachCount) { if (performLongClick()) { @@ -7188,7 +7498,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback { } } } - + public void rememberWindowAttachCount() { mOriginalWindowAttachCount = mWindowAttachCount; } @@ -7279,7 +7589,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback { /** * Called when the context menu for this view is being built. It is not * safe to hold onto the menu after this method returns. - * + * * @param menu The context menu that is being built * @param v The view for which the context menu is being built * @param menuInfo Extra information about the item for which the @@ -7297,12 +7607,12 @@ public class View implements Drawable.Callback, KeyEvent.Callback { /** * Base class for derived classes that want to save and restore their own - * state in {@link #onSaveInstanceState}. + * state in {@link android.view.View#onSaveInstanceState()}. */ public static class BaseSavedState extends AbsSavedState { /** * Constructor used when reading from a parcel. Reads the state of the superclass. - * + * * @param source */ public BaseSavedState(Parcel source) { @@ -7311,7 +7621,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback { /** * Constructor called by derived classes when creating their SavedState objects - * + * * @param superState The state of the superclass of this view */ public BaseSavedState(Parcelable superState) { @@ -7340,11 +7650,21 @@ public class View implements Drawable.Callback, KeyEvent.Callback { void playSoundEffect(int effectId); } - IBinder mWindowToken; + final IWindowSession mSession; + + final IWindow mWindow; + + final IBinder mWindowToken; + + final SoundEffectPlayer mSoundEffectPlayer; + + /** + * The top view of the hierarchy. + */ + View mRootView; + IBinder mPanelParentWindowToken; Surface mSurface; - IWindowSession mSession; - SoundEffectPlayer mSoundEffectPlayer; /** * Left position of this view's window @@ -7356,6 +7676,37 @@ public class View implements Drawable.Callback, KeyEvent.Callback { */ int mWindowTop; + /** + * For windows that are full-screen but using insets to layout inside + * of the screen decorations, these are the current insets for the + * content of the window. + */ + final Rect mContentInsets = new Rect(); + + /** + * For windows that are full-screen but using insets to layout inside + * of the screen decorations, these are the current insets for the + * actual visible parts of the window. + */ + final Rect mVisibleInsets = new Rect(); + + /** + * The internal insets given by this window. This value is + * supplied by the client (through + * {@link ViewTreeObserver.OnComputeInternalInsetsListener}) and will + * be given to the window manager when changed to be used in laying + * out windows behind it. + */ + final ViewTreeObserver.InternalInsetsInfo mGivenInternalInsets + = new ViewTreeObserver.InternalInsetsInfo(); + + /** + * All views in the window's hierarchy that serve as scroll containers, + * used to determine if the window can be resized or must be panned + * to adjust for a soft input area. + */ + final ArrayList mScrollContainers = new ArrayList(); + /** * Indicates whether the view's window currently has the focus. */ @@ -7365,7 +7716,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback { * The current visibility of the window. */ int mWindowVisibility; - + /** * Indicates the time at which drawing started to occur. */ @@ -7375,7 +7726,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback { * Indicates whether the view's window is currently in touch mode. */ boolean mInTouchMode; - + /** * Indicates that ViewRoot should trigger a global layout change * the next time it performs a traversal @@ -7387,12 +7738,29 @@ public class View implements Drawable.Callback, KeyEvent.Callback { * recomputed. */ boolean mAttributesChanged; - + /** * Set during a traveral if any views want to keep the screen on. */ boolean mKeepScreenOn; - + + /** + * Set if the visibility of any views has changed. + */ + boolean mViewVisibilityChanged; + + /** + * Global to the view hierarchy used as a temporary for dealing with + * x/y points in the transparent region computations. + */ + final int[] mTransparentLocation = new int[2]; + + /** + * Global to the view hierarchy used as a temporary for dealing with + * x/y points in the ViewGroup.invalidateChild implementation. + */ + final int[] mInvalidateChildLocation = new int[2]; + /** * The view tree observer used to dispatch global events like * layout, pre-draw, touch mode change, etc. @@ -7422,17 +7790,23 @@ public class View implements Drawable.Callback, KeyEvent.Callback { */ static final int INVALIDATE_RECT_MSG = 0x2; - AttachInfo(Handler handler) { - this(handler, null); - } - + /** + * Temporary for use in computing invalidate rectangles while + * calling up the hierarchy. + */ + final Rect mTmpInvalRect = new Rect(); + /** * Creates a new set of attachment information with the specified * events handler and thread. * * @param handler the events handler the view must use */ - AttachInfo(Handler handler, SoundEffectPlayer effectPlayer) { + AttachInfo(IWindowSession session, IWindow window, + Handler handler, SoundEffectPlayer effectPlayer) { + mSession = session; + mWindow = window; + mWindowToken = window.asBinder(); mHandler = handler; mSoundEffectPlayer = effectPlayer; } diff --git a/core/java/android/view/ViewConfiguration.java b/core/java/android/view/ViewConfiguration.java index 38be806e20434..b7110ce101ab7 100644 --- a/core/java/android/view/ViewConfiguration.java +++ b/core/java/android/view/ViewConfiguration.java @@ -45,6 +45,13 @@ public class ViewConfiguration { */ private static final int LONG_PRESS_TIMEOUT = 500; + /** + * Defines the duration in milliseconds a user needs to hold down the + * appropriate button to bring up the global actions dialog (power off, + * lock screen, etc). + */ + private static final int GLOBAL_ACTIONS_KEY_TIMEOUT = 500; + /** * Defines the duration in milliseconds we will wait to see if a touch event * is a top or a scroll. If the user does not move within this interval, it is @@ -65,14 +72,6 @@ public class ViewConfiguration { */ private static final int ZOOM_CONTROLS_TIMEOUT = 3000; - /** - * Defines the duration in milliseconds a user needs to hold down the - * appropriate button to bring up the global actions dialog (power off, - * lock screen, etc). - */ - private static final int GLOBAL_ACTIONS_KEY_TIMEOUT = 1000; - - /** * Inset in pixels to look for touchable content when the user touches the edge of the screen */ diff --git a/core/java/android/view/ViewDebug.java b/core/java/android/view/ViewDebug.java index 1bf46b48cd412..883c7bd2e5d26 100644 --- a/core/java/android/view/ViewDebug.java +++ b/core/java/android/view/ViewDebug.java @@ -19,6 +19,7 @@ package android.view; import android.util.Log; import android.content.res.Resources; import android.graphics.Bitmap; +import android.os.Environment; import java.io.File; import java.io.BufferedWriter; @@ -60,7 +61,19 @@ public class ViewDebug { * check that this value is set to true as not to affect performance. */ public static final boolean TRACE_RECYCLER = false; - + + /** + * The system property of dynamic switch for capturing view information + * when it is set, we dump interested fields and methods for the view on focus + */ + static final String SYSTEM_PROPERTY_CAPTURE_VIEW = "debug.captureview"; + + /** + * The system property of dynamic switch for capturing event information + * when it is set, we log key events, touch/motion and trackball events + */ + static final String SYSTEM_PROPERTY_CAPTURE_EVENT = "debug.captureevent"; + /** * This annotation can be used to mark fields and methods to be dumped by * the view server. Only non-void methods with no arguments can be annotated @@ -143,6 +156,29 @@ public class ViewDebug { */ String to(); } + + /** + * This annotation can be used to mark fields and methods to be dumped when + * the view is captured. Methods with this annotation must have no arguments + * and must return . + * + * @hide pending API Council approval + */ + @Target({ ElementType.FIELD, ElementType.METHOD }) + @Retention(RetentionPolicy.RUNTIME) + public @interface CapturedViewProperty { + /** + * When retrieveReturn is true, we need to retrieve second level methods + * e.g., we need myView.getFirstLevelMethod().getSecondLevelMethod() + * we will set retrieveReturn = true on the annotation of + * myView.getFirstLevelMethod() + * @return true if we need the second level methods + */ + boolean retrieveReturn() default false; + } + + private static HashMap, Method[]> mCapturedViewMethodsForClasses = null; + private static HashMap, Field[]> mCapturedViewFieldsForClasses = null; // Maximum delay in ms after which we stop trying to capture a View's drawing private static final int CAPTURE_TIMEOUT = 4000; @@ -154,7 +190,7 @@ public class ViewDebug { private static HashMap, Field[]> sFieldsForClasses; private static HashMap, Method[]> sMethodsForClasses; - + /** * Defines the type of hierarhcy trace to output to the hierarchy traces file. */ @@ -250,8 +286,8 @@ public class ViewDebug { /** * Starts tracing the view recycler of the specified view. The trace is identified by a prefix, - * used to build the traces files names: /tmp/view-recycler/PREFIX.traces and - * /tmp/view-recycler/PREFIX.recycler. + * used to build the traces files names: /EXTERNAL/view-recycler/PREFIX.traces and + * /EXTERNAL/view-recycler/PREFIX.recycler. * * Only one view recycler can be traced at the same time. After calling this method, any * other invocation will result in a IllegalStateException unless @@ -287,10 +323,10 @@ public class ViewDebug { /** * Stops the current view recycer tracing. * - * Calling this method creates the file /tmp/view-recycler/PREFIX.traces + * Calling this method creates the file /EXTERNAL/view-recycler/PREFIX.traces * containing all the traces (or method calls) relative to the specified view's recycler. * - * Calling this method creates the file /tmp/view-recycler/PREFIX.recycler + * Calling this method creates the file /EXTERNAL/view-recycler/PREFIX.recycler * containing all of the views used by the recycler of the view supplied to * {@link #startRecyclerTracing(String, View)}. * @@ -310,7 +346,7 @@ public class ViewDebug { " stopRecyclerTracing()!"); } - File recyclerDump = new File("/tmp/view-recycler/"); + File recyclerDump = new File(Environment.getExternalStorageDirectory(), "view-recycler/"); recyclerDump.mkdirs(); recyclerDump = new File(recyclerDump, sRecyclerTracePrefix + ".recycler"); @@ -329,7 +365,7 @@ public class ViewDebug { return; } - recyclerDump = new File("/tmp/view-recycler/"); + recyclerDump = new File(Environment.getExternalStorageDirectory(), "view-recycler/"); recyclerDump = new File(recyclerDump, sRecyclerTracePrefix + ".traces"); try { final FileOutputStream file = new FileOutputStream(recyclerDump); @@ -384,14 +420,14 @@ public class ViewDebug { /** * Starts tracing the view hierarchy of the specified view. The trace is identified by a prefix, - * used to build the traces files names: /tmp/view-hierarchy/PREFIX.traces and - * /tmp/view-hierarchy/PREFIX.tree. + * used to build the traces files names: /EXTERNAL/view-hierarchy/PREFIX.traces and + * /EXTERNAL/view-hierarchy/PREFIX.tree. * * Only one view hierarchy can be traced at the same time. After calling this method, any * other invocation will result in a IllegalStateException unless * {@link #stopHierarchyTracing()} is invoked before. * - * Calling this method creates the file /tmp/view-hierarchy/PREFIX.traces + * Calling this method creates the file /EXTERNAL/view-hierarchy/PREFIX.traces * containing all the traces (or method calls) relative to the specified view's hierarchy. * * This method will return immediately if TRACE_HIERARCHY is false. @@ -413,7 +449,7 @@ public class ViewDebug { " a new trace!"); } - File hierarchyDump = new File("/tmp/view-hierarchy/"); + File hierarchyDump = new File(Environment.getExternalStorageDirectory(), "view-hierarchy/"); hierarchyDump.mkdirs(); hierarchyDump = new File(hierarchyDump, prefix + ".traces"); @@ -431,10 +467,11 @@ public class ViewDebug { /** * Stops the current view hierarchy tracing. This method closes the file - * /tmp/view-hierarchy/PREFIX.traces. + * /EXTERNAL/view-hierarchy/PREFIX.traces. * - * Calling this method creates the file /tmp/view-hierarchy/PREFIX.tree containing - * the view hierarchy of the view supplied to {@link #startHierarchyTracing(String, View)}. + * Calling this method creates the file /EXTERNAL/view-hierarchy/PREFIX.tree + * containing the view hierarchy of the view supplied to + * {@link #startHierarchyTracing(String, View)}. * * This method will return immediately if TRACE_HIERARCHY is false. * @@ -459,7 +496,7 @@ public class ViewDebug { } sHierarchyTraces = null; - File hierarchyDump = new File("/tmp/view-hierarchy/"); + File hierarchyDump = new File(Environment.getExternalStorageDirectory(), "view-hierarchy/"); hierarchyDump.mkdirs(); hierarchyDump = new File(hierarchyDump, sHierarchyTracePrefix + ".tree"); @@ -484,7 +521,7 @@ public class ViewDebug { sHierarhcyRoot = null; } - + static void dispatchCommand(View view, String command, String parameters, OutputStream clientStream) throws IOException { @@ -714,10 +751,10 @@ public class ViewDebug { final ArrayList foundMethods = new ArrayList(); methods = klass.getDeclaredMethods(); - + int count = methods.length; for (int i = 0; i < count; i++) { - final Method method = methods[i]; + final Method method = methods[i]; if (method.getParameterTypes().length == 0 && method.isAnnotationPresent(ExportedProperty.class) && method.getReturnType() != Void.class) { @@ -746,7 +783,7 @@ public class ViewDebug { klass = klass.getSuperclass(); } while (klass != Object.class); } - + private static void exportMethods(Object view, BufferedWriter out, Class klass, String prefix) throws IOException { @@ -767,8 +804,12 @@ public class ViewDebug { final Resources resources = ((View) view).getContext().getResources(); final int id = (Integer) methodValue; if (id >= 0) { - methodValue = resources.getResourceTypeName(id) + '/' + - resources.getResourceEntryName(id); + try { + methodValue = resources.getResourceTypeName(id) + '/' + + resources.getResourceEntryName(id); + } catch (Resources.NotFoundException e) { + methodValue = "UNKNOWN"; + } } else { methodValue = "NO_ID"; } @@ -839,8 +880,12 @@ public class ViewDebug { final Resources resources = ((View) view).getContext().getResources(); final int id = field.getInt(view); if (id >= 0) { - fieldValue = resources.getResourceTypeName(id) + '/' + - resources.getResourceEntryName(id); + try { + fieldValue = resources.getResourceTypeName(id) + '/' + + resources.getResourceEntryName(id); + } catch (Resources.NotFoundException e) { + fieldValue = "UNKNOWN"; + } } else { fieldValue = "NO_ID"; } @@ -924,4 +969,160 @@ public class ViewDebug { } return true; } + + private static Field[] capturedViewGetPropertyFields(Class klass) { + if (mCapturedViewFieldsForClasses == null) { + mCapturedViewFieldsForClasses = new HashMap, Field[]>(); + } + final HashMap, Field[]> map = mCapturedViewFieldsForClasses; + + Field[] fields = map.get(klass); + if (fields != null) { + return fields; + } + + final ArrayList foundFields = new ArrayList(); + fields = klass.getFields(); + + int count = fields.length; + for (int i = 0; i < count; i++) { + final Field field = fields[i]; + if (field.isAnnotationPresent(CapturedViewProperty.class)) { + field.setAccessible(true); + foundFields.add(field); + } + } + + fields = foundFields.toArray(new Field[foundFields.size()]); + map.put(klass, fields); + + return fields; + } + + private static Method[] capturedViewGetPropertyMethods(Class klass) { + if (mCapturedViewMethodsForClasses == null) { + mCapturedViewMethodsForClasses = new HashMap, Method[]>(); + } + final HashMap, Method[]> map = mCapturedViewMethodsForClasses; + + Method[] methods = map.get(klass); + if (methods != null) { + return methods; + } + + final ArrayList foundMethods = new ArrayList(); + methods = klass.getMethods(); + + int count = methods.length; + for (int i = 0; i < count; i++) { + final Method method = methods[i]; + if (method.getParameterTypes().length == 0 && + method.isAnnotationPresent(CapturedViewProperty.class) && + method.getReturnType() != Void.class) { + method.setAccessible(true); + foundMethods.add(method); + } + } + + methods = foundMethods.toArray(new Method[foundMethods.size()]); + map.put(klass, methods); + + return methods; + } + + private static String capturedViewExportMethods(Object obj, Class klass, + String prefix) { + + if (obj == null) { + return "null"; + } + + StringBuilder sb = new StringBuilder(); + final Method[] methods = capturedViewGetPropertyMethods(klass); + + int count = methods.length; + for (int i = 0; i < count; i++) { + final Method method = methods[i]; + try { + Object methodValue = method.invoke(obj, (Object[]) null); + final Class returnType = method.getReturnType(); + + CapturedViewProperty property = method.getAnnotation(CapturedViewProperty.class); + if (property.retrieveReturn()) { + //we are interested in the second level data only + sb.append(capturedViewExportMethods(methodValue, returnType, method.getName() + "#")); + } else { + sb.append(prefix); + sb.append(method.getName()); + sb.append("()="); + + if (methodValue != null) { + final String value = methodValue.toString().replace("\n", "\\n"); + sb.append(value); + } else { + sb.append("null"); + } + sb.append("; "); + } + } catch (IllegalAccessException e) { + //Exception IllegalAccess, it is OK here + //we simply ignore this method + } catch (InvocationTargetException e) { + //Exception InvocationTarget, it is OK here + //we simply ignore this method + } + } + return sb.toString(); + } + + private static String capturedViewExportFields(Object obj, Class klass, String prefix) { + + if (obj == null) { + return "null"; + } + + StringBuilder sb = new StringBuilder(); + final Field[] fields = capturedViewGetPropertyFields(klass); + + int count = fields.length; + for (int i = 0; i < count; i++) { + final Field field = fields[i]; + try { + Object fieldValue = field.get(obj); + + sb.append(prefix); + sb.append(field.getName()); + sb.append("="); + + if (fieldValue != null) { + final String value = fieldValue.toString().replace("\n", "\\n"); + sb.append(value); + } else { + sb.append("null"); + } + sb.append(' '); + } catch (IllegalAccessException e) { + //Exception IllegalAccess, it is OK here + //we simply ignore this field + } + } + return sb.toString(); + } + + /** + * dump view info for id based instrument test generation + * (and possibly further data analysis). The results are dumped + * to the log. + * @param tag for log + * @param view for dump + * + * @hide pending API Council approval + */ + public static void dumpCapturedView(String tag, Object view) { + Class klass = view.getClass(); + StringBuilder sb = new StringBuilder(klass.getName() + ": "); + sb.append(capturedViewExportFields(view, klass, "")); + sb.append(capturedViewExportMethods(view, klass, "")); + Log.d(tag, sb.toString()); + } } diff --git a/core/java/android/view/ViewGroup.java b/core/java/android/view/ViewGroup.java index 9063821c2dc09..e26a19e54e5e4 100644 --- a/core/java/android/view/ViewGroup.java +++ b/core/java/android/view/ViewGroup.java @@ -73,7 +73,7 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager private View mFocused; // The current transformation to apply on the child being drawn - private final Transformation mChildTransformation = new Transformation(); + private Transformation mChildTransformation; // Target of Motion events private View mMotionTarget; @@ -148,9 +148,6 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager * {@link #getChildStaticTransformation(View, android.view.animation.Transformation)} should * set this flags in {@link #mGroupFlags}. * - * This flag needs to be removed until we can add a setter for it. People - * can't be directly stuffing values in to mGroupFlags!!! - * * {@hide} */ protected static final int FLAG_SUPPORT_STATIC_TRANSFORMATIONS = 0x800; @@ -466,27 +463,7 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager } /** - * Called when a child of this group wants a particular rectangle to be - * positioned onto the screen. {@link ViewGroup}s overriding this can trust - * that: - *

      - *
    • child will be a direct child of this group
    • - *
    • rectangle will be in the child's coordinates
    • - *
    - * - *

    {@link ViewGroup}s overriding this should uphold the contract:

    - *